ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2014年9月26日 星期五

HUAWEI HiLink - E3131 3G Dongle

[99274.544647] usb-storage: device scan complete
[99274.545218] scsi 36:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[99274.547006] sr1: scsi-1 drive
[99274.547156] sr 36:0:0:0: Attached scsi CD-ROM sr1
[99274.547246] sr 36:0:0:0: Attached scsi generic sg6 type 5
[99475.187782] usb 3-1.1.4: USB disconnect, address 35
[100478.559739] usb 3-1.1.3: new high speed USB device using ehci_hcd and address 36
[100478.664682] usb 3-1.1.3: New USB device found, idVendor=12d1, idProduct=1f01
[100478.664688] usb 3-1.1.3: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[100478.664692] usb 3-1.1.3: Product: HUAWEI HiLink
[100478.664695] usb 3-1.1.3: Manufacturer: HUAWEI
[100478.664820] usb 3-1.1.3: configuration #1 chosen from 1 choice
[100478.666119] scsi37 : SCSI emulation for USB Mass Storage devices
[100478.666249] usb-storage: device found at 36
[100478.666253] usb-storage: waiting for device to settle before scanning
ref: http://www.pcduino.com/3g-cellular-usb-dongle-for-pcduino-huawei-e303s/

檢查一下 usb_modeswitch:

/lib/udev/rules.d/40-usb_modeswitch.rules:
# Huawei E3131
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1f01", RUN+="usb_modeswitch '%b/%k'"
如果沒有,就加上去。

然後是 /etc/usb_modeswitch.d/
有沒有 12d1:1f01 這個 file.

雖然有 google 到一些不同得,最後是..
#Huawei E3131
DefaultVendor= 0x12d1
DefaultProduct= 0x1f01
TargetVendor= 0x12d1
RargetProduct= 0x1f01
MessageEndPoint = "0x01"
MessageContent="55534243000000000000000000000011060000000000000000000000000000"
NoDriverLoading=1

這樣,插入 3G dongle,, dmesg:
[97530.910739] usb 3-1.3.4: new high speed USB device using ehci_hcd and address 66
[97531.015681] usb 3-1.3.4: New USB device found, idVendor=12d1, idProduct=1f01
[97531.015688] usb 3-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[97531.015691] usb 3-1.3.4: Product: HUAWEI HiLink
[97531.015694] usb 3-1.3.4: Manufacturer: HUAWEI
[97531.015825] usb 3-1.3.4: configuration #1 chosen from 1 choice
[97531.017289] scsi49 : SCSI emulation for USB Mass Storage devices
[97531.017547] usb-storage: device found at 66
[97531.017551] usb-storage: waiting for device to settle before scanning
[97531.723149] usb 3-1.3.4: USB disconnect, address 66
[97536.787599] usb 3-1.3.4: new high speed USB device using ehci_hcd and address 67
[97536.891893] usb 3-1.3.4: New USB device found, idVendor=12d1, idProduct=1001
[97536.891896] usb 3-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[97536.891898] usb 3-1.3.4: Product: HUAWEI HiLink
[97536.891900] usb 3-1.3.4: Manufacturer: HUAWEI
[97536.891984] usb 3-1.3.4: configuration #1 chosen from 1 choice
[97536.892444] option 3-1.3.4:1.0: GSM modem (1-port) converter detected
[97536.892521] usb 3-1.3.4: GSM modem (1-port) converter now attached to ttyUSB0
[97536.892587] option 3-1.3.4:1.1: GSM modem (1-port) converter detected
[97536.892637] usb 3-1.3.4: GSM modem (1-port) converter now attached to ttyUSB1
[97536.892688] option 3-1.3.4:1.2: GSM modem (1-port) converter detected
[97536.892736] usb 3-1.3.4: GSM modem (1-port) converter now attached to ttyUSB2
pid 變成 1001, 並且出現了 ttyUSB0.1.2

有關 usb_modeswitch, 可以修改 /etc/usb_modeswitch.conf. 把 log 打開:
# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_"

EnableLogging=1

這隻 dongle 好像有好多種 configuration.
ref: http://mybroadband.co.za/vb/showthread.php/507680-Huawei-HiLink-modems-%28E303-E3131-etc-%29/page2

在 modeswitch 後,minicom 開啟 ttyUSB0. 下:
AT^U2DIAG=0
AT+CFUN=4
AT+CFUN=6
之後 dongle reboot, 然後變成 網路裝置,pid 也變了...

--- 這是安裝過 CDROM mode driver 才會出現。

一但變成這個模式後,dongle 會紀錄這個模式。
以後每次插入都是這個 vid, pid, 插入 linux 也一樣。

要切回原來的模式,要 follow 上面的 link ,重新對 comport 下:
AT^U2DIAG=119
AT+CFUN=4
AT+CFUN=6
但是在 windows 下沒有出現 COM Port,插入 linux 也一樣。
認不得這個 vid, pid

