Possible bug in "gsm48_decode_lai" code
niceguy108 at gmail.com
Sun Dec 2 06:49:34 UTC 2012
While running Cell-Log application, I found that the main branch of OsmocomBB gives wrong value of MCC/MNC in hex (but correct one in decimal), but the Sylvain testing branch gives correct value.
In practice this means compiling Cell-Log in testing branch gives the name of the country, but the compiling it in main branch does not recognise the country. Other side-effects are unknown to me at present.
Tracing through the source leads to the "gsm48_decode_lai" as the culprit. The code seems correct in the testing branch, but has not been updated in the main. Moreover, the code is shifted out from gsm48.c to sysinfo.c in the testing branch.
Testing branch decodes MCC/MNC to hex:
*mcc = ((lai->digits & 0x0f) << 8)
| (lai->digits & 0xf0)
| (lai->digits & 0x0f);
But main branch decodes MCC/MNC to decimal:
*mcc = (lai->digits & 0x0f) * 100
+ (lai->digits >> 4) * 10
+ (lai->digits & 0x0f);
The comment in main branch states that "/* Attention: this function retunrs true integers, not hex! */". There is no such comment in the testing branch.
So is this a problem because Cell_Log wrongly uses gsm48_decode_lai? Or does gsm48_decode_lai need to be updated in the main branch?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the baseband-devel