3G无线上网卡在Linux下的使用


首先,这是一个比较简单的问题,我是在Linux下和Windows下作了一个对比

1,Windows下第一次插入该猫的时候,会以一个usb外接存储设备显示出来,并且看上去是一个CD-ROM的Media设备,当在Windows下安装完电信的拨号程序以后,这个CDROM的设备就不见了,然后打开Windows的超级终端,会看到三个新的串口设备

2,在Linux下,无论什么时候插入该猫的时候,都会是一个usb外接存储设备显示出来,并且看上去是一个CD-ROM的Media设备

然后通过cat /proc/kmsg获得相关调试信息,我使用的kernel是加了kernel hacking选项的,也就是说,打印信息会多点,方便调试,看到如下信息:

  1. [root@localhost liuqi]# cat /proc/kmsg
  2. <7>[ 173.96809]ubub:ubrsm
  3. 7[ 7.610 hihd00:01.:rsm othb10 u_eue<> 13980]ec_c 000:d7 eSau ot2sau 083PWRsgjCCCNET<> 13983]hb2010 ot2 tts00 hne00
  4. 6cg04et00
  5. 7[ 7.837 u -:.:pr ,sau 51 hne00,40M/
  6. <7>[ 174.158650] Monitor-Mwait will be used to enter C-3 state
  7. <7>[ 174.177594] hub 6-0:1.0: hub_resume
  8. <7>[ 174.177645] uhci_hcd 0000:00:1d.0: port 2 portsc 0093,00
  9. <7>[ 174.177654] hub 6-0:1.0: port2:sau 11cag 01<>[ 7.914 hihd00:01.:Gtttspr tts030 OE WE i=e S
  10. 7[ 7.929 u -:.: state 7 ports 6 chg 0000 evt 0004
  11. 0 v 00<> 14284]hb6010 ot2 tts00,cag 00 2M/
  12. <6>[ 174.380245 s -:nwfl pe S eieuiguc_c n drs
  13. <7>[ 174.516276] usb 6-2: default language 0x0409
  14. <7>[ 174.531319] usb 6-2: udev 2, busnum 6, minor = 641
  15. <6>[ 174.531327] usb 6-2: New USB device found, idVendor=05c6, idProduct=2001
  16. <6>[ 174.531334] usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
  17. <6>[ 174.531341] usb 6-2: Product: USB MMC Storage
  18. <6>[ 174.531347] usb 6-2: Manufacturer: Qualcomm, Incorporated
  19. <6>[ 174.531352] usb 6-2: SerialNumber: Mass Storage
  20. <7>[ 174.536313] usb 6-2: adding 6-2:1.0 (config #1, interface 0)
  21. <7>[ 174.536933] usb 6-2:1.0: uevent
  22. <7>[ 174.537241] usb-storage 6-2:1.0: usb_probe_interface
  23. <7>[ 174.537254] usb-storage 6-2:1.0: usb_probe_interface - got id
  24. <7>[ 174.537262] usb-storage: USB Mass Storage device detected
  25. bsoae rtcl rnprn CI<7>[ 174.546717] usb-storage: *** thread sleeping.
  26. <7>[ 174.547697] usb-storage 6-2:1.0: device found
  27. <7>[ 174.547700] usb-storage 6-2:1.0: waiting for device to settle before scanning
  28. <7>[ 174.548539] drivers/usb/core/inode.c: creating file '002'
  29. :qf rtp=1vle00 ne=0ln1<7>[ 179.549322] usb-storage: GetMaxLUN comadrsl s1 aai
  30. 7[ 7.460 s-trg:qeeomn ald<> 19593]ubsoae * hedaaee.<> 19594]ubsoae omn NUR 6bts
  31. 7[ 7.463 s-trg: 20 00 40
  32. 7[ 7.469 s-trg:Bl omn x3235T01L3 2 r U L6<> 1959<7>[ 179.550289] usb-stora:Sttscd ;taserd3/1<> 19509]ubsoae -tase opee<> 19509]ubsoae ukcmadtase eut0<> 19509]ubsoae s_trbl_rnfrsls:xe 6bts nre
  33. <7>[ 179.551311] usb-storae ttscd ;taserd3/6<> 19511]ubsoae -tase opee<> 19511]ubsoae ukdt rnfrrsl x
  34. 7[ 7.536 s-trg:Atmtn ogtCW.
  35. 7[ 7.538 s-trg:ubso_uktase_u:xe 3bts<7>[ 179.552303] usb-storage: Status code 0; transferred 13/13
  36. <7>[ 179.552305] usb-storage: -- transfer complete
  37. <7>[ 179.552307] usb-storage: Bulk status result = 0
  38. <7>[ 179.552309] usb-storage: Bulk Status S 0x53425355 T 0x1 R 0 Stat 0x0
  39. <7>[ 179.552312] usb-storage: scsi cmd done, result=0x0
  40. <7>[ 179.552316] usb-storage: *** thread sleeping.
  41. <5>[ 179.552403] scsi 2:0:0:0: CD-ROM D-Link CDROM 2.31 PQ: 0 ANSI: 2
  42. <7>[ 179.553240] usb-storage: queuecommand called
  43. <7>[ 179.554294] usb-storage: Status code 0; transferred 31/31
  44. <7>[ 179.554296] usb-storage: -- transfer complete
  45. <7>[ 179.554298] usb-storage: Bulk command transfer result=0
  46. <7>[ 179.554300] usb-storage: Attempting to get CSW...
  47. <7>[ 179.554302] usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
  48. <7>[ 179.556287] usb-storage: Status code 0; transferred 31/31
  49. <7>[ 179.556289] usb-storage: -- transfer complete
  50. <7>[ 179.556291] usb-storage: Bulk command transfer result=0
  51. <7>[ 179.556293] usb-storage: usb_stor_bulk_transfer_sglist: xfer 18 bytes, 1 entries
  52. <7>[ 179.558286] usb-storage: Status code 0; transferred 13/13
  53. <7>[ 179.558288] usb-storage: -- transfer complete
  54. <7>[ 179.558290] usb-storage: Bulk status result = 0
  55. <7>[ 179.558298] usb-storage: Bulk Status S 0x53425355 T 0x3 R 0 Stat 0x0
  56. <7>[ 179.558300] usb-storage: -- Result from auto-sense is 0
  57. <7>ChinaUnix T-bagwell
  58. <7>[ 179.558302] usb-storage: -- code: 0x70, key: 0x6, ASC: 0x28, ASCQ: 0x0
  59. <7>[ 179.558305] usb-storage: Unit Attention: Not ready to ready change, medium may have changed
  60. <7>[ 179.558309] usb-storage: scsi cmd done, result=0x2
  61. <7>[ 179.558313] usb-storage: *** thread sleeping.
  62. <7>[ 179.558392] usb-storage: queuecommand called
  63. <7>[ 179.558398] usb-storage: *** thread awakened.
  64. <7>[ 179.558401] usb-storage: Command TEST_UNIT_READY (6 bytes)
  65. <7>[ 179.558402] usb-storage: 00 00 00 00 00 00
  66. <7>[ 179.558408] usb-storage: Bulk Command S 0x43425355 T 0x4 L 0 F 0 Trg 0 LUN 0 CL 6
  67. <7>[ 179.558410] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
  68. <7>[ 179.560357] usb-storage: Status code 0; transferred 13/13
  69. <7>[ 179.560359] usb-storage: -- transfer complete
  70. <7>[ 179.560361] usb-storage: Bulk status result = 0
  71. <7>[ 179.560363] usb-storage: Bulk Status S 0x53425355 T 0x4 R 0 Stat 0x0
  72. <7>[ 179.560366] usb-storage: scsi cmd done, result=0x0
  73. <7>[ 179.560370] usb-storage: *** thread sleeping.
  74. <7>[ 179.560510] usb-storage: queuecommand called
  75. <7>[ 179.560530] usb-storage: *** thread awakened.
  76. <7>[ 179.560533] usb-storage: Command MODE_SENSE_10 (10 bytes)
  77. <7>[ 179.560534] usb-storage: 5a 00 2a 00 00 00 00 00 80 00
  78. <7>[ 179.560543] usb-storage: Bulk Command S 0x43425355 T 0x5 L 128 F 128 Trg 0 LUN 0 CL 10
  79. <7>[ 179.560545] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
  80. <7>[ 179.562299] usb-storage: Status code -121; transferred 32/128
  81. <7>[ 179.562301] usb-storage: -- short read trase
  82. 7[ 7.633 s-trg:Bl aatase eut01<> 19520]ubsoae tepigto get CSW...
  83. <7>[ 179.562307] usb-storage:ubso_uktase_u:xe 3bts=0 ne=3ln0<7>[ 179.565286] usb-storage: Status code 0; transferred 13/13
  84. <7>[ 179.565288] usb-storage: -- transfer complete
  85. <7>[ 179.565290] usb-storage: Bulk status result = 0
  86. <7>[ 179.565292] usb-storage: Bulk Status S 0x53425355 T 0x5 R 96 Stat 0x0
  87. <7>[ 179.565295] usb-storage: scsi cmd done, result=0x0
  88. <7>[ 179.565300] usb-storage: *** thread sleeping.
  89. <4>[ 179.565360] sr0: scsi3-mmc drive: 8x/40x writer xa/form2 cdda tray
  90. <6>[ 179.565369] Uniform CD-ROM driver Revision: 3.20
  91. <7>[ 179.566915] sr 2:0:0:0: Attached scsi CD-ROM sr0
  92. <5>[ 179.567541] sr 2:0:0:0: Attached scsi generic sg1 type 5
  93. <7>[ 179.569524] usb-storage: queuecommand called
  94. <7>[ 179.569531] usb-storage: *** thread awakened.
  95. <7>[ 179.569533] usb-storage: Bad target number (3:0)
  96. <7>[ 179.569535] usb-storage: scsi cmd done, result=0x40000
  97. <7>[ 179.569538] usb-storage: *** thread sleeping.

  98. .........................
  99. ^C

然后ls /dev就可以看到一些关键设备,比如sr0

  1. [root@localhost liuqi]# ls /dev/
  2. 0:0:0:0 dsp loop4 pcmC0D0c random stdout tty28 tty50 usb3 vcs1
  3. adsp event0 loop5 pcmC0D0p rfkill systty tty29 tty51 usb4 vcs2
  4. agpgart event1 loop6 pcmC0D1p root timer tty3 tty52 usb5 vcs3
  5. audio event2 loop7 port rtc tty tty30 tty53 usb6 vcs4
  6. bsg event3 lp0 ppp rtc0 tty0 tty31 tty54 usb7 vcs5
  7. btrfs-control event4 lp1 ptmx scd0 tty1 tty32 tty55 usb8 vcs6
  8. bus event5 lp2 pts sda tty10 tty33 tty56 usbdev1.1 vcsa
  9. cachefiles event6 lp3 ram sda1 tty11 tty34 tty57 usbdev2.1 vcsa1
  10. card0 fb MAKEDEV ram0 sda2 tty12 tty35 tty58 usbdev3.1 vcsa2
  11. cdrom fb0 mapper ram1 sda5 tty13 tty36 tty59 usbdev4.1 vcsa3
  12. cdrw fb1 mcelog ram10 sda6 tty14 tty37 tty6 usbdev5.1 vcsa4
  13. console fd mem ram11 sda7 tty15 tty38 tty60 usbdev6.1 vcsa5
  14. controlC0 full mice ram12 sda8 tty16 tty39 tty61 usbdev6.2 vcsa6
  15. core fuse microcode ram13 sda9 tty17 tty4 tty62 usbdev7.1 vga_arbiter
  16. cpu gpmctl mixer ram14 seq tty18 tty40 tty63 usbdev8.1 XOR
  17. cpu0 hpet mouse0 ram15 sequencer tty19 tty41 tty7 usbmon0 zero
  18. cpu1 hwC0D0 mouse1 ram2 sequencer2 tty2 tty42 tty8 usbmon1
  19. cpu_dma_latency input msr0 ram3 sg0 tty20 tty43 tty9 usbmon2
  20. cuse kmem msr1 ram4 sg1 tty21 tty44 ttyS0 usbmon3
  21. device-mapper kmsg net ram5 shm tty22 tty45 ttyS1 usbmon4
  22. disk log network_latency ram6 snapshot tty23 tty46 ttyS2 usbmon5
  23. dlm-control loop0 network_throughput ram7 snd tty24 tty47 ttyS3 usbmon6
  24. dlm-monitor loop1 null ram8 sr0 tty25 tty48 urandom usbmon7
  25. dlm_plock loop2 ocfs2_control ram9 stderr tty26 tty49 usb1 usbmon8
  26. dri loop3 oldmem ramdisk stdin tty27 tty5 usb2 vcs

然后lsusb可以看到我们的新usb的相关信息

  1. [root@localhost liuqi]# lsusb
  2. Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  3. Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  4. Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  5. Bus 006 Device 004: ID 05c6:2001 Qualcomm, Inc.
  6. Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  7. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  8. Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  9. Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  10. Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

可以看出来,关键的是:

  1. Bus 006 Device 004: ID 05c6:2001 Qualcomm, Inc.

可以看到,其

  1. Vendor: 05c6 ProductID:2001

其实这个就是我们刚才看到的/dev/sr0相对应的usb的信息

可以说,之前说过的都等于白说,仅仅是一些信息的获得,经过观察可以看出来,在Windows下安装完拨号程序以后,就看不到cdrom了,这个时候就可以看到串口设备了,那么可以总结,应该是有一个将cdrom给弹出来了,这个时候使用了一下如下命令

  1. eject /dev/sr0

这样就把Media弹出了,然后再lsusb看一下


  1. [root@localhost liuqi]# lsusb
  2. Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  3. Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  4. Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  5. Bus 006 Device 005: ID 1e0e:ce16
  6. Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  7. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  8. Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  9. Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  10. Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

这回好了,看到结果了,

  1. Bus 006 Device 005: ID 1e0e:ce16

结果就是,这个usb的VendorID: 1e0e ProductID:ce16

看了一下kernel的源代码,这个Vendorid和ProductID是支持的
我的kernel是比较新的,这个驱动对应的patch应该还是国内的某兄台提交的,所以,支持是没有问题的
然后看一下/dev/下的设备

  1. [root@localhost liuqi]# ls /dev/
  2. 0:0:0:0 dri loop0 msr1 ram15 sda9 tty14 tty34 tty54 usb1 usbmon5
  3. adsp dsp loop1 net ram2 sdb tty15 tty35 tty55 usb2 usbmon6
  4. agpgart event0 loop2 network_latency ram3 seq tty16 tty36 tty56 usb3 usbmon7
  5. audio event1 loop3 network_throughput ram4 sequencer tty17 tty37 tty57 usb4 usbmon8
  6. bsg event2 loop4 null ram5 sequencer2 tty18 tty38 tty58 usb5 vcs
  7. btrfs-control event3 loop5 ocfs2_control ram6 sg0 tty19 tty39 tty59 usb6 vcs1
  8. bus event4 loop6 oldmem ram7 sg1 tty2 tty4 tty6 usb7 vcs2
  9. cachefiles event5 loop7 pcmC0D0c ram8 shm tty20 tty40 tty60 usb8 vcs3
  10. card0 event6 lp0 pcmC0D0p ram9 snapshot tty21 tty41 tty61 usbdev1.1 vcs4
  11. console fb lp1 pcmC0D1p ramdisk snd tty22 tty42 tty62 usbdev2.1 vcs5
  12. controlC0 fb0 lp2 port random stderr tty23 tty43 tty63 usbdev3.1 vcs6
  13. core fb1 lp3 ppp rfkill stdin tty24 tty44 tty7 usbdev4.1 vcsa
  14. cpu fd MAKEDEV ptmx root stdout tty25 tty45 tty8 usbdev5.1 vcsa1
  15. cpu0 full mapper pts rtc systty tty26 tty46 tty9 usbdev6.1 vcsa2
  16. cpu1 fuse mcelog ram rtc0 timer tty27 tty47 ttyS0 usbdev6.3 vcsa3
  17. cpu_dma_latency gpmctl mem ram0 sda tty tty28 tty48 ttyS1 usbdev7.1 vcsa4
  18. cuse hpet mice ram1 sda1 tty0 tty29 tty49 ttyS2 usbdev8.1 vcsa5
  19. device-mapper hwC0D0 microcode ram10 sda2 tty1 tty3 tty5 ttyS3 usbmon0 vcsa6
  20. disk input mixer ram11 sda5 tty10 tty30 tty50 ttyUSB0 usbmon1 vga_arbiter
  21. dlm-control kmem mouse0 ram12 sda6 tty11 tty31 tty51 ttyUSB1 usbmon2 XOR
  22. dlm-monitor kmsg mouse1 ram13 sda7 tty12 tty32 tty52 ttyUSB2 usbmon3 zero
  23. dlm_plock log msr0 ram14 sda8 tty13 tty33 tty53 urandom usbmon4
  24. [root@localhost liuqi]#

多了三个串口设备,这样就对了,接下来就可以使用串口设备了

使用minicom先试试哪个串口好用




  1. +CSQ:31, 99

  2. OK

  3. +CGMR: P1.0 DLink_DWM-162-U5_V1.0

  4. OK

  5. ^HRSSILVL:99

  6. ^HRSSILVL:80

通过AT指令可以看出来,可以玩了,接下来设置一下conf就可以了,这个在网上应该可以找到各种方法来连接,其实都是at指令来配一下而已

  • 1
  • 2
  • 下一页

相关内容