Date created: Wednesday, November 15, 2023 5:48:39 PM. Last modified: Tuesday, November 12, 2024 4:03:27 PM

Mobile Internet / WWAN / mmcli

Check if modem is detected:

$ sudo dmesg |grep mhi
[ 0.917256] mhi-pci-generic 0000:04:00.0: BAR 0: assigned [mem 0xfd500000-0xfd500fff 64bit]
[ 0.917273] mhi-pci-generic 0000:04:00.0: enabling device (0000 -> 0002)
[ 0.918317] mhi mhi0: Requested to power ON
[ 0.918496] mhi mhi0: Power on setup success
[ 2.984935] mhi mhi0: Wait for device to enter SBL or Mission mode

Here we see that the radio state is "fcc-locked":

$ sudo apt-get install libmbim-utils
$ sudo mbimcli -d /dev/wwan0mbim0 -p -v --quectel-query-radio-state
...
[10 Jul 2023, 18:10:58] [Debug] [/dev/wwan0mbim0] received message (translated)...
>>>>>> Header:
>>>>>> length = 52
>>>>>> type = command-done (0x80000003)
>>>>>> transaction = 3
>>>>>> Fragment header:
>>>>>> total = 1
>>>>>> current = 0
>>>>>> Contents:
>>>>>> status error = 'None' (0x00000000)
>>>>>> service = 'quectel' (11223344-5566-7788-99aa-bbccddeeff11)
>>>>>> cid = 'radio-state' (0x00000001)
>>>>>> Fields:
>>>>>> RadioState = 'fcc-locked'

Enabled the radio.

$ sudo mbimcli --device-open-proxy --device="/dev/wwan0mbim0" --quectel-set-radio-state=on
...
[10 Jul 2023, 18:21:08] [Debug] [/dev/wwan0mbim0] received message (translated)...
>>>>>> Header:
>>>>>> length = 52
>>>>>> type = command-done (0x80000003)
>>>>>> transaction = 3
>>>>>> Fragment header:
>>>>>> total = 1
>>>>>> current = 0
>>>>>> Contents:
>>>>>> status error = 'None' (0x00000000)
>>>>>> service = 'quectel' (11223344-5566-7788-99aa-bbccddeeff11)
>>>>>> cid = 'radio-state' (0x00000001)
>>>>>> Fields:
>>>>>> RadioState = 'on'

To make this permenant across reboots, sym-link the FCC-unlock scripts into the ModemManager directory.

