Diagnosing PIN and signal issues through the ModemManager

Aleksander Morgado aleksandermj at chromium.org
Mon Oct 17 08:49:31 UTC 2022


> My company produces a device with the Sierra EM7565 Modem and we've been looking for a robust way to diagnose the root cause of problems it may encounter. Specifically, we require users to only use SIM cards that have had their PIN previously disabled. If they haven't done so, creating a mobile connection will quietly fail. My first question is: How can we reliably tell that the PIN has been disabled or that it is still enabled? Searching through the archive, I found the following quote at https://lists.freedesktop.org/archives/modemmanager-devel/2017-August/005555.html:
> > Here's the issue: If PIN1 is currently disabled, some modem reports
> > the info about another PIN, say PIN2, to a MBIM_CID_PIN query. When we
> > try to enable PIN1, we won't know the retries count until after
> > entering a PIN once. Suppose the retries count doesn't go to 0 after a
> > wrong attempt (i.e. not in sim-puk state), we still can't query MM for
> > the retries count of PIN1.

For your usecase I wouldn't try to look at the unlock retries.

> Currently, when inspecting a modem with PIN-disabled SIM in it using mmcli, we get output resembling the following:
>   --------------------------------
>   Status   |                 lock: sim-pin2
>            |       unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
>            |                state: enabled
>            |          power state: on
>            |       signal quality: 0% (cached)
>   --------------------------------
> Would I be correct in assuming that the lock field being set to "sim-pin2" always means "PIN diabled", whereas "sim-pin" always means "PIN enabled"?

The "lock" field reports which is the currently active lock, if any. A
lot of Qualcomm based modems will report "sim-pin2" as locked, which
doesn't prevent connectivity at all and so that is really fine for us,
can be ignored.

If upon modem boot the modem gets into state "enabled" or "registered"
automatically, you can assume SIM-PIN is disabled.
If upon modem boot the modem gets into state "locked" with "lock"
being "sim-pin" then SIM-PIN is enabled.

> My second question has to do with the relation between signal quality and modem state. According to https://www.freedesktop.org/software/ModemManager/doc/latest/ModemManager/ModemManager-Flags-and-Enumerations.html#MMModemState, MM_MODEM_STATE_ENABLED means:
> "The modem is enabled and powered on but not registered with a network provider and not available for data connections."
> I am not sure whether this indicates an error state or simply means that the modem has no reception. Our devices are often used in areas where reception is patchy or inconsistent, and we would love to have a way of reliably confirming that our issues come from that rather than a software issue on our part.

If the modem is "enabled" but not "registered" it means it's likely
either idle or searching for a network. You can look at the "3GPP
registration state" field to know more. Also, upon forbidden
registration attempts, the reason for the registration rejection is
logged in the system log, that is also a good way to understand if
you're being forbidden to register. Every 3GPP modem out there will
attempt to automatically register in the network, so if you're seeing
the modem as "enabled" it means either no network around, or network
registration rejection.


More information about the ModemManager-devel mailing list