Chinaunix

标题: 3G上网卡在linux上使用的完整文档(3G for linux) [打印本页]

作者: wushi8    时间: 2010-04-29 13:20
标题: 3G上网卡在linux上使用的完整文档(3G for linux)
本帖最后由 wushi8 于 2010-04-29 20:47 编辑

文档内容小弟修改了多次,确保内容简洁易懂。

这也是小弟第一次发贴,希望这个对大家有用!!

3G for Linux.pdf (109.33 KB, 下载次数: 4307)
作者: Celinde    时间: 2010-04-29 13:34
白激动了,我的这个好像还是没戏{:3_193:}


Bus 006 Device 004: ID 04e8:6640 Samsung Electronics Co., Ltd Usb Modem Enumerator
作者: wushi8    时间: 2010-04-29 13:44
回复 2# Celinde


    你的这个ID在官方文档里确实没有提供,你可以参照04e8:f000这个设置一下看行不行,如果不行的话那只能先在Windows上面抓取target ID了,你可以在网上搜搜怎么抓这个ID。
作者: Celinde    时间: 2010-04-29 14:00
等等,Samsung Electronics Co., Ltd Usb Modem Enumerator,这不已经认出来是Modem了

发现我内核里USB Modem 没选,等下在试试,现在要去逛街了
作者: wushi8    时间: 2010-04-29 15:20
回复 4# Celinde


    出现modem也不一定是成功了,有可能是你的target ID不对,你看看/dev/tty 有没有增加设备,如果增加了表示成功,如果没有说明还没有成功,不需要重新编译内核的,重新编译内核是另一种方法,那跟我的这种方法就没有多大关系了。
作者: Celinde    时间: 2010-04-29 16:04
回复 5# wushi8


   
我内核不支持USB Modem ,所以就算linux可以支持这个手机里的Modem ,也不会出现设备。
作者: Celinde    时间: 2010-04-29 18:12
OK,拨上去了{:3_192:}

内核里开了CONFIG_USB_ACM选项,然后用ppp拨号。
作者: wushi8    时间: 2010-04-29 20:46
回复 7# Celinde


    你用的什么系统?什么版本啊?
