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

Dan Williams dcbw at redhat.com
Tue Oct 27 08:06:54 PDT 2015


On Sun, 2015-10-25 at 16:06 +0100, Aleksander Morgado wrote:
> On Fri, Oct 23, 2015 at 1:14 PM, Aleksander Morgado
> <aleksander at aleksander.es> wrote:
> > On Fri, Oct 23, 2015 at 12:13 AM, Dan Williams <dcbw at redhat.com> wrote:
> >> On Thu, 2015-10-22 at 23:30 +0200, Aleksander Morgado wrote:
> >>> 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.
> >>
> >> 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.

Dan

> My MC7304 does report this optional TLV, but in my case it doesn't
> request 3 digits for MNC:
> 
> 25 oct 2015, 14:56:40] [Debug] [/dev/cdc-wdm6] Received message (translated)...
> >>>>>> QMUX:
> >>>>>>   length  = 42
> >>>>>>   flags   = 0x80
> >>>>>>   service = "nas"
> >>>>>>   client  = 3
> >>>>>> QMI:
> >>>>>>   flags       = "response"
> >>>>>>   transaction = 1
> >>>>>>   tlv_length  = 30
> >>>>>>   message     = "Get Home Network" (0x0025)
> >>>>>> TLV:
> >>>>>>   type       = "Result" (0x02)
> >>>>>>   length     = 4
> >>>>>>   value      = 00:00:00:00
> >>>>>>   translated = SUCCESS
> >>>>>> TLV:
> >>>>>>   type       = "Home Network" (0x01)
> >>>>>>   length     = 15
> >>>>>>   value      = D6:00:01:00:0A:76:6F:64:61:66:6F:6E:65:20:45
> >>>>>>   translated = [ mcc = '214' mnc = '1' description = 'vodafone E' ]
> >>>>>> TLV:
> >>>>>>   type       = "Home Network 3GPP MNC" (0x12)
> >>>>>>   length     = 2
> >>>>>>   value      = 01:00
> >>>>>>   translated = [ is_3gpp = 'yes' includes_pcs_digit = 'no' ]
> 
> [/dev/cdc-wdm6] Successfully got home network:
> Home network:
> MCC: '214'
> MNC: '1'
> Description: 'vodafone E'
> 
> Cheers!
> 




More information about the ModemManager-devel mailing list