Board logo

標題: USB 3G Dongle - Storage vs Modem Mode [打印本頁]

作者: ckleea    時間: 2015-2-1 10:06     標題: USB 3G Dongle - Storage vs Modem Mode

大部分 USB 手指都用在 Windows 系统上,所以好多时 default 是 USB Storage Mode

当插入 Windows 时会 detect as USB CD,然後 auto run setup,转到 modem mode 供 3G 上网。

但在我们的 linux 或树莓派派上使用 chan_dongle,手指还是当作 CD,不能供上网用。

虽然有软件 usb_modeswitch 帮手转,  但次次在 command line 做真是不太方便。

最近上网拔到这方法,在 /etc/udev/rules.d 建立 50-usb-3gdongle.rules 这档案
当USB 手指插入时,系统会自动将Storage Mode转入modem mode

可见下面 dmesg 资讯
  1. [ 5178.221029] ehci_irq: port change detect
  2. [ 5178.497003] usb 1-1: new high-speed USB device number 3 using sw-ehci
  3. [ 5178.659742] usb 1-1: New USB device found, idVendor=12d1, idProduct=140c
  4. [ 5178.672865] usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
  5. [ 5178.683546] usb 1-1: Product: HUAWEI Mobile
  6. [ 5178.691860] usb 1-1: Manufacturer: HUAWEI Technology
  7. [ 5178.703524] ====usb_stor_huawei_e220_init===>
  8. [ 5178.708152] ====usb_stor_huawei_e220_init===>
  9. [ 5178.727413] ehci_irq: port change detect
  10. [ 5178.731448] usb 1-1: USB disconnect, device number 3
  11. [ 5183.121657] ehci_irq: port change detect
  12. [ 5183.407111] usb 1-1: new high-speed USB device number 4 using sw-ehci
  13. [ 5183.569995] usb 1-1: New USB device found, idVendor=12d1, idProduct=140c
  14. [ 5183.583216] usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
  15. [ 5183.594039] usb 1-1: Product: HUAWEI Mobile
  16. [ 5183.602356] usb 1-1: Manufacturer: HUAWEI Technology
  17. [ 5183.617003] option 1-1:1.0: GSM modem (1-port) converter detected
  18. [ 5183.629744] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
  19. [ 5183.643902] option 1-1:1.2: GSM modem (1-port) converter detected
  20. [ 5183.656634] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
  21. [ 5183.669767] option 1-1:1.3: GSM modem (1-port) converter detected
  22. [ 5183.682655] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
  23. [ 5183.694342] ====usb_stor_huawei_e220_init===>
  24. [ 5183.698882] ====usb_stor_huawei_e220_init===>
  25. [ 5280.720043] ehci_irq: port change detect
  26. [ 5280.724134] usb 1-1: USB disconnect, device number 4
  27. [ 5280.740344] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
  28. [ 5280.753140] option 1-1:1.0: device disconnected
  29. [ 5280.768048] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
  30. [ 5280.780286] option 1-1:1.2: device disconnected
  31. [ 5280.794240] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
  32. [ 5280.806860] option 1-1:1.3: device disconnected
複製代碼
我使用的50-usb-3gdongle.rules 档案如下
  1. # You can modify it, as long as you keep each rule on a single
  2. # line, and change only the value of the NAME= key.

  3. # Huawei E180 dongle
  4. SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", ATTR{idProduct}=="140c", RUN+="/usr/sbin/usb_modeswitch -v 12d1 -p 140c -W -H"
複製代碼





歡迎光臨 電訊茶室 (http://telecom-cafe.com/forum/) Powered by Discuz! 7.2