X1 Carbon 9 WWAN on Linux

I just set up WWAN on my X1 carbon. It was a little tricky, and I hit some errors I haven’t found documented elsewhere on the net.

I didn’t attempt to activate the SIM on linux. It’s probably possible, but I wasn’t familiar with the tools required, and din’t want to be in the AT&T store any longer than I had to be. So, I booted into Windows before heading over.

Install Software

I started off following the arch wiki guide on the X1C9

https://wiki.archlinux.org/title/Lenovo_ThinkPad_X1_Carbon_(Gen_9)

Supplemented with

https://wiki.archlinux.org/title/Mobile_broadband_modem

First connection attempts

First start modemmanager

sudo systemctl start ModemManager

List available modems with

$ mmcli -M                                                                                                                                                                                                                                 ⏎
    /org/freedesktop/ModemManager1/Modem/1 [foxconn] MBIM [105B:E0AB]

Modem details

$ mmcli -m 1                                                                                                                                                                                                                               ⏎
  -----------------------------------
  General  |                    path: /org/freedesktop/ModemManager1/Modem/1
           |               device id: [redacted]
  -----------------------------------
  Hardware |            manufacturer: foxconn
           |                   model: MBIM [105B:E0AB]
           |       firmware revision: T99W175.F0.0.0.5.7.AT.008
           |                          077
           |          carrier config: ATT
           | carrier config revision: 0A000308
           |            h/w revision: Qualcomm Snapdragon X55 5G
  ...

Then attempt to enable the modem

mmcli -m 1 -e --verbose
[04 Sep 2021, 23:05:19] [Debug] ModemManager process found at ':1.99'
[04 Sep 2021, 23:05:19] [Debug] Assuming '1' is the modem index
[04 Sep 2021, 23:05:19] [Debug] Modem found at '/org/freedesktop/ModemManager1/Modem/1'

[04 Sep 2021, 23:05:19] [Debug] Synchronously enabling modem...
error: couldn't enable the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Retry: Invalid transition'

This was the main bit of trouble I ran into in this process. I eventually found tools to debug the connection:

First shut down ModemManager

sudo systemctl stop ModemManager
sudo systemctl disable ModemManager

Then run it manually with –debug

sudo ModemManager --debug

Then re-attempt to enable the modem in a new terminal

mmcli -m 1 -e --verbose

After running that mmcli command, I found in the output of ModemManager --debug

>>>>>> Fields:
>>>>>>   HwRadioState = 'off'
>>>>>>   SwRadioState = 'on'
ModemManager[9864]: <warn>  [1630811585.620885] [modem0] Cannot power-up: hardware radio switch is OFF
ModemManager[9864]: <debug> [1630811585.620902] [modem0] couldn't update power state: Invalid transition

Googling for “Cannot power-up: hardware radio switch is OFF” lead me to:

https://ex0ns.me/lenovo-x1c6-em7455.html

Which mentioned trying to send some AT commands to the modem. That didn’t end up being helpful, but if you would like to mess with AT commands, I was able to do so with socat to the /dev/wwan0p3AT device.

sudo socat - /dev/wwan0p3AT,crnl                                                                                                                                                                                                         ⏎
AT

OK

The blog post mentions an AT command that can be used to disable the hardware switch. That AT command didn’t work for me with this modem.

However, the article also mentions:

as this is a non-standard WWAN card, the firmware fails to detect its features and do not export it in RFKILL

It appears this modem is standard, and is exported to rfkill.

$ rfkill                                                                                                                                                                                                                                   ⏎
ID TYPE      DEVICE                   SOFT      HARD
 0 bluetooth tpacpi_bluetooth_sw   blocked unblocked
 1 wwan      tpacpi_wwan_sw        blocked unblocked
 3 wlan      phy0                unblocked unblocked

Solution

Enable wwan with rfkill:

rfkill unblock wwan

Then try enabling again:

$ mmcli -m 0 -e --verbose
[04 Sep 2021, 23:23:39] [Debug] ModemManager process found at ':1.145'
[04 Sep 2021, 23:23:39] [Debug] Assuming '0' is the modem index
[04 Sep 2021, 23:23:39] [Debug] Modem found at '/org/freedesktop/ModemManager1/Modem/0'

[04 Sep 2021, 23:23:39] [Debug] Synchronously enabling modem...
successfully enabled the modem

Then try connecting:

$ mmcli -m 0 --simple-connect="apn=broadband"
successfully connected the modem

At this point, you can set up a new mobile broadband connection in NetworkManager.