How can I make ModemManager work right?

Aleksander Morgado aleksander at aleksander.es
Wed Apr 29 15:33:45 UTC 2020


Hey,

See comments below.

>
> I am newbie in the ModemManager world.
> I am developing a router which has 5G Modem as one of WAN I/F.
>
> The WAN I/F works now with a modem vender's CM software.
> But we want our product to be independent from specific modem H/W.
> So I guessed utilizing ModemManager would be beneficial than utilizing modem vender specific CM software.
> So I am now trying to use ModemManager.
> I've just firstly tried applying ModemManager instead of vender specific CM. And of course, this first trial failed.
>
> I will let you know my testing environment. Could you please give some advice to me about what to do next?
>
> ==== Testing environment ====
>
> Target Model        : MediaTek MT7622 AC4300rfb1 board
> Firmware Version : LEDE Reboot 17.01-SNAPSHOT unknown / LuCI
> Kernel Version      : 4.4.124
> Modem                 : HUCOM HM-900
> ModemManager
> Version                 : 1.12.8
> menuconfig          : (QMI on, MBIM off)

Did you enable libqmi? and CONFIG_MODEMMANAGER_WITH_QMI?

> git clone URL        : https://github.com/openwrt/packages/tree/master/net/modemmanager
>

If you're running openwrt, you should better use the official openwrt
packaging, which doesn't use that github URL, it uses the official
release tarball instead.

> Noted Device Files : Those files and paths are noted/watched
> qmichannel                                            : /dev/cdc-wdm0
> usbnet_adapter                                      : /sys/class/net/wwan0
> /sys/bus/usb/devices/2-1/manufacturer : QCOM
> /sys/bus/usb/devices/2-1/idVendor        :05C6
> /sys/bus/usb/devices/2-1/idProduct       :90db
> /sys/bus/usb/devices/2-1/speed             :5000
> /sys/bus/usb/devices/2-1/product          :SDXPRAIRIE-MTP _SN:B02CE51B
> /sys/bus/usb/devices/2-1/version           :3.20
> /sys/bus/usb/devices/2-1:1.2/net/wwan0
> /sys/bus/usb/devices/2-1:1.2/net/wwan0/device/driver
> /sys/bus/usb/devices/2-1:1.2/net/wwan0/device
> /sys/bus/usb/devices/2-1:1.2/usbmisc/cdc-wdm0
> /sys/devices/platform/1a0c0000.usb/usb2/2-1/2-1:1.2

Ok, so this is a QMI modem and correctly detected by the kernel it seems?
Once the modem is exposed in the system, is it also detected by
ModemManager itself?
Could you setup /etc/init.d/modemmanager to launch the daemon with --debug?
Does the modem info show when you run "mmcli -m 0" ?

>
> Kernel modules watched via lsmod
> cdc_wdm                 8821  1 qmi_wwan
> qmi_wwan                6252  0
> usbcore               153512 20 option,usb_wwan,qmi_wwan,cdc_ncm,cdc_ether,usbserial,usbnet,usblp,cdc_wdm,cdc_acm,usb_storage,xhci_mtk,xhci_plat_hcd,xhci_pci,xhci_hcd,uhci_hcd,ohci_platform,ohci_hcd,ehci_platform,ehci_hcd
> usbnet                 19027  3 qmi_wwan,cdc_ncm,cdc_ether
>
> Above is original environment.
> On this circumstances, I disabled CM provided from modem provider : hucom-cm
> And I added one configuration section into the bottom of /etc/config/network :
> config interface 'broadband'
>         option device '/sys/devices/platform/1a0c0000.usb/usb2/2-1/2-1:1.2'

I believe the correct device path is
'/sys/devices/platform/1a0c0000.usb/usb2/2-1'.


>         option proto 'modemmanager'
>         option apn '5g-internet.sktelecom.com'
>         option username ''
>         option password ''
>         option pincode ''
>         option lowpower '1'
>
> Under these settings, I confirmed that
> - hucom-cm is disabled
> - ModemManager is alive
>  4430 root      229m D    /usr/sbin/ModemManager
>
> The wwan0 is not shown from ifconfig and ping 8.8.8.8 fails saying Network is unreachable.
> So, My first trying to utilize MM seemed to be failed.
>
> Originally hucom-cm sets bridge mode like shown below:
> BRIDGE_MODE_FILE : /sys/module/qmi_wwan/parameters/bridge_mode
> BRIDGE_IPV4_FILE    : /sys/module/qmi_wwan/parameters/bridge_ipv4

Do you know why that connection manager sets that up?

> But under ModemManager these files are not shown.
>
> And I've found many plugin libraries under /usr/lib/ModemManager:
> libmm-plugin-altair-lte.so     libmm-plugin-mtk.so            libmm-plugin-thuraya.so
>

Yes, there are lots of vendor-specific plugins. But if your device is
QMI based, you're probably fine with the generic plugin for now.

> Could someone help me?
>
> Do I need to look deeper into ModemManager?

See the comments above. You should at least run MM with --debug to see
all the inner messages sent/received to/from the modem.

> Do I need to implement new plugin library for our product?

Maybe. It depends on whether the generic QMI implementation is enough or not.

> Or do I need to forget about ModemManager?
>

That is up to you :D

> My already given hucom-cm anyway works. It brings data via wwan0 and establish network interface wwan0.
> Problem is that hucom-cm sets up firewall rules and routing settings redundantly and unnecessarily. So I can make it not to do these unneeded settings. This way would be good approach I believe.

ModemManager doesn't do any of those things, it just integrates with
the standard netifd in openwrt and netifd is the one doing the real
management of the connection.

> But we'd like to make our product indepecntant from specific modem. I guessed that opensource ModemManager infrastructure would give us some sort of independence from specific modem and in other words it would give some abstraction..

Yes, that is the main purpose of ModemManager. One API to rule them all!

>
> I am not sure of anything. Could someone give me some light so that I can find the best way to go?
>

Hope my answers above will help you.

> Additional question : If I write our own logic as a plugin library of ModemManager, wouldn't it necessarily have to stick to GPL? Can we apply commercial license for the plugin?
>

You cannot use a commercial license for the plugin; the plugin would
need to be GPL, as the ModemManager daemon sources.

Cheers!

-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list