I'm setting up OpenWRT x86_64 VM with a Telit LN940A connected via M.2 to USB3 adapter. I used to have the same setup working with Ubuntu Desktop instead of OpenWRT.
One of things that needed to be done is to configure usb-modeswitch. On Ubuntu I had the udev rule added as such which switches the device to config 1:
# Telit LN940
ATTR{idVendor}=="1bc7", ATTR{idProduct}=="1900", RUN+="/usr/sbin/usb_modeswitch -v 1bc7 -p 1900 -u 1"
This results with the following output in /sys/kernel/debug/usb/devices
when connected to Ubuntu Desktop:
output
T: Bus=04 Lev=02 Prnt=07 Port=03 Cnt=02 Dev#= 15 Spd=5000 MxCh= 0
D: Ver= 3.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs= 3
P: Vendor=1bc7 ProdID=1900 Rev= 3.10
S: Manufacturer=Telit
S: Product=Telit LN940 Mobile Broadband
S: SerialNumber=0123456789ABCDEF
C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=504mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E: Ad=83(I) Atr=03(Int.) MxPS= 8 Ivl=32ms
E: Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E: Ad=89(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=88(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
C: #Ifs= 2 Cfg#= 2 Atr=a0 MxPwr=504mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=
E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms
I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=
I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
C: #Ifs= 3 Cfg#= 3 Atr=a0 MxPwr=504mA
A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=
E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms
I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=
I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I: If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=32ms
In OpenWRT, I was able to figure out the change needed in /etc/usb-mode.json
and basically added the below in the file and then performed /etc/init.d/usbmode restart
:
,
"1bc7:1900": {
"*": {
"config": 1
}
}
However it does not seem to perform the switch and the device sticks to config 2 instead:
output
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=5000 MxCh= 0
D: Ver= 3.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs= 3
P: Vendor=1bc7 ProdID=1900 Rev= 3.10
S: Manufacturer=Telit
S: Product=Telit LN940 Mobile Broadband
S: SerialNumber=0123456789ABCDEF
C: #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=504mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=83(I) Atr=03(Int.) MxPS= 8 Ivl=32ms
E: Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=
E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=
E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=
E: Ad=89(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
E: Ad=88(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
C:* #Ifs= 2 Cfg#= 2 Atr=a0 MxPwr=504mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=(none)
E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms
I:* If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=(none)
I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=(none)
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
C: #Ifs= 3 Cfg#= 3 Atr=a0 MxPwr=504mA
A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
I: If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=
E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=32ms
I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=
I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=
E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I: If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=32ms
I even tried running the usbmode
manually and still the device did not switch:
root@OpenWrt:/sys/bus/usb/devices# usbmode -l -v -c /etc/usb-mode.json
Found device: 1bc7:1900 (Manufacturer: "Telit", Product: "Telit LN940 Mobile Broadband", Serial: "0123456789ABCDEF")
root@OpenWrt:/sys/bus/usb/devices#
root@OpenWrt:/sys/bus/usb/devices# usbmode -l -v -c /etc/usb-mode.json -s
root@OpenWrt:/sys/bus/usb/devices#
From logread
I see the following lines whenever I unplug and plug back the usb device which shows that usb-modeswitch is running automatically:
Sat Oct 2 11:44:37 2021 kern.info kernel: [ 1718.782797] usb 2-1: new SuperSpeed Gen 1 USB device number 8 using xhci_hcd
Sat Oct 2 11:44:37 2021 kern.info kernel: [ 1718.827846] option 2-1:2.0: GSM modem (1-port) converter detected
Sat Oct 2 11:44:37 2021 kern.info kernel: [ 1718.837642] option 2-1:2.0: device disconnected
Sat Oct 2 11:44:37 2021 kern.warn kernel: [ 1718.838131] usb 2-1: usbfs: process 15010 (usbmode) did not claim interface 1 before use
Sat Oct 2 11:44:38 2021 kern.warn kernel: [ 1719.039868] usb 2-1: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #1
I even tried adding "msg": [ ]
in usb-mode.json
as I saw that for other devices in the file but the end result is the device still not switching.
Is there anything I'm missing?