$ sudo apt install network-manager
$ sudo ln -sft /etc/ModemManager/fcc-unlock.d /usr/share/ModemManager/fcc-unlock.available.d/*

 

Here we can see that there is a modem found but it has the eSIM slot set as the default, not the physical SIM:

$ mmcli --help-all
$ sudo mmcli --list-modems 
    /org/freedesktop/ModemManager1/Modem/0 [quectel] EM120R_GL

$ sudo mmcli -m any 
$ sudo mmcli -m 0
  -----------------------------------
  General  |                    path: /org/freedesktop/ModemManager1/Modem/1
           |               device id: fd4191211cbe29e0aXXXXXXXXXXXXXXXXXXXXX
  -----------------------------------
  Hardware |            manufacturer: quectel
           |                   model: EM120R_GL
           |       firmware revision: EM120RGLAPR02A07M4G
           |          carrier config: ROW_Commercial
           | carrier config revision: 08010809
           |            h/w revision: EM120R_GL
           |               supported: gsm-umts, lte
           |                 current: gsm-umts, lte
           |            equipment id: XXXXXXXXXXXXXX
  -----------------------------------
  System   |                  device: /sys/devices/pci0000:00/0000:00:02.5/0000:04:00.0
           |                 drivers: mhi-pci-generic
           |                  plugin: quectel
           |            primary port: wwan0mbim0
           |                   ports: wwan0 (net), wwan0at0 (at), wwan0mbim0 (mbim), 
           |                          wwan0qcdm0 (qcdm)
  -----------------------------------
  Status   |                   state: failed
           |           failed reason: esim-without-profiles
           |             power state: low
  -----------------------------------
  Modes    |               supported: allowed: 3g; preferred: none
           |                          allowed: 4g; preferred: none
           |                          allowed: 3g, 4g; preferred: 4g
           |                          allowed: 3g, 4g; preferred: 3g
           |                 current: allowed: 3g, 4g; preferred: 4g
  -----------------------------------
  Bands    |               supported: utran-1, utran-3, utran-4, utran-6, utran-5, utran-8, 
           |                          utran-2, eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-7, 
           |                          eutran-8, eutran-12, eutran-13, eutran-14, eutran-17, eutran-18, 
           |                          eutran-19, eutran-20, eutran-25, eutran-26, eutran-28, eutran-29, 
           |                          eutran-30, eutran-32, eutran-38, eutran-39, eutran-40, eutran-41, 
           |                          eutran-42, eutran-43, eutran-46, eutran-48, eutran-66, utran-19
           |                 current: utran-1, utran-3, utran-4, utran-6, utran-5, utran-8, 
           |                          utran-2, eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-7, 
           |                          eutran-8, eutran-12, eutran-13, eutran-14, eutran-18, eutran-19, 
           |                          eutran-20, eutran-25, eutran-26, eutran-28, eutran-29, eutran-30, 
           |                          eutran-32, eutran-38, eutran-39, eutran-40, eutran-41, eutran-42, 
           |                          eutran-43, eutran-46, eutran-48, eutran-66, utran-19
  -----------------------------------
  IP       |               supported: ipv4, ipv6, ipv4v6
  -----------------------------------
  SIM      |        primary sim path: /org/freedesktop/ModemManager1/SIM/1
           |          sim slot paths: slot 1: none
           |                          slot 2: /org/freedesktop/ModemManager1/SIM/1 (active)

We can switch from the eSIM slot to the physical SIM slot:

$ sudo mmcli -m 0 --set-primary-sim-slot=0
$ sudo mmcli -m 0

  -----------------------------------
  General  |                    path: /org/freedesktop/ModemManager1/Modem/0
           |               device id: fd4191211cbe29e0a1ec7XXXXXXXXXXXXXXX
  -----------------------------------
  Hardware |            manufacturer: quectel
           |                   model: EM120R_GL
           |       firmware revision: EM120RGLAPR02A07M4G
           |          carrier config: ROW_Commercial
           | carrier config revision: 08010809
           |            h/w revision: EM120R_GL
           |               supported: gsm-umts, lte
           |                 current: gsm-umts, lte
           |            equipment id: XXXXXXXXXXXXXXX
  -----------------------------------
  System   |                  device: /sys/devices/pci0000:00/0000:00:02.5/0000:04:00.0
           |                 drivers: mhi-pci-generic
           |                  plugin: quectel
           |            primary port: wwan0mbim0
           |                   ports: wwan0 (net), wwan0at0 (at), wwan0mbim0 (mbim), 
           |                          wwan0qcdm0 (qcdm)
  -----------------------------------
  Status   |                   state: failed
           |           failed reason: sim-missing
           |             power state: low
  -----------------------------------
  Modes    |               supported: allowed: 3g; preferred: none
           |                          allowed: 4g; preferred: none
           |                          allowed: 3g, 4g; preferred: 4g
           |                          allowed: 3g, 4g; preferred: 3g
           |                 current: allowed: 3g, 4g; preferred: 4g
  -----------------------------------
  Bands    |               supported: utran-1, utran-3, utran-4, utran-6, utran-5, utran-8, 
           |                          utran-2, eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-7, 
           |                          eutran-8, eutran-12, eutran-13, eutran-14, eutran-17, eutran-18, 
           |                          eutran-19, eutran-20, eutran-25, eutran-26, eutran-28, eutran-29, 
           |                          eutran-30, eutran-32, eutran-38, eutran-39, eutran-40, eutran-41, 
           |                          eutran-42, eutran-43, eutran-46, eutran-48, eutran-66, utran-19
           |                 current: utran-1, utran-3, utran-4, utran-6, utran-5, utran-8, 
           |                          utran-2, eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-7, 
           |                          eutran-8, eutran-12, eutran-13, eutran-14, eutran-18, eutran-19, 
           |                          eutran-20, eutran-25, eutran-26, eutran-28, eutran-29, eutran-30, 
           |                          eutran-32, eutran-38, eutran-39, eutran-40, eutran-41, eutran-42, 
           |                          eutran-43, eutran-46, eutran-48, eutran-66, utran-19
  -----------------------------------
  IP       |               supported: ipv4, ipv6, ipv4v6
  -----------------------------------
  SIM      |          sim slot paths: slot 1: none (active)
           |                          slot 2: /org/freedesktop/ModemManager1/SIM/0

# In this case there is no SIM in the physical SIM card slot:
$ sudo mmcli -m 0 --sim=1 error: couldn't find SIM

 

View SIM details:

mmcli -i /org/freedesktop/ModemManager1/SIM/0 --output-keyvalue

 

View the modem connection profile:

qmicli -d /dev/cdc-wdm0 -p --wds-get-profile-list=3gpp

 

Other ideas?

sudo mbimcli -d /dev/wwan0mbim0 --query-device-caps
sudo mbimcli -d /dev/wwan0mbim0 --query-device-caps --verbose
sudo mbimcli -d /dev/wwan0mbim0 -p -v --quectel-query-fcc-unlock
ModemManager --debug

 


Previous page: Linux Network Tuning
Next page: netplan