在 ubuntu 13.04 上,我为 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}=="10"
ATTRS{configuration}==""
ATTRS{bMaxPower}=="500mA"
ATTRS{authorized}=="1"
ATTRS{bmAttributes}=="a0"
ATTRS{bNumConfigurations}=="1"
ATTRS{maxchild}=="0"
ATTRS{bcdDevice}=="0000"
ATTRS{avoid_reset_quirk}=="1"
ATTRS{quirks}=="0x10"
ATTRS{version}==" 1.10"
ATTRS{urbnum}=="266"
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}=="116"
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}=="67"
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
当我插入调制解调器时,我不明白。我也试过NAME
代替SYMLINK+
. /dev/ttyUSB0
是我连接调制解调器时得到的设备文件。我也得到/dev/ttyUSB1,2,3,4
了,但他们不响应 AT 命令。
stackoverflow 说要添加更多细节,因为我的问题主要包含代码,所以我正在输入这个。我找不到我能提供的任何进一步的细节。