diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index 02a75a5..45a49da 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -213,7 +213,7 @@ int range_enc_range512(uint8_t *chan_list, int f0, int *w) write_orig_arfcn(chan_list, f0);
range512 = (struct gsm48_range_512 *) &chan_list[0]; - range512->form_id = chan_list[0] = 0x44; + range512->form_id = 0x44;
/* W(1) */ range512->w1_hi = HIGH_BITS(w, 1, 9, 7);
hi,
just found a bug in range 512 channel list encoding. the useless write of 0x44 to chan_list[0] will destroy the LSB, which is part of frequency 0, previously written by write_orig_arfcn(). after fixing this, a frequency of ARFCN 512 encodes correctly.
regards,
andreas
On Sun, Dec 08, 2013 at 05:21:02PM +0100, Andreas Eversberg wrote:
just found a bug in range 512 channel list encoding. the useless write of 0x44 to chan_list[0] will destroy the LSB, which is part of frequency 0, previously written by write_orig_arfcn(). after fixing this, a frequency of ARFCN 512 encodes correctly.
o>
What about the below snippet. Does it work for you? It matches what the other (not implemented) routines do. Which ARFCN list did you encode? In our tests we probably never had orig_arfcn_hi:1 set.
diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index 02a75a5..5a2345e 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -210,10 +210,11 @@ int range_enc_range256(uint8_t *chan_list, int f0, int *w) int range_enc_range512(uint8_t *chan_list, int f0, int *w) { struct gsm48_range_512 *range512; + + chan_list[0] = 0x44; write_orig_arfcn(chan_list, f0);
range512 = (struct gsm48_range_512 *) &chan_list[0]; - range512->form_id = chan_list[0] = 0x44;
/* W(1) */ range512->w1_hi = HIGH_BITS(w, 1, 9, 7);
Holger Hans Peter Freyther wrote:
What about the below snippet. Does it work for you? It matches what the other (not implemented) routines do. Which ARFCN list did you encode? In our tests we probably never had orig_arfcn_hi:1 set.
diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index 02a75a5..5a2345e 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -210,10 +210,11 @@ int range_enc_range256(uint8_t *chan_list, int f0, int *w) int range_enc_range512(uint8_t *chan_list, int f0, int *w) { struct gsm48_range_512 *range512;
chan_list[0] = 0x44; write_orig_arfcn(chan_list, f0); range512 = (struct gsm48_range_512 *)&chan_list[0];
range512->form_id = chan_list[0] = 0x44; /* W(1) */ range512->w1_hi = HIGH_BITS(w, 1, 9, 7);
"range512->form_id" points to the upper 7 bits of chan_list[0]. when you do that, you would write 0x44 to chan_list[0] instead of the required 0x88. use "chan_list[0] = 0x88" instead.
On Sun, Dec 08, 2013 at 07:57:44PM +0100, Andreas Eversberg wrote:
"range512->form_id" points to the upper 7 bits of chan_list[0]. when you do that, you would write 0x44 to chan_list[0] instead of the required 0x88. use "chan_list[0] = 0x88" instead.
thanks, so
diff --git a/openbsc/src/libbsc/arfcn_range_encode.c b/openbsc/src/libbsc/arfcn_range_encode.c index 02a75a5..8ed4711 100644 --- a/openbsc/src/libbsc/arfcn_range_encode.c +++ b/openbsc/src/libbsc/arfcn_range_encode.c @@ -210,10 +210,11 @@ int range_enc_range256(uint8_t *chan_list, int f0, int *w) int range_enc_range512(uint8_t *chan_list, int f0, int *w) { struct gsm48_range_512 *range512; + + chan_list[0] = 0x88; write_orig_arfcn(chan_list, f0);
range512 = (struct gsm48_range_512 *) &chan_list[0]; - range512->form_id = chan_list[0] = 0x44;
/* W(1) */ range512->w1_hi = HIGH_BITS(w, 1, 9, 7);
will do the job. I will create a testcase and then include a patch.