From 50c3ca922b3d43f33f4e550e7a47b09af6dffc24 Mon Sep 17 00:00:00 2001 From: Joshua Lackey Date: Thu, 15 Nov 2012 10:42:18 +0100 Subject: Fix: Correctly convert ARFCN to index. If you enable PCS, you'll never make it out of power-measurement without this patch. --- src/host/layer23/src/mobile/gsm322.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c index ce5e1e1d..ffecfc37 100644 --- a/src/host/layer23/src/mobile/gsm322.c +++ b/src/host/layer23/src/mobile/gsm322.c @@ -300,11 +300,14 @@ uint16_t index2arfcn(int index) int arfcn2index(uint16_t arfcn) { - if ((arfcn & ARFCN_PCS) && arfcn >= 512 && arfcn <= 810) + int is_pcs = arfcn & ARFCN_PCS; + arfcn &= ~ARFCN_FLAG_MASK; + if ((is_pcs) && (arfcn >= 512) && (arfcn <= 810)) return (arfcn & 1023)-512+1024; return arfcn & 1023; } + static char *bargraph(int value, int min, int max) { static char bar[128]; -- cgit v1.2.3