前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用电信3G猫在Linux下上网办法

使用电信3G猫在Linux下上网办法

作者头像
用户3765803
发布2019-03-05 10:06:11
1.2K0
发布2019-03-05 10:06:11
举报
文章被收录于专栏:悟空被FFmpeg玩悟空被FFmpeg玩

首先,这是一个比较简单的问题

我是在Linux下和windows下作了一个对比

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

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

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

[root@localhost liuqi]# cat /proc/kmsg <7>[ 173.96809]ubub:ubrsm7[ 7.610 hihd00:01.:rsm othb10 u_eue<> 13980]ec_c 000:d7 eSau ot2sau 083PWRsgjCCCNET<> 13983]hb2010 ot2 tts00 hne006cg04et007[ 7.837 u -:.:pr ,sau 51 hne00,40M/<7>[ 174.158650] Monitor-Mwait will be used to enter C-3 state<7>[ 174.177594] hub 6-0:1.0: hub_resume<7>[ 174.177645] uhci_hcd 0000:00:1d.0: port 2 portsc 0093,00<7>[ 174.177654] hub 6-0:1.0: port2:sau 11cag 01<>[ 7.914 hihd00:01.:Gtttspr tts030 OE WE i=e S7[ 7.929 u -:.: state 7 ports 6 chg 0000 evt 00040 v 00<> 14284]hb6010 ot2 tts00,cag 00 2M/<6>[ 174.380245 s -:nwfl pe S eieuiguc_c n drs <7>[ 174.516276] usb 6-2: default language 0x0409<7>[ 174.531319] usb 6-2: udev 2, busnum 6, minor = 641<6>[ 174.531327] usb 6-2: New USB device found, idVendor=05c6, idProduct=2001<6>[ 174.531334] usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3<6>[ 174.531341] usb 6-2: Product: USB MMC Storage<6>[ 174.531347] usb 6-2: Manufacturer: Qualcomm, Incorporated<6>[ 174.531352] usb 6-2: SerialNumber: Mass Storage<7>[ 174.536313] usb 6-2: adding 6-2:1.0 (config #1, interface 0)<7>[ 174.536933] usb 6-2:1.0: uevent<7>[ 174.537241] usb-storage 6-2:1.0: usb_probe_interface<7>[ 174.537254] usb-storage 6-2:1.0: usb_probe_interface - got id<7>[ 174.537262] usb-storage: USB Mass Storage device detectedbsoae rtcl rnprn CI<7>[ 174.546717] usb-storage: *** thread sleeping.<7>[ 174.547697] usb-storage 6-2:1.0: device found<7>[ 174.547700] usb-storage 6-2:1.0: waiting for device to settle before scanning<7>[ 174.548539] drivers/usb/core/inode.c: creating file '002':qf rtp=1vle00 ne=0ln1<7>[ 179.549322] usb-storage: GetMaxLUN comadrsl s1 aai 7[ 7.460 s-trg:qeeomn ald<> 19593]ubsoae * hedaaee.<> 19594]ubsoae omn NUR 6bts7[ 7.463 s-trg: 20 00 407[ 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<7>[ 179.551311] usb-storae ttscd ;taserd3/6<> 19511]ubsoae -tase opee<> 19511]ubsoae ukdt rnfrrsl x7[ 7.536 s-trg:Atmtn ogtCW.7[ 7.538 s-trg:ubso_uktase_u:xe 3bts<7>[ 179.552303] usb-storage: Status code 0; transferred 13/13<7>[ 179.552305] usb-storage: -- transfer complete<7>[ 179.552307] usb-storage: Bulk status result = 0<7>[ 179.552309] usb-storage: Bulk Status S 0x53425355 T 0x1 R 0 Stat 0x0<7>[ 179.552312] usb-storage: scsi cmd done, result=0x0<7>[ 179.552316] usb-storage: *** thread sleeping.<5>[ 179.552403] scsi 2:0:0:0: CD-ROM D-Link CDROM 2.31 PQ: 0 ANSI: 2<7>[ 179.553240] usb-storage: queuecommand called<7>[ 179.554294] usb-storage: Status code 0; transferred 31/31<7>[ 179.554296] usb-storage: -- transfer complete<7>[ 179.554298] usb-storage: Bulk command transfer result=0<7>[ 179.554300] usb-storage: Attempting to get CSW...<7>[ 179.554302] usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes<7>[ 179.556287] usb-storage: Status code 0; transferred 31/31<7>[ 179.556289] usb-storage: -- transfer complete<7>[ 179.556291] usb-storage: Bulk command transfer result=0<7>[ 179.556293] usb-storage: usb_stor_bulk_transfer_sglist: xfer 18 bytes, 1 entries<7>[ 179.558286] usb-storage: Status code 0; transferred 13/13<7>[ 179.558288] usb-storage: -- transfer complete<7>[ 179.558290] usb-storage: Bulk status result = 0<7>[ 179.558298] usb-storage: Bulk Status S 0x53425355 T 0x3 R 0 Stat 0x0<7>[ 179.558300] usb-storage: -- Result from auto-sense is 0<7>[ 179.558302] usb-storage: -- code: 0x70, key: 0x6, ASC: 0x28, ASCQ: 0x0<7>[ 179.558305] usb-storage: Unit Attention: Not ready to ready change, medium may have changed<7>[ 179.558309] usb-storage: scsi cmd done, result=0x2<7>[ 179.558313] usb-storage: *** thread sleeping.<7>[ 179.558392] usb-storage: queuecommand called<7>[ 179.558398] usb-storage: *** thread awakened.<7>[ 179.558401] usb-storage: Command TEST_UNIT_READY (6 bytes)<7>[ 179.558402] usb-storage: 00 00 00 00 00 00<7>[ 179.558408] usb-storage: Bulk Command S 0x43425355 T 0x4 L 0 F 0 Trg 0 LUN 0 CL 6<7>[ 179.558410] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes<7>[ 179.560357] usb-storage: Status code 0; transferred 13/13<7>[ 179.560359] usb-storage: -- transfer complete<7>[ 179.560361] usb-storage: Bulk status result = 0<7>[ 179.560363] usb-storage: Bulk Status S 0x53425355 T 0x4 R 0 Stat 0x0<7>[ 179.560366] usb-storage: scsi cmd done, result=0x0<7>[ 179.560370] usb-storage: *** thread sleeping.<7>[ 179.560510] usb-storage: queuecommand called<7>[ 179.560530] usb-storage: *** thread awakened.<7>[ 179.560533] usb-storage: Command MODE_SENSE_10 (10 bytes)<7>[ 179.560534] usb-storage: 5a 00 2a 00 00 00 00 00 80 00<7>[ 179.560543] usb-storage: Bulk Command S 0x43425355 T 0x5 L 128 F 128 Trg 0 LUN 0 CL 10<7>[ 179.560545] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes<7>[ 179.562299] usb-storage: Status code -121; transferred 32/128<7>[ 179.562301] usb-storage: -- short read trase7[ 7.633 s-trg:Bl aatase eut01<> 19520]ubsoae tepigto get CSW...<7>[ 179.562307] usb-storage:ubso_uktase_u:xe 3bts=0 ne=3ln0<7>[ 179.565286] usb-storage: Status code 0; transferred 13/13<7>[ 179.565288] usb-storage: -- transfer complete<7>[ 179.565290] usb-storage: Bulk status result = 0<7>[ 179.565292] usb-storage: Bulk Status S 0x53425355 T 0x5 R 96 Stat 0x0<7>[ 179.565295] usb-storage: scsi cmd done, result=0x0<7>[ 179.565300] usb-storage: *** thread sleeping.<4>[ 179.565360] sr0: scsi3-mmc drive: 8x/40x writer xa/form2 cdda tray<6>[ 179.565369] Uniform CD-ROM driver Revision: 3.20<7>[ 179.566915] sr 2:0:0:0: Attached scsi CD-ROM sr0<5>[ 179.567541] sr 2:0:0:0: Attached scsi generic sg1 type 5<7>[ 179.569524] usb-storage: queuecommand called<7>[ 179.569531] usb-storage: *** thread awakened.<7>[ 179.569533] usb-storage: Bad target number (3:0)<7>[ 179.569535] usb-storage: scsi cmd done, result=0x40000<7>[ 179.569538] usb-storage: *** thread sleeping. .........................^C

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

