2013-07-26 126 views
0

在Ubuntu 13.04中,我對CDMA調制解調器寫的udev規則是 SUBSYSTEM=="tty", ATTRS{bInterfaceNumber}=="00", ATTRS{bNumEndpoints}=="03", ATTRS{product}=="ZTE CDMA Tech", ACTION=="add", SYMLINK+="CDMAModem"udev規則無法正常工作

$ 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說要添加一些更多的細節,因爲我的問題主要包含代碼,所以我輸入這個。我找不到任何我可以提供的進一步細節。

+0

如果使用'udevadm --monitor'(關閉我的頭頂部,將會回到正確的是這是錯誤的),並且插入設備,您是否在輸出中顯示添加事件? – jam

+0

Thanq我會檢查它。 – neckTwi

+0

它說'〜$ sudo udevadm --monitor udevadm:無法識別的選項'--monitor'' – neckTwi

回答

1

以下udev規則能夠創造symlink

SUBSYSTEMS=="usb-serial", ACTION=="add", DRIVERS=="option1", SYMLINK+="CDMAModem%n" 
SUBSYSTEMS=="usb-serial", ACTION=="remove", DRIVERS=="option1", SYMLINK-="CDMAModem%n" 

$ ls /dev/CDMAModem* 
/dev/CDMAModem0 /dev/CDMAModem1 /dev/CDMAModem2 /dev/CDMAModem3 /dev/CDMAModem4 

我在這條規則的期待,在規則評估設備屬性應該是相同的設備節點的到來。所以我已經採取了設備屬性只有一個節點/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,我也認爲它是最好的節點選擇,因爲它是從頂部加載特定驅動程序對應調制解調器的第一個設備節點(我不知道option1是一個調制解調器驅動程序其猜測)。我應該重新啓動系統才能運行。

現在我解決了這個問題,但我想要確切的解決方案和原因。什麼是option1驅動程序?而且我嚴重懷疑上述規則可以完全識別其他調制解調器中的調制解調器。