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

Aleksander Morgado aleksander at aleksander.es
Thu Oct 22 14:30:20 PDT 2015


On Thu, Oct 22, 2015 at 10:45 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.

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().

What do you think?

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list