[root@localhost liuqi]# ls /dev/0:0:0:0 dsp loop4 pcmC0D0c random stdout tty28 tty50 usb3 vcs1adsp event0 loop5 pcmC0D0p rfkill systty tty29 tty51 usb4 vcs2agpgart event1 loop6 pcmC0D1p root timer tty3 tty52 usb5 vcs3audio event2 loop7 port rtc tty tty30 tty53 usb6 vcs4bsg event3 lp0 ppp rtc0 tty0 tty31 tty54 usb7 vcs5btrfs-control event4 lp1 ptmx scd0 tty1 tty32 tty55 usb8 vcs6bus event5 lp2 pts sda tty10 tty33 tty56 usbdev1.1 vcsacachefiles event6 lp3 ram sda1 tty11 tty34 tty57 usbdev2.1 vcsa1card0 fb MAKEDEV ram0 sda2 tty12 tty35 tty58 usbdev3.1 vcsa2cdrom fb0 mapper ram1 sda5 tty13 tty36 tty59 usbdev4.1 vcsa3cdrw fb1 mcelog ram10 sda6 tty14 tty37 tty6 usbdev5.1 vcsa4console fd mem ram11 sda7 tty15 tty38 tty60 usbdev6.1 vcsa5controlC0 full mice ram12 sda8 tty16 tty39 tty61 usbdev6.2 vcsa6core fuse microcode ram13 sda9 tty17 tty4 tty62 usbdev7.1 vga_arbitercpu gpmctl mixer ram14 seq tty18 tty40 tty63 usbdev8.1 XORcpu0 hpet mouse0 ram15 sequencer tty19 tty41 tty7 usbmon0 zerocpu1 hwC0D0 mouse1 ram2 sequencer2 tty2 tty42 tty8 usbmon1cpu_dma_latency input msr0 ram3 sg0 tty20 tty43 tty9 usbmon2cuse kmem msr1 ram4 sg1 tty21 tty44 ttyS0 usbmon3device-mapper kmsg net ram5 shm tty22 tty45 ttyS1 usbmon4disk log network_latency ram6 snapshot tty23 tty46 ttyS2 usbmon5dlm-control loop0 network_throughput ram7 snd tty24 tty47 ttyS3 usbmon6dlm-monitor loop1 null ram8 sr0 tty25 tty48 urandom usbmon7dlm_plock loop2 ocfs2_control ram9 stderr tty26 tty49 usb1 usbmon8dri loop3 oldmem ramdisk stdin tty27 tty5 usb2 vcs

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

