CDMA2000 3G Chat 拨号

来源:互联网 发布:c语言中逗号运算符 编辑:程序博客网 时间:2024/06/04 08:20

使用CDMA2000 3G拨号

  1. 加载驱动
    [plain] view plaincopy
    1. insmod usbserial vendor=0x#### product=0x####  

  2. 查看驱动是否加载正常
    1. 查看驱动
      [plain] view plaincopy
      1. T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=12  MxCh= 0  
      2. D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1  
      3. P:  Vendor=2077 ProdID=7000 Rev= 0.00  
      4. S:  Manufacturer=TW  
      5. S:  Product=TW  COMMON  
      6. C:* #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=500mA  
      7. I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic  
      8. E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=128ms  
      9. E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms  
      10. E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms  
      11. I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic  
      12. E:  Ad=84(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms  
      13. E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms  
      14. I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic  
      15. E:  Ad=86(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms  
      16. E:  Ad=06(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms  

    2. 查看设备是否有ttyUSB0
      [plain] view plaincopy
      1. /tmp # ls /dev  
      2. 1-1        mtd1ro     null       ptyp6      tty        ttyp4      urandom  
      3. 1-1.2      mtd2       nvram      ptyp7      ttyS0      ttyp5      usb1  
      4. console    mtd2ro     port       ptyp8      ttyS1      ttyp6      usb2  
      5. full       mtd3       ppp        ptyp9      ttyS2      ttyp7      usbdev1.1  
      6. gpio       mtd3ro     ptmx       ptypa      ttyS3      ttyp8      usbdev1.2  
      7. kmem       mtd4       pts        ptypb      ttyUSB0    ttyp9      usbdev1.3  
      8. kmsg       mtd4ro     ptyp0      ptypc      ttyUSB1    ttypa      usbdev2.1  
      9. log        mtdblock0  ptyp1      ptypd      ttyUSB2    ttypb      zero  
      10. mem        mtdblock1  ptyp2      ptype      ttyp0      ttypc  
      11. mtd0       mtdblock2  ptyp3      ptypf      ttyp1      ttypd  
      12. mtd0ro     mtdblock3  ptyp4      random     ttyp2      ttype  
      13. mtd1       mtdblock4  ptyp5      shm        ttyp3      ttypf  
      14. /tmp #   

  3. 使用atcmd(自己写的串口小程序)查看at+csq回应信号强度
    [plain] view plaincopy
    1. /tmp # ./atcmd -f /dev/ttyUSB2 at+csq  
    2. use 115200bps to setup modem   
    3.   
    4. [COMMAND]:  
    5.   at+csq  
    6.   
    7. [RESPONSE]:  
    8.   at+csq  
    9.   +CSQ:18,99  
    10.     
    11.   OK  
    12. /tmp #   
  4. 编写chat脚本,名称为chat-cdma
    [plain] view plaincopy
    1. TIMEOUT 5  
    2. ABORT "DELAYED"  
    3. ABORT "BUSY"  
    4. ABORT "ERROR"  
    5. ABORT "NO DIALTONE"  
    6. ABORT "NO CARRIER"  
    7. ''   AT  
    8. 'OK-+++\c-OK' ATH0  
    9. TIMEOUT 40  
    10. '' AT  
    11. OK ATDT#777  
    12. CONNECT ''  

  5. 编写pppd脚本,名称为 cdma2000
    [plain] view plaincopy
    1. /dev/ttyUSB0   
    2. 115200   
    3. crtscts   
    4. modem   
    5. debug   
    6. nodetach  
    7. usepeerdns  
    8. defaultroute  
    9. user "card"  
    10. password "card"  
    11. 0.0.0.0:0.0.0.0  
    12. connect '/usr/sbin/chat -s -v -f /tmp/chat-cdma'  

  6. 开始拨号
    [plain] view plaincopy
    1. pppd file cdma2000 &  

  7. 应该有如下信息
    [plain] view plaincopy
    1. /tmp # pppd file cdma200 &  
    2. /tmp # speed 115200 not supported  
    3. timeout set to 5 seconds  
    4. abort on (DELAYED)  
    5. abort on (BUSY)  
    6. abort on (ERROR)  
    7. abort on (NO DIALTONE)  
    8. abort on (NO CARRIER)  
    9. send (AT^M)  
    10. expect (OK)  
    11. AT^M^M  
    12. OK  
    13.  -- got it  
    14.   
    15. send (ATH0^M)  
    16. timeout set to 40 seconds  
    17. send (AT^M)  
    18. expect (OK)  
    19. ^M  
    20. ATH0^M^M  
    21. OK  
    22.  -- got it  
    23.   
    24. send (ATDT#777^M)  
    25. expect (CONNECT)  
    26. ^M  
    27. AT^M^M  
    28. OK^M  
    29. ATDT#777^M^M  
    30. ^M  
    31. CONNECT  
    32.  -- got it  
    33.   
    34. send (^M)  
    35. Script /usr/sbin/chat -s -v -f /tmp/chat-cdma finished (pid 646), status = 0x0  
    36. Serial connection established.  
    37. speed 115200 not supported  
    38. using channel 1  
    39. Using interface ppp0  
    40. Connect: ppp0 <--> /dev/ttyUSB0  
    41. hotplug net INTERFACE=ppp0 ACTION=add  
    42. rcvd [LCP ConfReq id=0x0 <mru 1444> <asyncmap 0x0> <auth chap MD5> <magic 0x612bb048> <pcomp> <accomp>]  
    43. sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xefc224ff> <pcomp> <accomp>]  
    44. sent [LCP ConfAck id=0x0 <mru 1444> <asyncmap 0x0> <auth chap MD5> <magic 0x612bb048> <pcomp> <accomp>]  
    45. rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xefc224ff> <pcomp> <accomp>]  
    46. rcvd [CHAP Challenge id=0x1 <b820149be6070f8a8a8d63ed868b9353>, name = "JSTELECOM"]  
    47. sent [CHAP Response id=0x1 <692583c8ff95bf1e046e2306e76db352>, name = "card"]  
    48. rcvd [CHAP Success id=0x1 "Welcome to JSTELECOM."]  
    49. CHAP authentication succeeded: Welcome to JSTELECOM.  
    50. CHAP authentication succeeded  
    51. sent [CCP ConfReq id=0x1 <mppe -H -M -S -L -D +C>]  
    52. sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 192.168.1.1> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]  
    53. rcvd [IPCP ConfReq id=0x0 <addr 172.25.8.43>]  
    54. sent [IPCP ConfAck id=0x0 <addr 172.25.8.43>]  
    55. rcvd [LCP ProtRej id=0x1 80 fd]  
    56. Protocol-Reject for 'Compression Control Protocol' (0x80fd) received  
    57. rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]  
    58. sent [IPCP ConfReq id=0x2 <addr 192.168.1.1> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]  
    59. rcvd [IPCP ConfNak id=0x2 <addr 10.133.198.30> <ms-dns1 61.177.7.1> <ms-dns2 218.2.135.1>]  
    60. sent [IPCP ConfReq id=0x3 <addr 10.133.198.30> <ms-dns1 61.177.7.1> <ms-dns2 218.2.135.1>]  
    61. rcvd [IPCP ConfAck id=0x3 <addr 10.133.198.30> <ms-dns1 61.177.7.1> <ms-dns2 218.2.135.1>]  
    62. not replacing existing default route via 192.168.3.254  
    63. local  IP address 10.133.198.30  
    64. remote IP address 172.25.8.43  
    65. primary   DNS address 61.177.7.1  
    66. secondary DNS address 218.2.135.1  
    67. Script /tmp/ppp/ip-up started (pid 662)  
    68. ipup_main():: /tmp/ppp/ip-up  
    69. ipup_main: argc=6.  
    70. ipup_main: argv[1]=ppp0.  
    71. ipup_main: argv[2]=/dev/ttyUSB0.  
    72. ipup_main: argv[3]=9600.  
    73. ipup_main: argv[4]=10.133.198.30.  
    74. ipup_main: argv[5]=172.25.8.43.  
    75. ipup_main: pppd_pid=645.  
    76. ipup_main: DEVICE=/dev/ttyUSB0.  
    77. ipup_main: PPPLOGNAME=admin.  
    78. ipup_main: LINKNAME=.  
    79. ipup_main: BUNDLE=.  
    80. ipup_main: MACREMOTE=.  
    81. ipup_main: PEERNAME=.  
    82. Script /tmp/ppp/ip-up finished (pid 662), status = 0x0  

  8. 拨号成功

0 0
原创粉丝点击