Disable mmcli on hostOS

Hi!

I’m trying to STOP mmcli from trying to setup a connection with my cellular modem. I don’t have any cellular configuration file (on the root system-connections folder), but it seems that mmcli will still try to establish a connection with the modem, which causes a lot of issues when I try to control the module myself manually over AT commands (from a running container).

My use case is that I want to fully control the modem myself.

Any way I can disable this?

Thank you.

Hello Nelson,

Thanks for posting to the balena discussion forums!

Have you already tried to use the --inhibit-device command line flag? I found this in the documentation for mmcli over at the FreeDesktop.org site. To retrieve the device’s UID, you can use the --list-modems flag, and parse the result.

       -I, --inhibit-device=[UID]
              Inhibit the specific device from being used by ModemManager. The UID that should be given is the value of the Device property exposed by a given modem (i.e. equal to the  ID_MM_PHYSDEV_UID  if
              one set, or otherwise equal to the full device sysfs path).

              This command will not exit right away, as that would implicitly remove the inhibition. The user must make sure to stop the mmcli process hitting Ctrl+C in order to un-inhibit the device.

              When a device is inhibited via this method, ModemManager will disable the modem (therefore stopping any ongoing connection) and will no longer use it until it is uninhibited.

Let me know if this helps in getting mmcli to behave the way you’d like it to, so you can control the modem directly using AT commands from your application container.

Cheers,
Trevor Sullivan

hi @pcgeek86,

thanks for your feedback on this.

Unfortunately that option is not available on BalenaOS mmcli version (1.8.2). It was introduced only on mmcli v1.10.0 here.

And I don’t think any resin based docker image has a more recent version.

I have tried to disable it over systemctl, but for some reason that has a strange effect on the modem and I can’t establish a ppp connection afterwards.

thanks,
nelson

Hi Nelson,
The usual way would be to specify the device as unmanaged via NetworkManager .conf but I am not aware that it is possible to permanently modify that file in balena.
I will forward your request to the specialists …
Regards
Thomas

Hi Nelson,
apparently UDEV rules are the way to go.
You can add UDEV rules by modifying your config.json file as described here: https://github.com/balena-os/meta-balena#udevrules
The config.json can be found in /mnt/boot/config.json in the running system or on the first partition of your SD card. Be very careful as you can easily break your system by inserting invalid json or invalid content into this file. Try your modifications on a device that you can easily access the SD card of and keep a backup of your config.json.
The UDEV rule could be something like this: https://github.com/balena-os/balena-edison/blob/master/layers/meta-resin-edison/recipes-connectivity/modemmanager/files/77-mm-tty-device-blacklist.rules or like this : https://github.com/balena-os/meta-balena/blob/master/meta-resin-common/recipes-core/resin-extra-udev-rules/files/49-teensy.rules#L20
It boils down to finding the right attributes to identify the device and then disabling it.
Feel free to supply us with more information about the modem in question, your device type and OS version and we might be able to give you instructions targeting your modem.
Regards
Thomas

1 Like

Hi @samothx,

thank you for pointing to udev. Will definitely try that.

This is my usb output (regarding this modem):

[  106.711715] usb 1-1.4: new high-speed USB device number 4 using dwc_otg
[  111.851503] usb 1-1.4: device descriptor read/64, error -110
[  112.106303] usb 1-1.4: New USB device found, idVendor=1e2d, idProduct=005b
[  112.113456] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  112.121000] usb 1-1.4: Product: ELSx
[  112.124745] usb 1-1.4: Manufacturer: Cinterion Wireless Modules
[  112.280505] cdc_ether 1-1.4:1.10 usb0: register 'cdc_ether' at usb-3f980000.usb-1.4, CDC Ethernet Device, fa:96:11:12:13:14
[  112.305317] cdc_ether 1-1.4:1.12 usb1: register 'cdc_ether' at usb-3f980000.usb-1.4, CDC Ethernet Device, fa:96:11:12:13:16
[  112.317060] usbcore: registered new interface driver cdc_ether
[  112.339396] usbcore: registered new interface driver cdc_acm
[  112.442322] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[  112.450947] cdc_ether 1-1.4:1.10 usb0: kevent 11 may have been dropped
[  112.451301] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[  112.477134] IPv6: ADDRCONF(NETDEV_UP): usb1: link is not ready
[  112.486471] cdc_ether 1-1.4:1.12 usb1: kevent 12 may have been dropped
[  112.495428] cdc_ether 1-1.4:1.12 usb1: kevent 11 may have been dropped

and this is what I’m using on the config.json file:

"os": {
		"udevRules": {
			"64": "ATTRS{idVendor}==\"0ca6\" ATTRS{idProduct}==\"a050\", ENV{ID_MM_DEVICE_IGNORE}=\"1\""
		}
	},

I have to admit, udev rules are not my thing! What should the rule counter, 64, be based on?

thanks,
nelson

Hi Nelson,
it seems hard to find a pro in terms of udev rules. Unfortunately my experience is rather sparse too.
Looking at your rule and your dmesg output I am slightly confused:
Sounds like the following is the modem you would like to ignore:

[  106.711715] usb 1-1.4: new high-speed USB device number 4 using dwc_otg
[  111.851503] usb 1-1.4: device descriptor read/64, error -110
[  112.106303] usb 1-1.4: New USB device found, idVendor=1e2d, idProduct=005b
[  112.113456] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  112.121000] usb 1-1.4: Product: ELSx
[  112.124745] usb 1-1.4: Manufacturer: Cinterion Wireless Modules

So vendor ID is 1e2d and product id is 005b. How do you get to 0ca6 and a050 that you have in your rule ?

Regarding the ‘counter’ I think it just controls the sequence in which rules are applied. The smaller, the earlier, 00 would be first rule ever, 99 last. You might have to play with this value.

Cheers
Thomas

Hi @samothx,

sorry, that was my bad, usual copy-paste mistake!

I manage to get it working. The modem was enumerating 3 different USB Devices, with different Product IDs. After having them all on the UDEV ignore list, the modem is no longer recognised by mmcli and I manage to fully control it over AT commands (ppp connection, socket, etc…)

Thanks for helping out! You guys really do a great job, not just with your products, but also by having a great support!

cheers,
nelson

1 Like