[PATCH 1/5] core: allow identifying devices by a user-provided 'uid'

Aleksander Morgado aleksander at aleksander.es
Thu Sep 29 13:42:46 UTC 2016


On 29/09/16 15:38, Aleksander Morgado wrote:
> E.g. a custom device has 4 modems in 4 different USB ports. The device path of
> each USB device will always be the same, so the naming rules could go like this:
> 
>     $ vim /usr/lib/udev/rules.d/78-mm-naming.rules
> 
>     ACTION!="add|change|move", GOTO="mm_naming_rules_end"
>     ENV{DEVTYPE}=="usb_device", ENV{DEVPATH}=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.1", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-1"
>     ENV{DEVTYPE}=="usb_device", ENV{DEVPATH}=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.2", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-2"
>     ENV{DEVTYPE}=="usb_device", ENV{DEVPATH}=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.3", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-3"
>     ENV{DEVTYPE}=="usb_device", ENV{DEVPATH}=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.4", ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-4"
>     LABEL="mm_naming_rules_end"

Oops; please use these as reference (i.e. without ENV{DEVPATH}; just
DEVPATH):

    ACTION!="add|change|move", GOTO="mm_naming_rules_end"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.1",
ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-1"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.2",
ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-2"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.3",
ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-3"
    DEVPATH=="/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.5/4-1.5.4",
ENV{ID_MM_PHYSDEV_UID}="USB-MODEM-4"
    LABEL="mm_naming_rules_end"


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list