Difference between revisions of "E182E/zh-hans"

From BananaPro/Pi
Jump to: navigation, search
Line 186: Line 186:
 
  --> pppd: ?[02]  
 
  --> pppd: ?[02]  
  
通过使用<code>ifconfig</code>这个命令,你可以看到ppp0名称。
+
通过使用<code>ifconfig</code>这个命令,你可以看到多个ppp0。
  
 
  root@Lemuntu:~# ifconfig  
 
  root@Lemuntu:~# ifconfig  

Revision as of 15:31, 27 November 2015

Other languages:
English • ‎中文(简体)‎

LeMaker Guitar支持多款3G模块,在这里我们以HuaWei E182E作为例子。

使用之前

设备信息

插入E182E到LeMaker Guitar,运行lsusb命令去获得设备的ID号。

Bus 001 Device 002: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem) 

使用dmesg这个命令可以看到,系统将网卡认作CD-ROM:

... skip ...
[  818.156473] usb 1-1: default language 0x0409
[  818.157289] usb 1-1: udev 2, busnum 1, minor = 1
[  818.157316] usb 1-1: New USB device found, idVendor=12d1, idProduct=1446
[  818.157337] usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[  818.157354] usb 1-1: Product: HUAWEI Mobile
[  818.157370] usb 1-1: Manufacturer: Huawei Technologies
[  818.158129] usb 1-1: usb_probe_device
[  818.158161] usb 1-1: configuration #1 chosen from 1 choice
[  818.161210] usb 1-1: adding 1-1:1.0 (config #1, interface 0)
[  818.161597] usb-storage 1-1:1.0: usb_probe_interface
[  818.161651] usb-storage 1-1:1.0: usb_probe_interface - got id
[  818.161682] usb-storage 1-1:1.0: USB Mass Storage device detected
[  818.162785] scsi0 : usb-storage 1-1:1.0
[  818.163715] usb 1-1: adding 1-1:1.1 (config #1, interface 1)
[  818.164073] usb-storage 1-1:1.1: usb_probe_interface
[  818.164128] usb-storage 1-1:1.1: usb_probe_interface - got id
[  818.164157] usb-storage 1-1:1.1: USB Mass Storage device detected
[  818.164481] scsi1 : usb-storage 1-1:1.1
[  819.156151] scsi 0:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[  819.157607] scsi 0:0:0:0: Attached scsi generic sg0 type 5
[  819.168411] scsi 1:0:0:0: Direct-Access     HUAWEI   TF CARD Storage       PQ: 0 ANSI: 2
[  819.176348] sd 1:0:0:0: Attached scsi generic sg1 type 0
[ 819.187020] sd 1:0:0:0: [sda] Attached SCSI removable disk
[ 1003.822474] atc260x-rtc atc2603c-rtc.0: atc260x_rtc_settime(): 2015-11-09 02:44:15 

安装usb-modeswitch

apt-get install usb-modeswitch
编译文件: 在/lib/udev/rules.d/40-modeswitch.rules文件中加入以下内容:

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="usb_modeswitch '%b/%k'"

上面的idVendor和idProduct值能够通过运行lsusb这个命令获得
之后编辑/etc/usb_modeswitch.conf这个文件,之后加入以下内容:

# Huawei E270+  (HSPA+ modem)
# Huawei E1762
# Huawei E1820
#
# Contributor: Paranoid Paranoia

DefaultVendor=  0x12d1
DefaultProduct= 0x1446

TargetVendor=   0x12d1
TargetProduct=  0x14ac 

MessageContent="55534243123456780000000000000011060000000000000000000000000000"

You can get this information from this link .
And you can change EnableLogging=0 to EnableLogging=1, this will be convenient to get the log information at /var/log.

重启系统

使用lsusb这个命令, 你可以设备信息的改变: Bus 001 Device 002: ID 12d1:14ac Huawei Technologies Co., Ltd.
使用dmesg这个命令,你可以看到设备已经挂载到/dev/目录下的ttyUSB0,ttyUSB1和ttyUSB2节点中:

...
[   92.772641] usb 1-1: New USB device found, idVendor=12d1, idProduct=14ac
[   92.772650] usb 1-1: New USB device strings: Mfr=4, Product=3, SerialNumber=0
[   92.772657] usb 1-1: Product: HUAWEI Mobile
[   92.772663] usb 1-1: Manufacturer: Huawei Technologies
[   92.773153] usb 1-1: usb_probe_device
[   92.773178] usb 1-1: configuration #1 chosen from 1 choice
[   92.778521] usb 1-1: adding 1-1:1.0 (config #1, interface 0)
[   92.778985] option 1-1:1.0: usb_probe_interface
[   92.779021] option 1-1:1.0: usb_probe_interface - got id
[   92.779067] option 1-1:1.0: GSM modem (1-port) converter detected
[   92.780024] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[   92.780666] usb 1-1: adding 1-1:1.1 (config #1, interface 1)
[   92.781001] cdc_ether 1-1:1.1: usb_probe_interface
[   92.781024] cdc_ether 1-1:1.1: usb_probe_interface - got id
[   92.781383] usb 1-1: adding 1-1:1.2 (config #1, interface 2)
[   92.782188] usb 1-1: adding 1-1:1.3 (config #1, interface 3)
[   92.782689] option 1-1:1.3: usb_probe_interface
[   92.782718] option 1-1:1.3: usb_probe_interface - got id
[   92.782760] option 1-1:1.3: GSM modem (1-port) converter detected
[   92.783568] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[   92.783885] usb 1-1: adding 1-1:1.4 (config #1, interface 4)
[   92.784296] option 1-1:1.4: usb_probe_interface
[   92.784342] option 1-1:1.4: usb_probe_interface - got id
[   92.784387] option 1-1:1.4: GSM modem (1-port) converter detected
[   92.785225] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[   92.785555] usb 1-1: adding 1-1:1.5 (config #1, interface 5)
[   92.785971] usb-storage 1-1:1.5: usb_probe_interface
[   92.786014] usb-storage 1-1:1.5: usb_probe_interface - got id
[   92.786039] usb-storage 1-1:1.5: USB Mass Storage device detected
[   92.787128] scsi2 : usb-storage 1-1:1.5
[   92.788308] usb 1-1: adding 1-1:1.6 (config #1, interface 6)
[   92.788812] usb-storage 1-1:1.6: usb_probe_interface
[   92.788864] usb-storage 1-1:1.6: usb_probe_interface - got id
[   92.788901] usb-storage 1-1:1.6: USB Mass Storage device detected
[   92.789383] scsi3 : usb-storage 1-1:1.6
[   92.833283] usbcore: registered new interface driver cdc_wdm
[   92.842012] qmi_wwan 1-1:1.1: usb_probe_interface
[   92.842065] qmi_wwan 1-1:1.1: usb_probe_interface - got id
[   92.844912] qmi_wwan 1-1:1.1: looking for a minor, starting at 176
[   92.845364] qmi_wwan 1-1:1.1: cdc-wdm0: USB WDM device
[   92.847658] qmi_wwan 1-1:1.1 wwan0: register 'qmi_wwan' at usb-aotg_hcd.1-1, WWAN/QMI device, fa:90:f2:10:76:bb
[   92.848140] usbcore: registered new interface driver qmi_wwan
[   92.986276] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[   93.781631] scsi 2:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[   93.782994] scsi 2:0:0:0: Attached scsi generic sg0 type 5
[   93.791841] scsi 3:0:0:0: Direct-Access     HUAWEI   TF CARD Storage       PQ: 0 ANSI: 2
[   93.801503] sd 3:0:0:0: Attached scsi generic sg1 type 0
[   93.803376] sd 3:0:0:0: [sda] Attached SCSI removable disk
...

使用ls /dev/tty*这个命令,你可以看到三个节点。

root@Lemuntu:~# ls /dev/tty*
/dev/tty    /dev/tty19  /dev/tty3   /dev/tty40  /dev/tty51  /dev/tty62
/dev/tty0   /dev/tty2   /dev/tty30  /dev/tty41  /dev/tty52  /dev/tty63
/dev/tty1   /dev/tty20  /dev/tty31  /dev/tty42  /dev/tty53  /dev/tty7
/dev/tty10  /dev/tty21  /dev/tty32  /dev/tty43  /dev/tty54  /dev/tty8
/dev/tty11  /dev/tty22  /dev/tty33  /dev/tty44  /dev/tty55  /dev/tty9
/dev/tty12  /dev/tty23  /dev/tty34  /dev/tty45  /dev/tty56  /dev/ttyS0
/dev/tty13  /dev/tty24  /dev/tty35  /dev/tty46  /dev/tty57  /dev/ttyS2
/dev/tty14  /dev/tty25  /dev/tty36  /dev/tty47  /dev/tty58  /dev/ttyS3
/dev/tty15  /dev/tty26  /dev/tty37  /dev/tty48  /dev/tty59  /dev/ttyS5
/dev/tty16  /dev/tty27  /dev/tty38  /dev/tty49  /dev/tty6   /dev/ttyUSB0
/dev/tty17  /dev/tty28  /dev/tty39  /dev/tty5   /dev/tty60  /dev/ttyUSB1
/dev/tty18  /dev/tty29  /dev/tty4   /dev/tty50  /dev/tty61  /dev/ttyUSB2

安装wvdial

apt-get install -y wvdial Edit /etc/wvdial.conf, and add this information:

[Dialer E1820]
Phone = *99#
APN = internet
Username = username
Password = password
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1, "IP","Internet"
Modem = /dev/ttyUSB0
Baud = 460800
Stupid Mode = 1

开始使用它

使用下面命令去拨号: wvdial E1820 你可以看到这个设备的IP和DNS:

root@Lemuntu:~# wvdial E1820 
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1, "IP","Internet"
AT+CGDCONT=1, "IP","Internet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT 236800
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Tue Nov 10 03:29:51 2015
--> Pid of pppd: 2085
--> Using interface ppp0
--> pppd: ?[02]
--> pppd: ?[02]
--> pppd: ?[02]
--> pppd: ?[02]
--> pppd: ?[02]
--> local  IP address 10.188.234.165
--> pppd: ?[02]
--> remote IP address 10.64.64.64
--> pppd: ?[02]
--> primary   DNS address 221.179.38.7
--> pppd: ?[02]
--> secondary DNS address 120.196.165.7
--> pppd: ?[02] 

通过使用ifconfig这个命令,你可以看到多个ppp0。

root@Lemuntu:~# ifconfig 
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1216 (1.1 KiB)  TX bytes:1216 (1.1 KiB)

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:10.188.234.165  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:60 errors:0 dropped:0 overruns:0 frame:0
          TX packets:65 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:4242 (4.1 KiB)  TX bytes:4585 (4.4 KiB)

wlan0     Link encap:Ethernet  HWaddr 7c:c7:09:36:3a:f0  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

通过以上操作,E182E可以正常使用了。