查看: 2968|回复: 0

[Linux技术] 3G 拨号问题

[复制链接]
  • TA的每日心情

    2014-4-10 13:56
  • 签到天数: 5 天

    连续签到: 1 天

    [LV.2]偶尔看看I

    发表于 2014-3-14 14:53:45 | 显示全部楼层 |阅读模式
    分享到:
    环境Linux3.0.1
    3G模块ZTE AC2726   电信CDMA2000
    1..插上3G模块后,/dev下增加一个usbdev1.1,并没有出现ttyUSB0~ttyUSB4.使用./pppd call cdma2000,提示
    [root@FORLINX6410]# pwd
    /opt/3G/bin
    [root@FORLINX6410]# ./pppd call cdma2000
    ./pppd: In file /etc/ppp/peers/cdma2000: unrecognized option '/dev/ttyUSB0'
    2.应该是驱动没有正常安装。但是运行官方提供的3GDialup后,系统就会提示
    [root@FORLINX6410]# 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: [sda] 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
    [root@FORLINX6410]# 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
    [root@FORLINX6410]# Modem hangup
    Connect time 3.0 minutes.
    Sent 13222 bytes, received 13308 bytes.
    Connection terminated.

    [1] + Done(16)                   ./pppd call cdma2000
    [root@FORLINX6410]# ifconfig
    [root@FORLINX6410]#



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


    通过分析官方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.其中状态框中的内容就是从终端上读出的内容放到了文本框中(不知道这句话对不对)


    就剩下最后一个问题了,网络拨通之后不和某个Server保持连接,自动就会断开。如果一直ping 某个server也不会断,一旦停止ping ,停几秒就断。提示如次:
    PAP authentication succeeded
    local  IP 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

    [root@FORLINX6410]# 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
    [root@FORLINX6410]# Modem hangup
    Connect time 0.5 minutes.
    Sent 286 bytes, received 356 bytes.
    Connection terminated.





    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /5 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-12-24 08:43 , Processed in 0.106385 second(s), 15 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.