Question on Mobile Identification Number for GSM

Aleksander Morgado aleksander at aleksander.es
Fri Oct 31 14:39:01 PDT 2014


On Fri, Oct 31, 2014 at 6:15 PM, Dan Williams <dcbw at redhat.com> wrote:
>> >> So for now, you can read the "Imsi" property of the Sim interface, and
>> >> then the OperatorIdentifier property of the Sim interface.  Strip the 5
>> >> or 6 digit OperatorIdentifier (which is the MCC/MNC of the issuing telco
>> >> eg "310260") off the front of the Imsi, and you've got the MSIN.
>> >
>> > Problem being that you may not know exactly how many digits to strip
>> > (5 or 6). I have a built-in database of MNC lengths developed for
>> > ModemManager somewhere in a branch, but it wasn't perfect (lots of
>> > issues in India IIRC). Still, that may be a
>> > not-perfect-but-still-useful approach? I believe that Ofono ended up
>> > doing the same. BTW; my need of this database of MNC lengths wasn't to
>> > get the MSIN, but to actually get the MCCMNC of the SIM card and
>> > expose it in the interface...
>>
>>
>> This is the branch I was referring about:
>> http://cgit.freedesktop.org/ModemManager/ModemManager?h=aleksander%2Fmnc-length
>>
>> And this was the patch introducing the MNC length guess:
>> http://cgit.freedesktop.org/ModemManager/ModemManager/commit/?h=aleksander/mnc-length&id=3feb7c8d148c8ea03cb46b535a4eccd9fb7966fa
>
> This was for SIMs that don't set the MNC length, right?  I forget
> whether we thought that was a rare occurrence or more common.


That was pretty common, at least in my case. None of my test sims
(from different operators) ended up having the EFad field which
indicates the MNC length, so the SIM MCCMNC was never being displayed
in the API. The best-guess branch that I had would likely work in
almost every case. Only India had a very huge list of mixed 2-digit
and 3-digit MNCs IIRC, and I couldn't find any reasonable approach to
handle that, than just defaulting to 3 digits in that case.

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list