電訊茶室's Archiver

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 资讯[code]
[ 5178.221029] ehci_irq: port change detect
[ 5178.497003] usb 1-1: new high-speed USB device number 3 using sw-ehci
[ 5178.659742] usb 1-1: New USB device found, idVendor=12d1, idProduct=140c
[ 5178.672865] usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 5178.683546] usb 1-1: Product: HUAWEI Mobile
[ 5178.691860] usb 1-1: Manufacturer: HUAWEI Technology
[ 5178.703524] ====usb_stor_huawei_e220_init===>
[ 5178.708152] ====usb_stor_huawei_e220_init===>
[ 5178.727413] ehci_irq: port change detect
[ 5178.731448] usb 1-1: USB disconnect, device number 3
[ 5183.121657] ehci_irq: port change detect
[ 5183.407111] usb 1-1: new high-speed USB device number 4 using sw-ehci
[ 5183.569995] usb 1-1: New USB device found, idVendor=12d1, idProduct=140c
[ 5183.583216] usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 5183.594039] usb 1-1: Product: HUAWEI Mobile
[ 5183.602356] usb 1-1: Manufacturer: HUAWEI Technology
[ 5183.617003] option 1-1:1.0: GSM modem (1-port) converter detected
[ 5183.629744] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 5183.643902] option 1-1:1.2: GSM modem (1-port) converter detected
[ 5183.656634] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 5183.669767] option 1-1:1.3: GSM modem (1-port) converter detected
[ 5183.682655] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 5183.694342] ====usb_stor_huawei_e220_init===>
[ 5183.698882] ====usb_stor_huawei_e220_init===>
[ 5280.720043] ehci_irq: port change detect
[ 5280.724134] usb 1-1: USB disconnect, device number 4
[ 5280.740344] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 5280.753140] option 1-1:1.0: device disconnected
[ 5280.768048] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 5280.780286] option 1-1:1.2: device disconnected
[ 5280.794240] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 5280.806860] option 1-1:1.3: device disconnected
[/code]我使用的50-usb-3gdongle.rules 档案如下[code]# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

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

[/code]

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.