zbj20082003 发表于 2012-4-17 11:58:47

3G 拨号问题

环境Linux3.0.1
3G模块ZTE AC2726   电信CDMA2000
1..插上3G模块后,/dev下增加一个usbdev1.1,并没有出现ttyUSB0~ttyUSB4.使用./pppd call cdma2000,提示
# pwd
/opt/3G/bin
# ./pppd call cdma2000
./pppd: In file /etc/ppp/peers/cdma2000: unrecognized option '/dev/ttyUSB0'
2.应该是驱动没有正常安装。但是运行官方提供的3GDialup后,系统就会提示
# usb 1-1: usbfs: process 135 (usb_modeswitch) did not claim i
nterface 0 before use
usb 1-1: USB disconnect, device number 2
usb 1-1: new full speed USB device number 7 using s3c2410-ohci
usb 1-1: New USB device found, idVendor=19d2, idProduct=fff1
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1: Product: ZTE CDMA Tech
usb 1-1: Manufacturer: ZTE, Incorporated
pl2303 1-1:1.0: pl2303 converter detected
usb 1-1: pl2303 converter now attached to ttyUSB0
pl2303 1-1:1.1: pl2303 converter detected
usb 1-1: pl2303 converter now attached to ttyUSB1
pl2303 1-1:1.2: pl2303 converter detected
usb 1-1: pl2303 converter now attached to ttyUSB2
pl2303 1-1:1.3: pl2303 converter detected
usb 1-1: pl2303 converter now attached to ttyUSB3
pl2303 1-1:1.4: pl2303 converter detected
usb 1-1: pl2303 converter now attached to ttyUSB4
scsi1 : usb-storage 1-1:1.5
scsi 1:0:0:0: Direct-Access   ZTE      USB Storage FFF1 2.31 PQ: 0 ANSI: 2
sd 1:0:0:0: Attached scsi generic sg0 type 0
sd 1:0:0:0: Attached SCSI removable disk

能将usb1.1转换为ttyUSB0~4,而且拨号成功

3.然后在/dev下就有了ttyUSB0~4
4.然后再使用./pppd call cdma2000拨号就能成功。
第一个问题:不知到3GDialup怎么将usb转换为ttyUSB0~4的?我用手动安装如何实现
第二个问题:不管是手动连接还是3GDialup,当连接上之后如果ping www.baidu.com都能成功,只要一直ping不停止,连接一直保持,一旦停止ping等等1,2秒,就会断开连接,提示如下64 bytes from 119.75.218.77: seq=153 ttl=53 time=59.448 ms
64 bytes from 119.75.218.77: seq=154 ttl=53 time=122.508 ms
64 bytes from 119.75.218.77: seq=155 ttl=53 time=77.247 ms
^C
--- www.baidu.com ping statistics ---
156 packets transmitted, 156 packets received, 0% packet loss
round-trip min/avg/max = 59.448/88.407/441.169 ms
# Modem hangup
Connect time 3.0 minutes.
Sent 13222 bytes, received 13308 bytes.
Connection terminated.

连接中止了,好像超时了?然后再ifconfig
64 bytes from 119.75.218.77: seq=153 ttl=53 time=59.448 ms
64 bytes from 119.75.218.77: seq=154 ttl=53 time=122.508 ms
64 bytes from 119.75.218.77: seq=155 ttl=53 time=77.247 ms
^C
--- www.baidu.com ping statistics ---
156 packets transmitted, 156 packets received, 0% packet loss
round-trip min/avg/max = 59.448/88.407/441.169 ms
# Modem hangup
Connect time 3.0 minutes.
Sent 13222 bytes, received 13308 bytes.
Connection terminated.

+ Done(16)                   ./pppd call cdma2000
# ifconfig
#

zbj20082003 发表于 2012-4-17 15:05:31

帮忙给看看!打你们电话真难!

zbj20082003 发表于 2012-4-17 15:06:18

另外我想用代码实现拨号,并且返回获得的IP地址,应该怎么做?

zbj20082003 发表于 2012-4-17 15:50:18

第一个问题解决了,通过分析官方的3GDiaup代码发现,其执行了一个命令./usb_modeswitch -c usb_modeswitch.d/19d2^%fff5 -W 实现了USB到串口的处理。

zbj20082003 发表于 2012-4-17 16:07:14

明白了

zbj20082003 发表于 2012-4-17 16:13:25

通过分析官方3GDialog代码发现,其实就是执行了两条命令
1.首先通过读取/sys/bus/usb/devices/1-1/idVendor和/sys/bus/usb/devices/1-1/idProduct获得设备Vid和Pid
2.然后执行./usb_modeswitch -c usb_modeswitch.d/19d2^%fff5 -W命令(其中19d2为Vid和fff5为Pid)实现usb串口的映射
3.然后执行/opt/3G/bin/pppd call cdma2000实现拨号
4.其中状态框中的内容就是从终端上读出的内容放到了文本框中(不知道这句话对不对)

zbj20082003 发表于 2012-4-17 16:18:47

就剩下最后一个问题了,网络拨通之后不和某个Server保持连接,自动就会断开。如果一直ping 某个server也不会断,一旦停止ping ,停几秒就断。提示如次:
PAP authentication succeeded
localIP address 1.198.20.80
remote IP address 115.168.79.5
primary   DNS address 222.85.85.85
secondary DNS address 222.88.88.88

# ping www.baidu.com
PING www.baidu.com (220.181.111.147): 56 data bytes
64 bytes from 220.181.111.147: seq=0 ttl=53 time=73.823 ms
64 bytes from 220.181.111.147: seq=1 ttl=53 time=79.310 ms
^C
--- www.baidu.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 73.823/76.566/79.310 ms
# Modem hangup
Connect time 0.5 minutes.
Sent 286 bytes, received 356 bytes.
Connection terminated.

mary 发表于 2012-4-17 17:23:33

蓟州侯 发表于 2012-4-18 08:59:45

pmcf1988 发表于 2012-8-13 13:39:14

鹰隼 发表于 2012-9-11 18:37:52

manhuazhiwu 发表于 2012-12-18 15:21:03

飞凌-unix 发表于 2012-12-20 11:23:10

关注楼主问题……

安电 发表于 2014-3-13 16:14:00

页: [1]
查看完整版本: 3G 拨号问题