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)