[root@localhost liuqi]# lsusbBus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 006 Device 004: ID 05c6:2001 Qualcomm, Inc. Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

可以看出来,关键的是:Bus 006 Device 004: ID 05c6:2001 Qualcomm, Inc.

可以看到,其Vendor: 05c6 ProductID:2001

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

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

eject /dev/sr0

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

[root@localhost liuqi]# lsusbBus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 006 Device 005: ID 1e0e:ce16 Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

这回好了,看到结果了,Bus 006 Device 005: ID 1e0e:ce16

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

然后看一下/dev/下的设备

[root@localhost liuqi]# ls /dev/0:0:0:0 dri loop0 msr1 ram15 sda9 tty14 tty34 tty54 usb1 usbmon5adsp dsp loop1 net ram2 sdb tty15 tty35 tty55 usb2 usbmon6agpgart event0 loop2 network_latency ram3 seq tty16 tty36 tty56 usb3 usbmon7audio event1 loop3 network_throughput ram4 sequencer tty17 tty37 tty57 usb4 usbmon8bsg event2 loop4 null ram5 sequencer2 tty18 tty38 tty58 usb5 vcsbtrfs-control event3 loop5 ocfs2_control ram6 sg0 tty19 tty39 tty59 usb6 vcs1bus event4 loop6 oldmem ram7 sg1 tty2 tty4 tty6 usb7 vcs2cachefiles event5 loop7 pcmC0D0c ram8 shm tty20 tty40 tty60 usb8 vcs3card0 event6 lp0 pcmC0D0p ram9 snapshot tty21 tty41 tty61 usbdev1.1 vcs4console fb lp1 pcmC0D1p ramdisk snd tty22 tty42 tty62 usbdev2.1 vcs5controlC0 fb0 lp2 port random stderr tty23 tty43 tty63 usbdev3.1 vcs6core fb1 lp3 ppp rfkill stdin tty24 tty44 tty7 usbdev4.1 vcsacpu fd MAKEDEV ptmx root stdout tty25 tty45 tty8 usbdev5.1 vcsa1cpu0 full mapper pts rtc systty tty26 tty46 tty9 usbdev6.1 vcsa2cpu1 fuse mcelog ram rtc0 timer tty27 tty47 ttyS0 usbdev6.3 vcsa3cpu_dma_latency gpmctl mem ram0 sda tty tty28 tty48 ttyS1 usbdev7.1 vcsa4cuse hpet mice ram1 sda1 tty0 tty29 tty49 ttyS2 usbdev8.1 vcsa5device-mapper hwC0D0 microcode ram10 sda2 tty1 tty3 tty5 ttyS3 usbmon0 vcsa6disk input mixer ram11 sda5 tty10 tty30 tty50 ttyUSB0 usbmon1 vga_arbiterdlm-control kmem mouse0 ram12 sda6 tty11 tty31 tty51 ttyUSB1 usbmon2 XORdlm-monitor kmsg mouse1 ram13 sda7 tty12 tty32 tty52 ttyUSB2 usbmon3 zerodlm_plock log msr0 ram14 sda8 tty13 tty33 tty53 urandom usbmon4[root@localhost liuqi]#

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

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

+CSQ:31, 99OK+CGMR: P1.0 DLink_DWM-162-U5_V1.0OK^HRSSILVL:99^HRSSILVL:80

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2010-01-09 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档