Search code examples
modemnmcli

Query SIM PIN status with `nmcli`


I am working with nmcli to create a modem connection using a SIM.

I need to know: is there a command (possibily, a nmcli command) that queries the SIM and returns an answer that tells whether the PIN is enabled or not on that SIM?

Thanks in advance.


Solution

  • You can do it using mmcli.

    Get modem index using:

    $ mmcli -L
        Found 1 modems:
        /org/freedesktop/ModemManager1/Modem/0 [huawei] E176
    

    and then get the modem info (including SIM info) using:

    $ sudo mmcli -m 0
    ...
      -------------------------
      Status   |           lock: 'sim-pin'
               | unlock retries: 'sim-pin (3), sim-puk (10)'
               |          state: 'locked'
               |    power state: 'on'
               |    access tech: 'unknown'
               | signal quality: '0' (cached)
      -------------------------
    ...
      SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'
    ...
    

    See link