Automatically connect plugged in modems

Hugo Osvaldo Barrera hugo at barrera.io
Sun Apr 17 20:47:20 UTC 2022


Hi all,

After having set up modemmanager properly, I still need to run `mmcli simple-connect...` each time I plug in the modem. Plus, the ID sometimes changes when re-plugging it, so I have to query the ID (sometimes the modem takes a while to show up too), and THEN manually connect it.

Not a huge deal TBH, but still low-key annoying; it gets repetitive rather quickly.

So I wrote a very little helper that listens on the D-Bus interface for new modems, and automatically connects them to the network (sim-pin and profile-id are read from a config file). Maybe this can be of use to others?:

https://git.sr.ht/~whynothugo/mmctl

Configuration of the network itself (e.g.: DHCP) is handled by the network manager service (systemd-networkd in my case) once wlan0 is up.

Aside from sharing this very tiny tool, I wanted to also kind of suggest incorporating this functionality into modem-manager itself; adding support for configuration files where one can define sim-pin, profile-id, etc, and have modem-manager automatically connect when it's detected.

What do you think of this?

Thanks,

-- 
Hugo Osvaldo Barrera


More information about the ModemManager-devel mailing list