分类: LINUX
2012-08-13 11:11:34
开启开发板(内核就是TQ的基础上+上前面的配置,文件系统直接用TQ的) 进入文件系统:
(1) /etc/init.d/rcS
mount -a
mkdir -p /dev/pts
mkdir /var/run
mount -t devpts devpts /dev/pts
mount -t usbfs usbfs /proc/bus/usb
(2)
[root@EmbedSky /]# mount -t nfs 192.168.1.28:/nfs /mnt -o nolock
[root@EmbedSky /]# cd /mnt/
[root@EmbedSky /mnt]# ls
chat libusb.so libusbpp.so
libusb-0.1.so.4 libusbpp-0.1.so.4 pppd
libusb-0.1.so.4.4.4 libusbpp-0.1.so.4.4.4 usb_modeswitch
libusb.a libusbpp.a
libusb.la libusbpp.la
[root@EmbedSky /mnt]# cp chat /usr/sbin/
[root@EmbedSky /mnt]# cp pppd /usr/sbin/
[root@EmbedSky /mnt]# cp usb_modeswitch /bin/
[root@EmbedSky /mnt]# cp libusb* /lib/
[root@EmbedSky /mnt]#
重启 插上3G
Please press Enter to activate this console. ifconfig eth0 hw ether 10:23:45:67:89:ab
eth0: link down
ifconfig eth0 192.168.1.6 netmask 255.255.255.0 up
add default gw 192.168.1.2
Done
[root@EmbedSky /]# eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[root@EmbedSky /]# ifconfig eth0 down
[root@EmbedSky /]# usb_modeswitch -W -v 12d1 -p 1da1 -V 12d1 -P 1da1 -D 0 -H 1
Taking all parameters from the command line
* usb-modeswitch: handle USB devices with multiple modes
* Version 1.1.3 (C) Josua Dietze 2010
* Based on libusb0 (0.1.12 and above)
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x12d1
DefaultProduct= 0x1da1
TargetVendor= 0x12d1
TargetProduct= 0x1da1
TargetClass= not set
TargetProductList=""
DetachStorageOnly=0
HuaweiMode=1
SierraMode=0
SonyMode=0
GCTMode=0
MessageEndpoint= not set
MessageContent=""
NeedResponse=0
ResponseEndpoint= not set
Interface=0x00
InquireDevice enabled (default)
Success check disabled
System integratiousb 1-1: USB disconnect, address 2
n mode enabled
usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found 001
usb_os_find_busses: Skipping non bus directory devices
usb_os_find_devices: Found 002 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device
Looking for target devices ...
searching devices, found USB ID 12d1:1da1
found matching vendor ID
found matching product ID
adding device
searching devices, found USB ID 1d6b:0001
Found devices in target mode or class (1)
Looking for default devices ...
searching devices, found USB ID 12d1:1da1
found matching vendor ID
found matching product ID
adding device
searching devices, found USB ID 1d6b:0001
Found devices in default mode or class (1)
Accessing device 002 on bus 001 ...
Ambiguous Class/InterfaceClass: 0x02/0x08Using endpoints 0x05 (out) and 0x85 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
USB error: could not get bound driver: No data available
No driver found. Either detached before or never attached
SCSI inquiry data (for identification)
-------------------------
Vendor String: HUAWEI
Model String: Mobile CMCC CD
Revision String: 1.25
-------------------------
USB description data (for identification)
-------------------------
Manufacturer: HUAWEI Mobile
Product: HUAWEI Mobile System Solution
Serial No.: 000000-00-000000
-------------------------
Sending Huawei control message ...
USB error: error sending control message: Timer expired
Error: sending Huawei control message failed (error -62). Aborting.
[root@EmbedSky /]# usb 1-1: new full speed USB device using s3c2410-ohci and address 3
usb 1-1: New USB device found, idVendor=12d1, idProduct=1d09
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: HUAWEI Mobile System Solution
usb 1-1: Manufacturer: HUAWEI Mobile
usb 1-1: SerialNumber: 000000-00-000000
usb 1-1: configuration #3 chosen from 1 choice
cdc_acm 1-1:3.1: ttyACM0: USB ACM device
cdc_acm 1-1:3.3: ttyACM1: USB ACM device
cdc_acm 1-1:3.5: ttyACM2: USB ACM device
[root@EmbedSky /]#
(3)开始拨号
[root@ZHENXI-> /mnt]# cd /etc/ppp
[root@ZHENXI-> ppp]# ls
chap-secrets peers
connect-chat pap-secrets resolv.conf
[root@ZHENXI-> ppp]# vi chap-secrets
any * any
[root@ZHENXI-> ppp]# vi connect-chat
TIMEOUT 15
ABORT '/nBUSY/r'
ABORT '/nNO ANSWER/r'
ABORT '/nRINGING/r/n/r/nRINGING/r'
TIMEOUT 40
' ' /rAT (前面是2个单引号)
OK ATS0=0
OK ATE0V1
OK AT/^PREFMODE=2
OK ATDT*99#
CONNECT
[root@ZHENXI-> ppp]# vi pap-secrets
guest hostname "*" -
master hostname "*" -
root hostname "*" -
support hostname "*" -
stats hostname "*" -
any * any
[root@ZHENXI-> ppp]# ls
chap-secrets connect-errors peers
connect-chat pap-secrets resolv.conf
[root@ZHENXI-> ppp]# cd peers/
[root@ZHENXI-> peers]# ls
gprs
[root@ZHENXI-> peers]# vi gprs
/dev/ttyACM1
460800
nocrtscts
modem
#noauth
nodetach(显示PPP拨号过程信息,去掉不显示)
usepeerdns
debug
noipdefault
defaultroute
user any
#0.0.0.0:0.0.0.0
ipcp-accept-local
ipcp-accept-remote
persist
connect '/usr/sbin/chat -s -v –f /etc/ppp/connect-chat'
[root@ZHENXI-> peers]# ls
gprs
[root@ZHENXI-> peers]# cd ..
执行 pppd call gprs即可拨号
[root@EmbedSky /]# pppd call gprs
(如果出现报错couldn't open ppp database /var/run/pppd2.tdb这一个错误
解决办法
mkdir /var/run
解释:pppd2.tdb这个文件是pppd程序生成的如果没有run这个目录的话只要建一个目录就可以了)
timeout set to 15 seconds
abort on (/nBUSY/r)
abort on (/nNO ANSWER/r)
abort on (/nRINGING/r/n/r/nRINGING/r)
timeout set to 40 seconds
send (^MAT^M)
expect (OK)
^M
OK
-- got it
send (ATS0=0^M)
expect (OK)
^M
^MAT^M^M
OK
-- got it
send (ATE0V1^M)
expect (OK)
^M
ATS0=0^M^M
OK
-- got it
send (AT+CGDCONT=1,"IP","CMNET"^M)
expect (OK)
^M
ATE0V1^M^M
OK
-- got it
send (ATDT*99***1#^M)
expect (CONNECT)
^M
^M
OK^M
^M
CONNECT
-- got it
Script /usr/sbin/chat -s -v -f /etc/ppp/connect-chat finished (pid 517), status = 0x0
Serial connection established.
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/ttyACM1
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
sent [LCP ConfReq id=0x1
rcvd [LCP ConfReq id=0x1
sent [LCP ConfAck id=0x1
rcvd [LCP ConfRej id=0x1
sent [LCP ConfReq id=0x2
rcvd [LCP ConfAck id=0x2
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
sent [PAP AuthReq id=0x1 user="any" password=
rcvd [PAP AuthAck id=0x1 "Login OK"]
Remote message: Login OK
PAP authentication succeeded
sent [CCP ConfReq id=0x1
sent [IPCP ConfReq id=0x1
rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]
Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
sent [IPCP ConfReq id=0x1
sent [IPCP ConfReq id=0x1
rcvd [IPCP ConfReq id=0x1
sent [IPCP ConfAck id=0x1
rcvd [IPCP ConfRej id=0x1
sent [IPCP ConfReq id=0x2
rcvd [IPCP ConfNak id=0x2
sent [IPCP ConfReq id=0x3
rcvd [IPCP ConfAck id=0x3
local IP address 10.160.193.31
remote IP address 192.200.1.21
primary DNS address 211.141.16.99
secondary DNS address 211.136.17.107
[root@ZHENXI-> ppp]# ls
chap-secrets connect-errors peers
connect-chat pap-secrets resolv.conf
[root@ZHENXI-> ppp]# vi resolv.conf
nameserver 211.141.16.99
nameserver 211.136.17.107
这2个为上面PPP拨号成功时返回的DNS,将其加入resolv.conf文件即可