【SOCLAB】HUAWEI无线上网卡——拨号使用手册

为了实验室以后的发展,防止知识断层,以后尽量把实验室的一些使用资料进行记录。

打开网关电源开关,登入之后,插入无线上网卡设备,打印如下信息:

usb 1-1.4: new full speed USB device using s3c2410-ohci and address 4
usb 1-1.4: New USB device found, idVendor=12d1, idProduct=1446
usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=4
usb 1-1.4: Product: HUAWEI Mobile
usb 1-1.4: Manufacturer: HUA每WEI TECHNOLOGIES
usb 1-1.4: SerialNumber: 每每每每每每每每每每每每每每每每每每每
usb 1-1.4: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
scsi 0:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 0
sr0: scsi-1 drive
Uniform CD-ROM driver Revision: 3.20
sr 0:0:0:0: Attached scsi generic sg0 type 5

这个是驱动打印出来的信息,这个涉及到驱动移植,之前康璐学长已经对驱动的移植做过记录,大家可以参考: http://blog.csdn.net/kangkermit/article/details/8134827

然后进行usb mode switch;

[root@FriendlyARM /apps]# /usb/usb_modeswitch -c /usb/usb_modeswitch.conf

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found devices in default mode, class or configuration (1)
Accessing device 004 on bus 001 ...
Getting the current device configuration ...
 OK, got current device configuration (1)
Using endpoints 0x08 (out) and 0x87 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached

SCSI inquiry data (for identification)
-------------------------
  Vendor String: HUAWEI  
   Model String: Mass Storage    
Revision String: 2.31
-------------------------

USB description data (for identification)
usb 1-1.4: usbfs: process 712 (usb_modeswitch) did not claim interface 0 before use
-------------------------
Manufacturer: HUAWEI TECHNOLOGIES
     Product: HUAWEI Mobile
  Serial No.: 
-------------------------
Setting up communication with interface 0 ...
Using endpoint 0x08 for message sending ...
Trying to send message 1 to endpoint 0x08 ...
 OK, message successfully sent
Resetting response endpoint 0x87
 Could not reset endpoint (probably harmless): -62
Resetting message endpoint 0x08
 Could not reset endpoint (probably harmless): -62
usb 1-1.4: USB disconnect, address 4
 Device is gone, skipping any further commands

Checking for mode switch (max. 20 times, once per second) ...
 Searching for target devices ...
 Searching for target devices ...
 Searching for target devices ...
usb 1-1.4: new full speed USB device using s3c2410-ohci and address 5
usb 1-1.4: New USB device found, idVendor=12d1, idProduct=1001
usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=4
usb 1-1.4: Product: HUAWEI Mobile
usb 1-1.4: Manufacturer: HUA每WEI TECHNOLOGIES
usb 1-1.4: SerialNumber: 每每每每每每每每每每每每每每每每每每每
usb 1-1.4: configuration #1 chosen from 1 choice
option 1-1.4:1.0: GSM modem (1-port) converter detected
usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB1
option 1-1.4:1.1: GSM modem (1-port) converter detected
usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB2
 Searching for target devices ...
option 1-1.4:1.2: GSM modem (1-port) converter detected
usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB3
scsi4 : SCSI emulation for USB Mass Storage devices
 Searching for target devices ...

Found target device, now opening
 Found correct target device

Mode switch succeeded. Bye.

这些事usb mode转换,是一个工具,大家需要移植的,后期我会对他的移植进行详细介绍,大家可以先了解下: http://www.draisberghof.de/usb_modeswitch/

usb mode switch 简介:http://blog.csdn.net/zhouzhuan2008/article/details/8771096

然后还会后续打印一些信息:

scsi 4:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 0
sr0: scsi-1 drive
sr 4:0:0:0: Attached scsi generic sg0 type 5

这个大家不用管他。

这时候设备目录下面出现了我们需要的设备:

[root@FriendlyARM /apps]# ls /dev/ttyUSB*
/dev/ttyUSB0  /dev/ttyUSB1  /dev/ttyUSB2  /dev/ttyUSB3
这样我们拨号的前奏就做的差不多了,下面我们来研究研究拨号的脚本:

[root@FriendlyARM /apps]# cat /usb/cdma2000 
nodetach
lock
/dev/ttyUSB3
921600
crtscts
hide-password
#caoke
user 1537700000
password 700223 

#raoling
#user 13307157221
#password 19931115

usepeerdns
noauth
noipdefault
novj
novjccomp
noccp
defaultroute
ipcp-accept-local
ipcp-accept-remote
connect '/usr/sbin/chat -s -v -f /usb/chat-cdma2000-connect'
disconnect '/usr/sbin/chat -s -v -f /usb/chat-cdma2000-disconnect'
为了确保大家以后正常使用,大家以后对我这个脚本就不要随便改了,只需要改的是user和password,这次我用的是曹可的手机卡,这里为了他的隐私我把他的手机卡号给改了,密码也是随便写的;

这个改完后,就可以拨号了。

[root@FriendlyARM /apps]# /usb/pppd file /usb/cdma2000 &
[root@FriendlyARM /apps]# timeout set to 8 seconds
abort on (NO CARRIER)
abort on (ERROR)
abort on (NO DIALTONE)
abort on (BUSY)
abort on (NO ANSWER)
send (AT^M)
expect (OK)
AT^M^M
OK
 -- got it

send (ATZ^M)
expect (OK)
^M
ATZ^M^M
OK
 -- got it

send (AT+CFUN=1^M)
expect (OK)
^M
AT+CFUN=1^M^M
OK
 -- got it

send (ATDT#777^M)
expect (CONNECT)
^M
ATDT#777^M^M
CONNECT
 -- got it

send (^M)
Serial connection established.
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB3
CHAP authentication succeeded: Welcome to HBTELECOM.
CHAP authentication succeeded
not replacing existing default route via 192.168.1.1
local  IP address 171.114.108.65
remote IP address 172.16.165.37
primary   DNS address 202.103.24.68
secondary DNS address 202.103.44.150

拨号成功了,我们用ifconfig命令看看:

[root@FriendlyARM /apps]# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:90:90:90:90:90  
          inet addr:192.168.1.230  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:51 Base address:0x4300 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:136 (136.0 B)  TX bytes:136 (136.0 B)

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:171.114.108.65  P-t-P:172.16.165.37  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1380  Metric:1
          RX packets:5 errors:2 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:178 (178.0 B)  TX bytes:54 (54.0 B)

多了个网卡ppp0,这个就是我们的无线上网卡,我们来测试下:

[root@FriendlyARM /apps]# ping -I ppp0 4.2.2.2
PING 4.2.2.2 (4.2.2.2): 56 data bytes
64 bytes from 4.2.2.2: seq=1 ttl=50 time=345.534 ms
64 bytes from 4.2.2.2: seq=2 ttl=50 time=365.323 ms
64 bytes from 4.2.2.2: seq=3 ttl=50 time=345.251 ms
64 bytes from 4.2.2.2: seq=4 ttl=50 time=345.288 ms
64 bytes from 4.2.2.2: seq=5 ttl=50 time=350.292 ms
64 bytes from 4.2.2.2: seq=6 ttl=50 time=345.308 ms
^C
--- 4.2.2.2 ping statistics ---
7 packets transmitted, 6 packets received, 14% packet loss
round-trip min/avg/max = 345.251/349.499/365.323 ms

4.2.2.2是全球公用的DNS,到这里无线上网卡的使用已经介绍完了,希望大家好好做!

你可能感兴趣的:(pppd网络拨号)