在我的linux盒子上(uname -a Linux gate 3.2.0-0.bpo.2-amd64#1 SMP Fri Jun 29 20:42:29 UTC 2012 x86_64 GNU / Linux)我有USB调制解调器WeTelecom WM -D300具有“zeroCD”选项。 ZeroCD USB ID为22de:6803,调制解调器设备有22de:6801 usb id。我为它创建了usb_modeswitch规则,并测试了这条规则运行良好:
Aug 11 23:03:14 gate kernel: [ 609.832373] usb 1-1: usbfs: process 6081 (usb_modeswitch) did not claim interface 0 before use
Aug 11 23:03:14 gate kernel: [ 609.949352] usb 1-1: USB disconnect, device number 2
Aug 11 23:03:15 gate kernel: [ 610.596344] usb 1-1: new high-speed USB device number 5 using ehci_hcd
Aug 11 23:03:15 gate kernel: [ 610.759964] usb 1-1: New USB device found, idVendor=22de, idProduct=6801
Aug 11 23:03:15 gate kernel: [ 610.759978] usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
Aug 11 23:03:15 gate kernel: [ 610.759987] usb 1-1: Product: Wetelecom Mobile Products
Aug 11 23:03:15 gate kernel: [ 610.759994] usb 1-1: Manufacturer: WeTelecom Incorporated
Aug 11 23:03:16 gate kernel: [ 611.820404] option 1-1:1.0: GSM modem (1-port) converter detected
Aug 11 23:03:16 gate kernel: [ 611.820760] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
Aug 11 23:03:16 gate kernel: [ 611.820876] option 1-1:1.1: GSM modem (1-port) converter detected
Aug 11 23:03:16 gate kernel: [ 611.821095] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB4
Aug 11 23:03:16 gate kernel: [ 611.821204] option 1-1:1.2: GSM modem (1-port) converter detected
Aug 11 23:03:16 gate kernel: [ 611.821418] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB5
所以,我做了一个小的udev配置,允许自动热插拔这个设备:
ACTION!="add|change", GOTO="modem_rules_end"
SUBSYSTEM!="usb", GOTO="modem_rules_end"
LABEL="modem_rules_begin"
# WeTelecom WM-D300
ATTRS{idVendor}=="22de", ATTRS{idProduct}=="6803", RUN+="usb_modeswitch '%b/%k'"
LABEL="modem_rules_end"
它不起作用。 重新连接调制解调器后,它变得完全不可用。 usb-devices表明它有usbfs驱动程序,而usb_modeswitch甚至无法从命令行切换它。 udev也无法切换,但重新启动后工作正常 - 直到下一次物理重新连接。 这是我插入调制解调器时的udev日志:
Aug 11 22:42:11 gate logger: usb_modeswitch: using overriding config file /etc/usb_modeswitch.d/22de:6803; make sure this is intended
Aug 11 22:42:11 gate logger: usb_modeswitch: please report any new or corrected settings; otherwise, check for outdated files
Aug 11 22:42:11 gate logger: usb_modeswitch: using overriding config file /etc/usb_modeswitch.d/22de:6803; make sure this is intended
Aug 11 22:42:11 gate logger: usb_modeswitch: please report any new or corrected settings; otherwise, check for outdated files
Aug 11 22:42:11 gate usb_modeswitch: switching device 22de:6803 on 001/006
Aug 11 22:42:11 gate usb_modeswitch: switching device 22de:6803 on 001/006
Aug 11 22:42:11 gate kernel: [ 1495.864235] usb 1-1: usbfs: process 8485 (usb_modeswitch) did not claim interface 0 before use
Aug 11 22:42:11 gate kernel: [ 1495.864309] usb 1-1: usbfs: process 8485 (usb_modeswitch) did not claim interface 0 before use
Aug 11 22:42:16 gate logger: usb_modeswitch: switched to 22de:6803 on 001/006
Aug 11 22:42:19 gate logger: usb_modeswitch: switched to 22de:6803 on 001/006
所以,我的问题是:为什么以及如何?为什么它从命令行工作以及如何使它由udev工作? 请帮忙。 Thanx提前!