Skip to content

Instantly share code, notes, and snippets.

@pshlos46
Last active November 4, 2023 09:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pshlos46/e68bd50e735848336047e84319396671 to your computer and use it in GitHub Desktop.
Save pshlos46/e68bd50e735848336047e84319396671 to your computer and use it in GitHub Desktop.
HP lt4132 4G modem linux support (EliteBook G5)

[How-To] HP lt4132 - 4G LTE modem - Linux support

This guide has been tested in Xubuntu 18.04.01 but it will probably apply in most linux distro's. Contents are heavily based on work by @toreanderson here.

So HP Elitebook G5 has as an LTE modem the HP lt4132 which is actually re-brand of Huawei ME906s-158.

If you see the output from usb-devices you'll see that the issue lies that the modem is in configuration 2 (Cfg#= 2). The Linux kernel selects configuration 2 by default, but that does not work with ModemManager. Configuration 3 ( MBIM mode) is a much better choice.

Changing to configuration 3 is easy enough. Note that it is essential to first deconfigure the device by selecting configuration 0 and wait a few milliseconds. Going directly from 2 to 3 does not work. Thus (as root):

$ echo 0 > /sys/bus/usb/devices/1-3/bConfigurationValue
$ sleep 1
$ echo 3 > /sys/bus/usb/devices/1-3/bConfigurationValue

The 1-3 part might not be correct for your system. But most probably it will be. If it’s not, grep lt4132 /sys/bus/usb/devices/*/product will probably tell you what the correct sysfs device path is.

The first time you do this, a pop up will appear asking for your SIM PIN.If you wan to disable PIN for this SIM, use:

$ mmcli -L  # to list modems
Found 1 modems:
	/org/freedesktop/ModemManager1/Modem/1 [Generic] MBIM [03F0:A31D]
  
$ mmcli -m 1 | grep SIM  # to get SIM number, again most probably 1
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/1'

# where 0000 your current PIN
$ mmcli -i 1 --pin=0000  --disable-pin 

At this point you can open NetworkManager to create the mobile data connection.

The part in the original guide referring to ndp_to_end patching is not necessary as it has been patched in the Linux kernel since 4.13

Supposedly the current version of usb_modeswitch (2.5.2) should automatically select USB configuration 3), however after my tests this was not the case.

In the interim, however, it is easy enough to automate the application of these tweaks by using udev rules. Simply create a file called, e.g., /etc/udev/rules.d/hp-lt4132.rules and add the following three lines to it:

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"

If you have another flavor of Huawei ME906s-158 change the vendor/product IDs 03f0/a31d .

After applying the udev rules everything works as expected after several restarts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment