cdma 调制解调器的 udev 规则不起作用

cdma 调制解调器的 udev 规则不起作用

我为 CDMA 调制解调器编写的 udev 规则是

SUBSYSTEM=="tty", ATTRS{bInterfaceNumber}=="00", ATTRS{bNumEndpoints}=="03", ATTRS{product}=="ZTE CDMA Tech", ACTION=="add", SYMLINK+="CDMAModem"

$ sudo udevadm info -a -p $(sudo udevadm info -q path -n /dev/ttyUSB0)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/ocp.2/47400000.usb/musb-hdrc.1.auto/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/ttyUSB0/tty/ttyUSB0':
    KERNEL=="ttyUSB0"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/ocp.2/47400000.usb/musb-hdrc.1.auto/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/ttyUSB0':
    KERNELS=="ttyUSB0"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="option1"
    ATTRS{port_number}=="0"

  looking at parent device '/devices/ocp.2/47400000.usb/musb-hdrc.1.auto/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0':
    KERNELS=="1-1.4.3:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="option"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{bInterfaceSubClass}=="ff"
    ATTRS{bInterfaceProtocol}=="ff"
    ATTRS{bNumEndpoints}=="03"
    ATTRS{supports_autosuspend}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{interface}=="Data Interface"

  looking at parent device '/devices/ocp.2/47400000.usb/musb-hdrc.1.auto/usb1/1-1/1-1.4/1-1.4.3':
    KERNELS=="1-1.4.3"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{devpath}=="1.4.3"
    ATTRS{idVendor}=="19d2"
    ATTRS{speed}=="12"
    ATTRS{bNumInterfaces}==" 6"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="6"
    ATTRS{configuration}==""
    ATTRS{bMaxPower}=="500mA"
    ATTRS{authorized}=="1"
    ATTRS{bmAttributes}=="a0"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{maxchild}=="0"
    ATTRS{bcdDevice}=="0000"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{version}==" 1.10"
    ATTRS{urbnum}=="3895"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="ZTE, Incorporated"
    ATTRS{removable}=="unknown"
    ATTRS{idProduct}=="fff1"
    ATTRS{bDeviceClass}=="00"
    ATTRS{product}=="ZTE CDMA Tech"

  looking at parent device '/devices/ocp.2/47400000.usb/musb-hdrc.1.auto/usb1/1-1/1-1.4':
    KERNELS=="1-1.4"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{devpath}=="1.4"
    ATTRS{idVendor}=="05e3"
    ATTRS{speed}=="480"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="5"
    ATTRS{configuration}==""
    ATTRS{bMaxPower}=="100mA"
    ATTRS{authorized}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{maxchild}=="4"
    ATTRS{bcdDevice}=="7764"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{version}==" 2.00"
    ATTRS{urbnum}=="29"
    ATTRS{ltm_capable}=="no"
    ATTRS{removable}=="unknown"
    ATTRS{idProduct}=="0608"
    ATTRS{bDeviceClass}=="09"
    ATTRS{product}=="USB2.0 Hub"

  looking at parent device '/devices/ocp.2/47400000.usb/musb-hdrc.1.auto/usb1/1-1':
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{devpath}=="1"
    ATTRS{idVendor}=="05e3"
    ATTRS{speed}=="480"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="2"
    ATTRS{configuration}==""
    ATTRS{bMaxPower}=="100mA"
    ATTRS{authorized}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{maxchild}=="4"
    ATTRS{bcdDevice}=="7764"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{version}==" 2.00"
    ATTRS{urbnum}=="49"
    ATTRS{ltm_capable}=="no"
    ATTRS{removable}=="unknown"
    ATTRS{idProduct}=="0608"
    ATTRS{bDeviceClass}=="09"
    ATTRS{product}=="USB2.0 Hub"

  looking at parent device '/devices/ocp.2/47400000.usb/musb-hdrc.1.auto/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{devpath}=="0"
    ATTRS{idVendor}=="1d6b"
    ATTRS{speed}=="480"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{authorized_default}=="1"
    ATTRS{busnum}=="1"
    ATTRS{devnum}=="1"
    ATTRS{configuration}==""
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{authorized}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{maxchild}=="1"
    ATTRS{bcdDevice}=="0308"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{serial}=="musb-hdrc.1.auto"
    ATTRS{version}==" 2.00"
    ATTRS{urbnum}=="28"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Linux 3.8.13-bone21 musb-hcd"
    ATTRS{removable}=="unknown"
    ATTRS{idProduct}=="0002"
    ATTRS{bDeviceClass}=="09"
    ATTRS{product}=="MUSB HDRC host driver"

  looking at parent device '/devices/ocp.2/47400000.usb/musb-hdrc.1.auto':
    KERNELS=="musb-hdrc.1.auto"
    SUBSYSTEMS=="platform"
    DRIVERS=="musb-hdrc"
    ATTRS{mode}=="b_peripheral"
    ATTRS{vbus}=="Vbus off, timeout 1100 msec"

  looking at parent device '/devices/ocp.2/47400000.usb':
    KERNELS=="47400000.usb"
    SUBSYSTEMS=="platform"
    DRIVERS=="musb-dsps"

  looking at parent device '/devices/ocp.2':
    KERNELS=="ocp.2"
    SUBSYSTEMS=="platform"
    DRIVERS==""

我哪里做错了?/dev/CDMAModem当我插入调制解调器时,我不明白。

答案1

尝试这个:

KERNEL=="ttyUSB[0-9]*", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ACTION=="add", ATTRS{bInterfaceNumber}=="00", ATTRS{bNumEndpoints}=="03", ATTRS{product}=="ZTE CDMA Tech", SYMLINK+="CDMAModem"

SYMLINK需要设备名称匹配和KERNEL==。实际上可能没有和/或 也能工作。也移动了。SUBSYSTEMSATTRSSUBSYSTEMSUBSYSTEMSACTION

答案2

尝试以下方法:

SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
SUBSYSTEM=="tty", ATTRS{idVendor}=="1234", ATTRS{idProduct}=="5678", SYMLINK+="your_device%E{.LOCAL_ifNum}"

相关内容