From ed733cc9525fc5ecad919cc0934e5420fb1b1e1d Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Tue, 9 Oct 2012 21:14:51 +0200 Subject: [PATCH] fix scanning of E-GSM-900 Signed-off-by: Steve Markgraf --- src/arfcn_freq.cc | 2 +- src/c0_detect.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/arfcn_freq.cc b/src/arfcn_freq.cc index 1c7a2b7..e876c06 100644 --- a/src/arfcn_freq.cc +++ b/src/arfcn_freq.cc @@ -95,7 +95,7 @@ double arfcn_to_freq(int n, int *bi) { } if((1 <= n) && (n <= 124)) { - if(bi) + if(bi && (*bi != GSM_E_900)) *bi = GSM_900; return 890.0e6 + 0.2e6 * n + 45.0e6; } diff --git a/src/c0_detect.cc b/src/c0_detect.cc index 55d5590..bd010f7 100644 --- a/src/c0_detect.cc +++ b/src/c0_detect.cc @@ -79,7 +79,7 @@ int c0_detect(usrp_source *u, int bi) { } u->start(); u->flush(); - for(i = first_chan(bi); i > 0; i = next_chan(i, bi)) { + for(i = first_chan(bi); i >= 0; i = next_chan(i, bi)) { freq = arfcn_to_freq(i, &bi); if(!u->tune(freq)) { fprintf(stderr, "error: usrp_source::tune\n"); @@ -111,7 +111,7 @@ int c0_detect(usrp_source *u, int bi) { * channels when we construct the average. */ chan_count = 0; - for(i = first_chan(bi); i > 0; i = next_chan(i, bi)) { + for(i = first_chan(bi); i >= 0; i = next_chan(i, bi)) { spower[chan_count++] = power[i]; } sort(spower, chan_count); @@ -166,7 +166,7 @@ int c0_detect(usrp_source *u, int bi) { i = next_chan(i, bi); } } - } while(i > 0); + } while(i >= 0); return 0; }