Debian usb_modeswitch Patch - WWAN Huawei ME906s LTE M.2 Modem
The Huawei ME906s LTE M.2 WWAN modem is not recognised on Debian or Ubuntu. A udev rule patch for usb_modeswitch and the mode switch command fix it.

The Huawei ME906s LTE M.2 module is often not recognised on Debian or Ubuntu. usb_modeswitch can switch it over, but the stock udev rule does not trigger it correctly for this device. This note has the patch for that rule and the commands to switch the modem.
1. Identify the modem
lsusb
The modem shows up with the ID 12d1:15c1:
Bus 001 Device 007: ID 12d1:15c1 Huawei Technologies Co., Ltd. ME906s LTE M.2 Module
2. Patch the udev rule
The patch changes the order of two conditions in 40-usb_modeswitch.rules. Before, the rule could also be triggered by the change event, which led to a second switch attempt. The patch makes sure the rule only runs on add.
Download the patch: 40-usb_modeswitch_rules-patch.patch
The change in the rule file:
-SUBSYSTEM!="usb", ACTION!="add",, GOTO="modeswitch_rules_end"
+SUBSYSTEM!="usb", GOTO="modeswitch_rules_end"
+ACTION!="add", GOTO="modeswitch_rules_end"
The full patch as it was published (commit subject: “Avoid udev rule being triggered again in change event”):
From e10f6635d32378cdafce1409b9de13668b5ebff3 Mon Sep 17 00:00:00 2001
From: Date Huang <tjjh89017@hotmail.com>
Date: Sun, 31 Jul 2022 21:29:42 +0800
Subject: [PATCH] Avoid udev rule being triggered again in change event
Signed-off-by: Date Huang <tjjh89017@hotmail.com>
---
40-usb_modeswitch.rules | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/40-usb_modeswitch.rules b/40-usb_modeswitch.rules
index dae3e3a..3156a3b 100644
--- a/40-usb_modeswitch.rules
+++ b/40-usb_modeswitch.rules
@@ -9,7 +9,8 @@ ACTION!="add|change", GOTO="modeswitch_rules_end"
# transfer; checked against a list of known modems, or else no action
KERNEL=="ttyUSB*", ATTRS{bNumConfigurations}=="*", PROGRAM="usb_modeswitch --symlink-name %p %s{idVendor} %s{idProduct} %E{PRODUCT}", SYMLINK+="%c"
-SUBSYSTEM!="usb", ACTION!="add",, GOTO="modeswitch_rules_end"
+SUBSYSTEM!="usb", GOTO="modeswitch_rules_end"
+ACTION!="add", GOTO="modeswitch_rules_end"
# Generic entry for most Huawei devices, excluding Android phones
ATTRS{idVendor}=="12d1", ATTRS{manufacturer}!="Android", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"
--
2.34.1
Apply it to the rule file. Replace the path with your own if the file lives elsewhere:
sudo patch -p1 /lib/udev/rules.d/40-usb_modeswitch.rules < 40-usb_modeswitch_rules-patch.patch
3. Switch the modem to mode 2
Mode 3 may not work with this modem, so mode 2 is the one to use:
sudo usb_modeswitch -v 0x12d1 -p 0x15c1 -u2
4. Check that the modem is found
mmcli --list-modems
Helpful links
- USB_ModeSwitch on the ubuntuusers wiki
- Patch file for the udev rule (draisberghof.de forum)
- Trigger usb_modeswitch on boot (unix.stackexchange)
- Mobile broadband modem (Arch Wiki)
- PPP and mobile broadband modem (Arch Wiki)
- rfkill (ubuntuusers wiki)
The original notes and patch are also published as a gist: gist.github.com/pasce/6b5999819bfdc2ec02be50108c00a553