E182E

From BananaPro/Pi
Jump to: navigation, search

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

Use HuaWei E182E

Today, we use a 3G module on LeMaker Guitar. This board can support many kind of 3G modules, and at this time we use HuaWei E182E for example.

Before Using it

Get the Device Information

Plug the E182E to LeMaker Guitar, and run lsusb cmd to get the device information.

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

And use command dmesg, we can see that the system put the 3G device to a 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 

Install the usb-modeswitch

apt-get install usb-modeswitch
Edit the file: /lib/udev/rules.d/40-modeswitch.rules and add the folowing content:

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

The idVendor and idProduct can get from lsusb
Then edit /etc/usb_modeswitch.conf and add the following content:

# 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: http://www.draisberghof.de/usb_modeswitch/device_reference.txt .
And you can change EnableLogging=0 to EnableLogging=1, this will be convenient to get the log information at /var/log.

Reboot the Guitar

Use lsusb, you can see a different device:

Bus 001 Device 002: ID 12d1:14ac Huawei Technologies Co., Ltd.

And use dmesg, you can see the device mounted to ttyUSB0 ttyUSB1 and 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
...

And we can also see this three nodes by 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

Install 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

Start Using it!

Run the next cmd to start dialing: wvdial E1820 And we can see the device get a IP and 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] 

Now, you can see ppp0 by use ifconfig:

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)

Enjoy it!