[TECH] Lenovo X1C6 WWAN

Posted on Wed 09 January 2019 in Tech, Hardware, Setup

Roughly one year ago, I had to install a WWAN modem inside a Lenovo X1 5th generation. Due to the price Lenovo was selling the modem, we tried to install a generic, cheaper one. We struggled a lot (BIOS Whitelisting, AT port, ...) but we eventually managed to make it work (we would have probably fail without this amazing article).

I then bought the latest version of the X1 carbon, the 6th (at the time of this article), without WWAN (they did not offer the option at the time). As I already installed it once, I tought it would be the same on my brand new computer.... well, actually it was not the case at all !

I'll try to describe the steps I followed to make this work.

BIOS Whitelisting

During the last setup, we had a lot of trouble with Lenovo's BIOS that whitelists VID/PID for components that can be installed we enventually managed to changed those on the device. For this setup, I found a not too expensive Lenovo branded EM7455 that was going to save me a lot of time, or that was what I though... Indeed, Lenovo decided to move from the EM7455 to some Fibocom for the 6th generation of the laptop, after plugging the modem (that was supposed to have Lenovo's VID/PID) I rebooted and the infamous Error 1802 showed up.

It seems that as Lenovo did not yet sell any WWAN enabled laptop, the whitelist for WWAM modem was empty. I tried to find a workaround but failed and waited a few month before I could continue to configure my WWAN modem.

In the latest BIOS released (1.31) by Lenovo, they added the WWAN spport, however it seems to be only for the L850 modem.

We installed the EM7455 back in the laptop, rebooted and, to my surprise, no more 1802 ! We were one step closer to a working 4G modem \o/.

Note It might be possible, by changing the VID/PID as explained in the article linked above to make a non-Lenovo branded EM7455 work, I did not try though.

AT Commands

I used socat to connect to my WWAN modem and send some AT commands. I had no ideas what the AT protocol was, but it seems to be a "standard" protocol to configure and communicate with a modem. Due to its name (and probably its age), finding reliable information about this protocol is far from easy but you will be able to find a few information here and here.

When enabling the modem for the first time, a strange error message appeared:

mmcli -m 0 -e
Cannot power-up: hardware radio switch is OFF'

By issuing an at!PCINFO? to the modem, we can indeed see that the hardware switch seems to be on (hence the card disabled):

at!PCINFO?
LPM voters - Temp:0, Volt:0, User:0, W_DISABLE:1, IMSWITCH:0, BIOS:0

But our card does definitely not have any hardware switch... Fortunately, someone on Lenovo's forum found a workaround and made a really nice anwser: as this is a non-standard WWAN card, the firmware fails to detect its features and do not export it in RFKILL. Fortunately for us, we can change this from inside the WWAN card by running the at!pcoffen=2 command from our AT prompt (in case you were wondering, pcoffen is called the Power Off Enable feature).

State: Low Power Mode
LPM voters - Temp:0, Volt:0, User:0, W_DISABLE:0, IMSWITCH:0, BIOS:1
LPM persistence - None

As shown below, we are now one step closer to a working WWAN card, and should only have the software part to deal with from now !

mmcli -m 0 -e
successfully enabled the modem

mbimcli and mmcli

This part was rather simple and I will not go into details, the goal is to provide a (I hope) useful list of commands I used to get my card working. Your modem_id might not be the same, but you can get a list using mmcli -L.

You can query the hardware/software state of the card by issuing the following command:

mbimcli -p -d /dev/cdc-wdm0 --query-radio-state

In case you want to enable it, you must perform:

mbimcli -v -p -d /dev/cdc-wdm0 --set-radio-state=on

You'll probably need to unlock the modem by providing the sim pin to be able to connect to the APN, this can be mmcli -m 0 --simple-connect="pin=,apn=", in case you don't know what your APN is, you can try to leave it blank, or run a scan: mmcli -m 0 --3gpp-scan --timeout=60.

To check if this is working, you can use mmcli -m 0 and look at the state entry, or query the bearer itself (its ID can be found in the last line of the modem listing): mmcli -b 0 and look at the IPv4 (or 6?) configuration !

Custom script

Except from wpa_supplicant, I don't use any network manager on my laptop, I hence needed to retrieve the information given by mmcli and perform configure my network interfaces accordingly.

I made the following script to perform this task, it might be usefull to those that have the same setup as I do.

ex0ns