modemudevlte

How to use symlinked cdc-wdm device with ModemManager?


We have created udev rules to make the device naming consistent for the cdc-wdm devices, no matter in what order our lte usb devices are registered at the usb bus. We had the issue that we could not rename the cdc-wdm devices, which I understand is some limitiation of the usbmisc driver. So we ended up creating symlinks

    ACTION!="add|change", GOTO="mm_naming_rules_end"
    # only rename the interfaces if the names are wrong
    SUBSYSTEM=="usbmisc", ACTION=="add", KERNELS=="1-1.1.2", KERNEL=="cdc-wdm*", SYMLINK+="cdc-lte0"
    SUBSYSTEM=="usbmisc", ACTION=="add", KERNELS=="1-1.1.4", KERNEL=="cdc-wdm*", SYMLINK+="cdc-lte1"
    LABEL="mm_naming_rules_end"

But ModemManager does not recoqnize those devices when we use that in our nmconnection file

    [connection]
    id=wwan0
    uuid=280d17ff-f4d4-4f47-a6e6-75ba32bc57c2
    type=gsm
    interface-name=cdc-lte0
    permissions=
    
    [gsm]
    #apn=internet
    
    [ipv4]
    dns-search=
    method=auto
    
    [ipv6]
    addr-gen-mode=stable-privacy
    dns-search=
    method=auto
    
    [proxy]

Solution

  • I finally solved it, symlink does not work but wwan interfaces can be used.

    To make index of ModemManager always be the same use ID_MM_PHYSDEV_UID in a udev rules

    ACTION!="add|change|move|bind", GOTO="mm_naming_first_rules_end"
    
    DEVPATH=="/devices/platform/bus@5b000000/5b110000.usb/5b130000.usb/xhci-hcd.1.auto/usb1/1-1/1-1.1/1-1.1.2",ENV{ID_MM_PHYSDEV_UID}="USB1"
    DEVPATH=="/devices/platform/bus@5b000000/5b110000.usb/5b130000.usb/xhci-hcd.1.auto/usb1/1-1/1-1.1/1-1.1.4",ENV{ID_MM_PHYSDEV_UID}="USB2"
    
    LABEL="mm_naming_first_rules_end"
    

    Rename from wwan0 and wwan1 to lte0 and lte1, devices get added via usb very late so NetworkManager would immdetiatly use the wwan0 device before renaming it, so we use lteX

    ACTION!="add|change", GOTO="mm_naming_rules_end"
    
    # only rename the interfaces if the names are wrong
    SUBSYSTEM=="usbmisc", ACTION=="add", KERNELS=="1-1.1.2", KERNEL=="cdc-wdm*", SYMLINK+="cdc-lte0"
    SUBSYSTEM=="usbmisc", ACTION=="add", KERNELS=="1-1.1.4", KERNEL=="cdc-wdm*", SYMLINK+="cdc-lte1"
    SUBSYSTEM=="net", ACTION=="add", KERNELS=="1-1.1.2", KERNEL=="wwan0", NAME="lte0", ENV{ID_MM_CANDIDATE}="1"
    SUBSYSTEM=="net", ACTION=="add", KERNELS=="1-1.1.2", KERNEL=="wwan1", NAME="lte0", ENV{ID_MM_CANDIDATE}="1"
    SUBSYSTEM=="net", ACTION=="add", KERNELS=="1-1.1.4", KERNEL=="wwan0", NAME="lte1", ENV{ID_MM_CANDIDATE}="1"
    SUBSYSTEM=="net", ACTION=="add", KERNELS=="1-1.1.4", KERNEL=="wwan1", NAME="lte1", ENV{ID_MM_CANDIDATE}="1"
    LABEL="mm_naming_rules_end"
    

    Two seperate nmconnection files using lte0 and lte1

    [connection]
    id=modem1
    uuid=280d17ff-f4d4-4f47-a6e6-75ba32bc57c2
    type=gsm
    interface-name=lte0
    permissions=
    autoconnect-priority=2
    autoconnect-retries=0
    
    [gsm]