作者: Celinde    时间: 2010-04-29 21:04
gentoo ,kernel 2.6.33 。。
  1.                           Linux ACM driver v0.16
  2.                  (c) 1999 Vojtech Pavlik <[email]vojtech@suse.cz[/email]>
  3.                              Sponsored by SuSE
  4. ----------------------------------------------------------------------------

  5. 0. Disclaimer
  6. ~~~~~~~~~~~~~
  7.   This program is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your option)
  10. any later version.

  11.   This program is distributed in the hope that it will be useful, but
  12. WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  13. or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  14. more details.

  15.   You should have received a copy of the GNU General Public License along
  16. with this program; if not, write to the Free Software Foundation, Inc., 59
  17. Temple Place, Suite 330, Boston, MA 02111-1307 USA

  18.   Should you need to contact me, the author, you can do so either by e-mail
  19. - mail your message to <[email]vojtech@suse.cz[/email]>, or by paper mail: Vojtech Pavlik,
  20. Ucitelska 1576, Prague 8, 182 00 Czech Republic

  21.   For your convenience, the GNU General Public License version 2 is included
  22. in the package: See the file COPYING.

  23. 1. Usage
  24. ~~~~~~~~
  25.   The drivers/usb/class/cdc-acm.c drivers works with USB modems and USB ISDN terminal
  26. adapters that conform to the Universal Serial Bus Communication Device Class
  27. Abstract Control Model (USB CDC ACM) specification.

  28.   Many modems do, here is a list of those I know of:

  29.         3Com OfficeConnect 56k
  30.         3Com Voice FaxModem Pro
  31.         3Com Sportster
  32.         MultiTech MultiModem 56k
  33.         Zoom 2986L FaxModem
  34.         Compaq 56k FaxModem
  35.         ELSA Microlink 56k

  36.   I know of one ISDN TA that does work with the acm driver:

  37.         3Com USR ISDN Pro TA

  38.   Some cell phones also connect via USB. I know the following phones work:

  39.         SonyEricsson K800i

  40.   Unfortunately many modems and most ISDN TAs use proprietary interfaces and
  41. thus won't work with this drivers. Check for ACM compliance before buying.

  42.   To use the modems you need these modules loaded:

  43.         usbcore.ko
  44.         uhci-hcd.ko ohci-hcd.ko or ehci-hcd.ko
  45.         cdc-acm.ko

  46.   After that, the modem[s] should be accessible. You should be able to use
  47. minicom, ppp and mgetty with them.

  48. 2. Verifying that it works
  49. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  50.   The first step would be to check /proc/bus/usb/devices, it should look
  51. like this:

  52. T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
  53. B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
  54. D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
  55. P:  Vendor=0000 ProdID=0000 Rev= 0.00
  56. S:  Product=USB UHCI Root Hub
  57. S:  SerialNumber=6800
  58. C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
  59. I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
  60. E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms
  61. T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
  62. D:  Ver= 1.00 Cls=02(comm.) Sub=00 Prot=00 MxPS= 8 #Cfgs=  2
  63. P:  Vendor=04c1 ProdID=008f Rev= 2.07
  64. S:  Manufacturer=3Com Inc.
  65. S:  Product=3Com U.S. Robotics Pro ISDN TA
  66. S:  SerialNumber=UFT53A49BVT7
  67. C:  #Ifs= 1 Cfg#= 1 Atr=60 MxPwr=  0mA
  68. I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=acm
  69. E:  Ad=85(I) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
  70. E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
  71. E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=128ms
  72. C:* #Ifs= 2 Cfg#= 2 Atr=60 MxPwr=  0mA
  73. I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=acm
  74. E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=128ms
  75. I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=acm
  76. E:  Ad=85(I) Atr=02(Bulk) MxPS=  64 Ivl=  0ms
  77. E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=  0ms

  78. The presence of these three lines (and the Cls= 'comm' and 'data' classes)
  79. is important, it means it's an ACM device. The Driver=acm means the acm
  80. driver is used for the device. If you see only Cls=ff(vend.) then you're out
  81. of luck, you have a device with vendor specific-interface.

  82. D:  Ver= 1.00 Cls=02(comm.) Sub=00 Prot=00 MxPS= 8 #Cfgs=  2
  83. I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=acm
  84. I:  If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=acm

  85. In the system log you should see:

  86. usb.c: USB new device connect, assigned device number 2
  87. usb.c: kmalloc IF c7691fa0, numif 1
  88. usb.c: kmalloc IF c7b5f3e0, numif 2
  89. usb.c: skipped 4 class/vendor specific interface descriptors
  90. usb.c: new device strings: Mfr=1, Product=2, SerialNumber=3
  91. usb.c: USB device number 2 default language ID 0x409
  92. Manufacturer: 3Com Inc.
  93. Product: 3Com U.S. Robotics Pro ISDN TA
  94. SerialNumber: UFT53A49BVT7
  95. acm.c: probing config 1
  96. acm.c: probing config 2
  97. ttyACM0: USB ACM device
  98. acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0
  99. acm.c: acm_control_msg: rq: 0x20 val: 0x0 len: 0x7 result: 7
  100. usb.c: acm driver claimed interface c7b5f3e0
  101. usb.c: acm driver claimed interface c7b5f3f8
  102. usb.c: acm driver claimed interface c7691fa0

  103. If all this seems to be OK, fire up minicom and set it to talk to the ttyACM
  104. device and try typing 'at'. If it responds with 'OK', then everything is
  105. working.
复制代码

作者: Celinde    时间: 2010-04-29 21:09
在CONFIG_USB_SERIAL 子类里面也还有些手机Modem的驱动,比较乱,
作者: wushi8    时间: 2010-04-30 07:12
回复 9# Celinde


    你的这个系统内核非常新了,就像你说的,直接重新编译内核就可以让它支持usb modem了,这个方法也很不错,不过现在大部分linux系统内核还是比较旧的,所以只能通过usb-modswitch来转成modem了。
