Change modem mode by UDEV

Hi
Seem to be a bit difficult to find
I've got a sierra wireless EM7455 module plugged in a rpi4 with a snapshot build, currently exposing only mbim and wwan port (usbcomp mode 11)

I want to expose also an AT port to be able to send commands (usbcomp mode 8)

Does anybody know on how to do that with udev ?

Do you have udev installed then? OpenWrt doesn't use udev :thinking:

1 Like

Thank you for reply.
I try to explain better

I found "on google" that there is a command "echo 1 > /sys/bus/usb/devices/1-4.6/bConfigurationValue"

Where "1-4.6" is the address of your usb device and bconfigurationvalue is in this case the usb mode of the device.

So if I go with "ls /sys/bus/usb/devices". I get a list of addresses
By probing each of them with "cat /sys/bus/usb/devices/"address"/bConfigurationValue" I always get 1 as answer.

So

Do you know how to switch "usbcomp" with this method to enable profile 8 which exposes an AT port ?

Or is there a better way to switch it ?

I know also I could use the usbcomp.pl script but I haven't figured out how to run perl scripts on openwrt snapshot

OpenWrt has a package called "usb-modeswitching" (https://openwrt.org/docs/guide-user/network/wan/wwan/usb-modeswitching).
Maybe this is already doing what you need.

1 Like

install qmi-utils, then
qmicli --device-open-mbim -p -d /dev/cdc-wdm0 --dms-swi-get-usb-composition

Assuming 8 is the composition you need (DM, NMEA, AT, MBIM) try to select it:
qmicli --device-open-mbim -p -d /dev/cdc-wdm0 --dms-swi-set-usb-composition=8

source

2 Likes

This method is not applicable to the EM7455 and newer modems. It was supported on MC77xx and EM/MC73xx if already configured for dual configurations using (UD)USBCOMP.

1 Like

Yes. And I will add that this setting is persistent on the modem, so there is no need for udev or similar scripting. It's a fixup-once thing.

3 Likes

Amazing!

Thank you AndrewZ and bmork
You solved the issue

On another box I'm getting the following error

[13 Jan 2021, 17:44:04] -Warning ** [/dev/cdc-wdm0] requested MBIM mode but no MBIM QMUX support available
error: couldn't open the QmiDevice: Could not create endpoint

root@OpenWrt:~# qmicli --device-open-mbim -p -d /dev/cdc-wdm0 --dms-swi-set-usb-composition=8
[13 Jan 2021, 17:45:07] -Warning ** [/dev/cdc-wdm0] requested MBIM mode but no MBIM QMUX support available
error: couldn't open the QmiDevice: Could not create endpoint

Could it be because ModemManager is using it ?

If yes: is there a way i could set it on reboot ?

Which modem is this? Doesn't look like a Qualcomm chip. Could you run
mbimcli -p -d /dev/cdc-wdm0 --query-device-services
and verify that it includes

                          Service: 'qmi'
                             UUID: [d1a30bc2-f97a-6e43-bf65-c7e24fb0f0d3]:
                      DSS payload: 0
                Max DSS instances: 0
                             CIDs: msg (1)
1 Like

It is still the Sierra Wireless EM7455 in Mbim mode
Here it is

root@OpenWrt:~# mbimcli -p -d /dev/cdc-wdm0 --query-device-services
[/dev/cdc-wdm0] Device services retrieved:
	Max DSS sessions: '0'
	        Services: (16)

		          Service: 'basic-connect'
		             UUID: [a289cc33-bcbb-8b4f-b6b0-133ec2aae6df]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: device-caps (1),
		                   subscriber-ready-status (2),
		                   radio-state (3),
		                   pin (4),
		                   pin-list (5),
		                   home-provider (6),
		                   preferred-providers (7),
		                   visible-providers (8),
		                   register-state (9),
		                   packet-service (10),
		                   signal-state (11),
		                   connect (12),
		                   provisioned-contexts (13),
		                   ip-configuration (15),
		                   device-services (16),
		                   device-service-subscribe-list (19),
		                   packet-statistics (20),
		                   network-idle-hint (21),
		                   emergency-mode (22),
		                   ip-packet-filters (23)

		          Service: 'sms'
		             UUID: [533fbeeb-14fe-4467-9f90-33a223e56c3f]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: configuration (1),
		                   read (2),
		                   send (3),
		                   delete (4),
		                   message-store-status (5)

		          Service: 'ussd'
		             UUID: [e550a0c8-5e82-479e-82f7-10abf4c3351f]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: ussd (1)

		          Service: 'phonebook'
		             UUID: [4bf38476-1e6a-41db-b1d8-bed289c25bdb]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: configuration (1),
		                   read (2),
		                   delete (3),
		                   write (4)

		          Service: 'stk'
		             UUID: [d8f20131-fcb5-4e17-8602-d6ed3816164c]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: pac (1),
		                   terminal-response (2),
		                   envelope (3)

		          Service: 'auth'
		             UUID: [1d2b5ff7-0aa1-48b2-aa52-50f15767174e]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: aka (1),
		                   sim (3)

		          Service: 'qmi'
		             UUID: [d1a30bc2-f97a-6e43-bf65-c7e24fb0f0d3]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: msg (1)

		          Service: 'unknown'
		             UUID: [8b569648-628d-4653-9b9f-1025404424e1]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: 1, 2, 3

		          Service: 'ms-host-shutdown'
		             UUID: [883b7c26-985f-43fa-9804-27d7fb80959c]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: notify (1)

		          Service: 'unknown'
		             UUID: [2d0c12c9-0e6a-495a-915c-8d174fe5d63c]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: 1, 2

		          Service: 'ms-firmware-id'
		             UUID: [e9f7dea2-feaf-4009-93ce-90a3694103b6]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: get (1)

		          Service: 'atds'
		             UUID: [5967bdcc-7fd2-49a2-9f5c-b2e70e527db3]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: signal (1),
		                   location (2),
		                   operators (3),
		                   rat (4),
		                   register-state (9),
		                   unknown (10)

		          Service: 'unknown'
		             UUID: [6427015f-579d-48f5-8c54-f43ed1e76f83]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: 1, 2, 3

		          Service: 'unknown'
		             UUID: [c2f6588e-f037-4bc9-8665-f4d44bd09367]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: 1, 2, 3, 4, 5, 6

		          Service: 'ms-basic-connect-extensions'
		             UUID: [3d01dcc5-fef5-4d05-0d3a-bef7058e9aaf]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: device-slot-mappings (7),
		                   slot-info-status (8)

		          Service: 'unknown'
		             UUID: [68223d04-9f6c-4e0f-822d-28441fb72340]:
		      DSS payload: 0
		Max DSS instances: 0
		             CIDs: 1, 2

Strange. I don't know what's going on here. But you shouldn't need to change this on another box if you've already fixed the issue?

No worries

its just I have a few boxes with the same config, where I need to update the firmware and to do that I tought about accessing the AT command port to trigger a connection to AirVantage and update from there.

Yesterday I've tried the method on the first two and it worked like a charm

Then today I got stuck on of them giving this error. Which is quite strange since they are all the same (except that a couple of them have a differen version of wrt snapshot)

Got News on this

So I went to pick the troubly box.
Got the module out, Plugged it into a debian system and surprisingly: it is already using usbcomp=8 and i can access the AT port.

So i plugged it back into the box and it is showing again just the mbim and cdc-wdm0 port
No AT port

So I updated to latest snapshot, same issue
So I plugged it in in a Rpi3B+ with the latest stable wrt and same issue.

Plugged back in debian and the AT port shows up along other interfaces

What could it be ?

put your modem back to your trouble box and run cat /sys/kernel/debug/usb/devices, show the output

Hi Andrew,

Sadly, I am experiencing the same issue here :frowning:.

I am using a Telit LE910C4-NF, and for some reason started off having issues with QMI. So I went to try using 3g, and that worked fine, but knew I could do more. So I switched over to MBIM, and changed my usb composition mode using the command AT#USBCFG=2 (default is 0).

And right after that, was when I realized my USB serial interfaces were gone, and I could only use MBIM. I tried the command

And sadly I got the same error as Zipporobotics

Here is my output of cat /sys/kernel/debug/usb/devices

root@OpenWrt:~# cat /sys/kernel/debug/usb/devices

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 5.04
S:  Manufacturer=Linux 5.4.143 xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:01:00.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 4
D:  Ver= 2.10 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=2109 ProdID=3431 Rev= 4.21
S:  Product=USB2.0 Hub
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=256ms

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=04d9 ProdID=a002 Rev= 1.00
S:  Manufacturer=E-Signal
S:  Product=USB Gaming Keyboard
C:* #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=01 Driver=usbhid
E:  Ad=81(I) Atr=03(Int.) MxPS=  32 Ivl=1ms
I:* If#= 1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid
E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=4ms
E:  Ad=04(O) Atr=03(Int.) MxPS=  64 Ivl=4ms

T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#=  4 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1bc7 ProdID=1204 Rev= 3.18
S:  Manufacturer=Android
S:  Product=LE910C4-NF
S:  SerialNumber=0123456789ABCDEF
C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA
A:  FirstIf#= 2 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
I:  If#= 3 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
I:* If#= 3 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=88(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=8a(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 7 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=8c(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=5000 MxCh= 4
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 3.00 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
P:  Vendor=1d6b ProdID=0003 Rev= 5.04
S:  Manufacturer=Linux 5.4.143 xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:01:00.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

Not sure where to go from here, but I also emailed Telit support to see if they could help.

Thanks in advance!

Orest

... but this thread is about different modem, so the commands I mentioned are not applicable to your case

Thanks for the reply AndrewZ. I do understand that. I figured since we're referring to mbim and qmi commands that would be agnostic to the modem brands, since they're just open protocols (except for qmi).

Otherwise, I do know the AT commands change between different modem vendors.

Just add your device to the driver and do whatever you want to do, like switching it back to another mode.
echo "1bc7 1204 ff" > /sys/bus/usb-serial/drivers/option1/new_id

Yes, that's the correct workaround.

FYI: This device ID was added to the option driver recently https://lore.kernel.org/all/20211004105655.8515-1-dnlplm@gmail.com/

So I guess Telit support already did their job :wink:

Which means that the workaround will be unnecessary in the near future. Expect a few weeks for that patch to trickle down through Linux stable and finally end up in OpenWrt.

1 Like