[ 6369.326587] usb 2-1.3.4: new high speed USB device using ehci_hcd and address 10
[ 6369.431758] usb 2-1.3.4: New USB device found, idVendor=12d1, idProduct=1c05
[ 6369.431764] usb 2-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 6369.431768] usb 2-1.3.4: Product: HUAWEI HiLink
[ 6369.431770] usb 2-1.3.4: Manufacturer: HUAWEI
[ 6369.431901] usb 2-1.3.4: configuration #1 chosen from 1 choice
[ 6369.793255] usbcore: registered new interface driver cdc_ether
[ 6369.795967] usb 2-1.3.4: bad CDC descriptors
[ 6369.795991] usb 2-1.3.4: bad CDC descriptors
[ 6369.796014] usb 2-1.3.4: bad CDC descriptors
[ 6369.796046] usbcore: registered new interface driver rndis_host
[ 6369.833178] cfg80211: Using static regulatory domain info
[ 6369.833183] cfg80211: Regulatory domain: US
[ 6369.833186]  (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 6369.833192]  (2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
[ 6369.833223]  (5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[ 6369.833227]  (5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[ 6369.833232]  (5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[ 6369.833237]  (5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
[ 6369.833242]  (5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
[ 6369.833556] cfg80211: Calling CRDA for country: US
[ 6369.838314] usb 2-1.3.4: bad CDC descriptors
[ 6369.839245] usb 2-1.3.4: bad CDC descriptors
[ 6369.839326] usb 2-1.3.4: bad CDC descriptors
[ 6369.839378] usbcore: registered new interface driver rndis_wlan
ref: http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=571

就是:
# echo "12d1 1c05" >/sys/bus/usb-serial/drivers/option1/new_id 
很奇怪,一定要是 root 才行。
用 sudo 的話,會是 permission deny

然後 kernel msg:
[ 6846.542169] option 2-1.3.4:1.0: GSM modem (1-port) converter detected
[ 6846.542302] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB0
[ 6846.542346] option 2-1.3.4:1.1: GSM modem (1-port) converter detected
[ 6846.542420] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB1
[ 6846.542461] option 2-1.3.4:1.2: GSM modem (1-port) converter detected
[ 6846.542538] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB2
這樣就出現 COM port 了。
之後用 minicom 打開 ttyUSB0.
輸入:
AT^U2DIAG=119
AT+CFUN=4
AT+CFUN=6
dongle 會重開,然後 dmesg 出來是..
[ 7832.680140] usb 2-1.3.4: new high speed USB device using ehci_hcd and address 13
[ 7832.785372] usb 2-1.3.4: New USB device found, idVendor=12d1, idProduct=1f01
[ 7832.785378] usb 2-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 7832.785382] usb 2-1.3.4: Product: HUAWEI HiLink
[ 7832.785384] usb 2-1.3.4: Manufacturer: HUAWEI
[ 7832.785511] usb 2-1.3.4: configuration #1 chosen from 1 choice
[ 7832.786962] scsi11 : SCSI emulation for USB Mass Storage devices
[ 7832.787105] usb-storage: device found at 13
[ 7832.787109] usb-storage: waiting for device to settle before scanning
[ 7833.490017] usb 2-1.3.4: USB disconnect, address 13
[ 7838.553987] usb 2-1.3.4: new high speed USB device using ehci_hcd and address 14
[ 7838.659009] usb 2-1.3.4: New USB device found, idVendor=12d1, idProduct=1001
[ 7838.659015] usb 2-1.3.4: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 7838.659019] usb 2-1.3.4: Product: HUAWEI HiLink
[ 7838.659021] usb 2-1.3.4: Manufacturer: HUAWEI
[ 7838.659149] usb 2-1.3.4: configuration #1 chosen from 1 choice
[ 7838.659589] option 2-1.3.4:1.0: GSM modem (1-port) converter detected
[ 7838.659732] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB0
[ 7838.659874] option 2-1.3.4:1.1: GSM modem (1-port) converter detected
[ 7838.659977] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB1
[ 7838.660088] option 2-1.3.4:1.2: GSM modem (1-port) converter detected
[ 7838.660186] usb 2-1.3.4: GSM modem (1-port) converter now attached to ttyUSB2
回到以前的 1f01, 然後 modeswitch 到 1001


撥號連線...用 wvdial 撥號,接 ppp..
寫 /etc/wvdial.conf

[Dialer e3131]
Modem = /dev/ttyUSB0
Init1 = ATZ
Init2 = AT^CURC=0
Init3 = AT+CGDCONT=1,"IP","internet"
Phone = *99#
Stupid mode = yes
Dial Attempts = 0
Auto Reconect = yes
Password=''
Username=''
然後下命令:sudo wvdial e3131..
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: AT^CURC=0
AT^CURC=0
OK
--> Sending: AT+CGDCONT=1,"IP","internet"
AT+CGDCONT=1,"IP","internet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Fri Sep 26 11:09:15 2014
--> Pid of pppd: 4065
--> Using interface ppp0
--> local  IP address 42.68.94.228
--> remote IP address 10.64.64.64
--> primary   DNS address 168.95.1.1
--> secondary DNS address 168.95.192.1

之後用 ifconfig 看,OK

wvdial.conf 如果沒有寫
Password=''
Username=''
wvdial 會 complain 沒有給 username, password

沒有留言:

標籤

網誌存檔