作者: beyondfly    时间: 2010-05-03 21:01
看来只能通过安装比较新的linux内核,重新编译内核来解决问题咯
作者: mobile8    时间: 2010-05-03 21:33
这个,是很棒!ZTE的猫,是有Linux驱动和客户端的,可以用用。
作者: 高北流    时间: 2010-05-12 22:00
这个我喜欢,一定要

作者: tianxin1017    时间: 2010-05-13 15:10
不管怎么样,跪谢。
作者: liugang9931706    时间: 2010-06-08 01:52
你们咋这么快搞定了,我有两款上网卡,搞了N久,好不容易认出modem,目前抓包看,AT命令大致是可以跟windows下一样,卡没钱,测不了。不知道能否真的能通。
用ppp拨号时脚本死活不行,只能自己写执行AT命令的程序,我的脚本运行时抓包为如下:
27.3  DI     01 60                                               .`                       1.1.0(6)     
  27.4  DO     41                                                  A                        7.1.0        
  27.4  DO     54                                                  T                        8.1.0        
  27.3  DI     01 60                                               .`                       9.1.0        
  27.4  DO     72                                                  r                       10.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            11.1.0        
  27.4  DO     0d                                                  .                       12.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            13.1.0        
  27.3  DI     01 60                                               .`                      14.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            15.1.0(2)     
  27.3  DI     01 60                                               .`                      17.1.0(13)   
  27.4  DO     2b                                                  +                       30.1.0(3)     
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            33.1.0        
  27.3  DI     01 60                                               .`                      34.1.0        
  27.4  DO     20                                                                          35.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            36.1.0        
  27.4  DO     63                                                  c                       37.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            38.1.0        
  27.3  DI     01 60                                               .`                      39.1.0        
  27.4  DO     0d                                                  .                       40.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            41.1.0        
  27.4  DO     41                                                  A                       42.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            43.1.0        
  27.3  DI     01 60                                               .`                      44.1.0        
  27.4  DO     54                                                  T                       45.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            46.1.0        
  27.4  DO     48                                                  H                       47.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            48.1.0        
  27.3  DI     01 60                                               .`                      49.1.0        
  27.4  DO     30                                                  0                       50.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            51.1.0        
  27.4  DO     0d                                                  .                       52.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            53.1.0        
  27.3  DI     01 60                                               .`                      54.1.0        
  27.3  DI     01 60 0d 0a  45 52 52 4f  52 0d 0a 00               .`..ERROR...            55.1.0(2)     
  27.3  DI     01 60                                               .`                      57.1.0(14   
参照网上的脚本,查阅AT命令文档,不知网卡如何处理的AT命令,有经验能不能分析下,上网卡这样的回复是什么问题,为什么自己直接用程序发送就能OK,以后要用脚本该如何写???
作者: wushi8    时间: 2010-07-04 15:04
回复 16# liugang9931706


    你为什么要自己写拨号脚本呢,已经有现成了,而且非常好用,你可以按文档里先试试,顺便问一下,你用的3G卡是什么型号的啊?
作者: icyomik    时间: 2011-06-09 20:33
我想知道怎么可以在Linux下查看剩余流量。。。
作者: jchaodong    时间: 2011-07-06 11:29
谢谢分享!刚好要做linux下的3G上网功能
作者: zjsx133    时间: 2011-09-14 11:01
谢谢楼主了
作者: dzminglong    时间: 2011-09-14 20:23
我用电信的g3在fedora 15上反正是没有成功。。。。。。。
作者: zhyustar    时间: 2011-11-09 17:59
请教下楼主,在转化成的modem设备,如何能确定这个设备是ttyUSB0还是其他的。
文档中有写查看/dev/下是不是有多出的设备,有没有其他的办法能查看?
谢谢




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2