[PATCH] sim-qmi: load operator identifier and name from NAS home network

Aleksander Morgado aleksander at aleksander.es
Wed Oct 28 04:14:53 PDT 2015


On Tue, Oct 27, 2015 at 4:06 PM, Dan Williams <dcbw at redhat.com> wrote:
>> >>> >> Being NAS commands, are these available also when not registered
>> >>> >> anywhere? E.g. when in low-power mode?
>> >>> >> I've seen people using these commands to retrieve SIM MCCMNC, but was
>> >>> >> never sure about them as they were NAS and not DMS.
>> >>> >
>> >>> > Tried Gobi 1k and UML290; they both still return the home network when
>> >>> > in low-power mode.  Also, the Gobi 1k didn't have any antennas connected
>> >>> > and it still returned the right home network...
>> >>>
>> >>> Ah! good then.
>> >>>
>> >>> The issue with the MNC length (whether 2 or 3 digits) still affects
>> >>> this implementation though. Actually, the implementation would not be
>> >>> ok even for 2 digits, as it's not appending a leading 0 for
>> >>> single-digit MNCs (e.g. "2141" instead of "21401"):
>> >>>     operator_id = g_strdup_printf ("%" G_GUINT16_FORMAT "%"
>> >>> G_GUINT16_FORMAT, mcc, mnc);
>> >>> It should append leading 0s to the MNC based on whether the MNC is 2
>> >>> or 3 digit long.
>> >>
>> >> Ah, good point.  I'd copied that from qmicli code and I guess it's wrong
>> >> there, and I didn't catch it here either.
>> >>
>> >>> Now, there's a TLV 0x12 "3GPP Home Network MNC" in Get Home Network
>> >>> that we didn't add yet to libqmi as far as I can tell. It consists of
>> >>> a sequence of 2 bytes that are read as booleans:
>> >>>   * 1st byte: whether the network is 3GPP.
>> >>>   * 2nd byte: if 1st byte is true (net is 3GPP), whether the MNC is 3
>> >>> digits long.
>> >>>
>> >>> Based on this, we could do:
>> >>>   * If TLV 0x12 is available,  we already got told the MNC length and
>> >>> we know how many 0s we need to prepend.
>> >>>   * If TLV 0x12 is not available, we only print 3 digits if MNC is >99
>> >>> and otherwise 2 digits always.
>> >>> This logic is already what we do when building MCCMNC from current
>> >>> serving system, as in common_process_serving_system_3gpp().
>> >>
>> >> Works for me, would you mind taking a stab at this?  I have to move on
>> >> to other stuff tomorrow and early next week...
>> >
>> > Sure, I'll try to do it myself during the weekend.
>>
>> All changes in git master already.
>>
>> MM now requires libqmi 1.13.5, which is the version bump I did to flag
>> the availability of the new optional TLV in "Get Home Network". Let me
>> know if you got any issue with the changes.
>
> They seem to work for me.
>
>> Not backported to 1.12.x as we require a libqmi version bump here.
>> Maybe we should backport your change plus this one?
>> http://cgit.freedesktop.org/ModemManager/ModemManager/commit/?id=77b6b02fd37cd8d89961dc32814b186639d1bafa
>
> After the testing yesterday with various SIMs I think this is the best
> path.  We could try to grab EFad if the new optional TLV isn't there but
> some devices don't let you access that if there's a PIN enabled.  Not
> sure that's worth it until we actually run into that issue though.
>
> So in other words, I think this is a good plan for now.

I cherry-picked to mm-1-4 all changes except for the one that required
the libqmi bump.

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list