How to use Mobile Modem on Linux?

If you installed Linux on your PC which has Mobile Modem that supported LTE then you should configure it to run. I added basic steps to check your mobile device and configure it.

The HP lt4132 LTE/HSPA+ 4G Module comes with 3 different configurations;

  • USB configuration 1: QMI and TTY
  • USB configuration 2: ECM
  • USB configuration 3: MBIM

By default Linux kernel will use ECM(Ethernet Control Model)) configuration. This mode doesn’t work properly with NetworkManager.

Configuration 3 MBIM mode is more suitable to run drivers with NetworkManager. Changing configuration to MBIM mode is easy on Linux but first, you need to reconfigure the device.

What:           /sys/bus/usb/devices/.../bConfigurationValue
kernel version:  since at least 2.6.18

Writing 0 or -1 to bConfigurationValue will reset the active configuration (unconfigure the device). Writing another value will change the active configuration. Note that some devices, in violation of the USB spec, have a
configuration with a value equal to 0. Writing 0 to bConfigurationValue for these devices will install that configuration, rather then unconfigure the device.

Step 1: Find your mobile modem device path

T:  Bus=01 Lev=01 Prnt=01 Port=04 Cnt=02 Dev#=  3 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=ff MxPS=64 #Cfgs=  3
P:  Vendor=03f0 ProdID=a31d Rev=01.02
S:  Manufacturer=HP Inc.
S:  Product=HP lt4132 LTE/HSPA+ 4G Module
S:  SerialNumber=0123456789ABCDEF
C:  #Ifs= 3 Cfg#= 3 Atr=a0 MxPwr=2mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=06 Prot=14 Driver=(none)

You should get your device path. The example shows that device configured under “1–5” for my case.

#grep lt4132 /sys/bus/usb/devices/*/product
/sys/bus/usb/devices/1-5/product:HP lt4132 LTE/HSPA+ 4G Module

Step 2: Deconfigure and enable MBIM mode

First, we send “0” to the deconfigure device. And then wait 1 second then send “3” to enable MBIM mode.

# echo 0 > /sys/bus/usb/devices/1-5/bConfigurationValue
# sleep 1
# echo 3 > /sys/bus/usb/devices/1-5/bConfigurationValue
# mmcli  -L

Found 1 modems:

/org/freedesktop/ModemManager1/Modem/7 [Generic] MBIM [03F0:A31D]

# mmcli -m 7-e

Step 3: Define udev rules and restart server

#cat /etc/udev/rules.d/hp_lt4132.rules
ACTION=="add|change", SUBSYSTEM=="usb", ATTR{idVendor}=="03f0", ATTR{idProduct}=="a31d", ATTR{bConfigurationValue}!="3", ATTR{bConfigurationValue}:="0"
ACTION=="add|change", SUBSYSTEM=="usb", ATTR{idVendor}=="03f0", ATTR{idProduct}=="a31d", ATTR{bConfigurationValue}!="3", RUN+="/bin/sh -c 'sleep 1; echo 3 > %S%p/bConfigurationValue'"
ACTION=="add|change", SUBSYSTEM=="net", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="a31d", ATTR{cdc_ncm/ndp_to_end}=="N", ATTR{cdc_ncm/ndp_to_end}:="Y"
Tagged In:

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

205 Total Posts
Follow Me