Huawei UMTS USB Stick E169 with Linux

For questions concerning this document, contact me at:

l a r s [DoT} b a m b e r g e r {At) gmx (dOT} d e

(Please read the note at the end of the document before you do!)

SUMMARY:
This document describes how I got the Huawei UMTS USB Stick E169 to peacefully work with Linux and how to connect to e-plus acting as ISP.

The E169 itself and the drivers

The Stick is a HSDPA / UMTS / GPRS / GSM modem for mobile access to the Internet. It plugs into the USB port and comes complete with an extension cord. It is manufactured by Huawei Technologies CO., Ltd. of the People's Republic of China.
The maximum rated data transfer rate is 7.2 Mbit/s for HSDPA and 384 kbit/s for UMTS. It is possible to send and receive SMS and it contains a microSD card slot and a port for an external antenna.

The E169 is a composite USB device, that means it behaves differently depending on the computer it is connected to. Attached to a computer running MacOS, it will announce itself as a removable CD-ROM device an it will contain the MacOS drivers. Attached to a windows box, it will also announce itself as a removable CD-ROM but it will contain he Windows-drivers for installation. The E169 usually switches to being a modem after the driver has sent a special command.
It is a different story with Linux. Depending on attachment at boot-time or after boot-time and on wheather the kernel drivers are available it will behave either as a removable CD-ROM with the Windows drivers on it only (you can actually mount it) or as three distinct modem devices and the CD-ROM.
To make sure the E169 is in the modem-mode, send it the appropriate command. I use usb_modeswitch for that. I use this configuration file for the E169:


# /etc/usb_modeswitch.conf
# Huawei E169
#
DefaultVendor=  0x12d1;
DefaultProduct= 0x1001
DetachStorageOnly=0
HuaweiMode=1
# End

To make sure that the E169 is correctly initialized, do a cat /proc/bus/usb/device. The output should include these lines:


T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1001 Rev= 0.00
S:  Manufacturer=�������������������
S:  Product=HUAWEI Mobile
S:  SerialNumber=�������������������
C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=128ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=84(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=85(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E:  Ad=83(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

The E169 now acts as four devices. The first three are used for connectivity, the fourth is the ZeroCD device. And yes, the Manufacturer and the Serial-number are messed up.
Now for the needed drivers: You need to have configured as a kernel model or built-in the following drivers:

USB Driver for GSM and CDMA modems
Device Drivers => USB support => USB Serial Converter support => USB Generic Serial Driver => USB Driver for GSM and CDMA modems, module name: option
PPP support for sync tty ports
Host USB support for your linux box
All the other stuff for TCP/IP networking
This should normally already be configured

After a modprobe option you should find the appropriate entries in the system log and you will find that the output of cat /proc/bus/usb/devices reveals the driver associated with the E169 devices.
If you have udev you should now have /dev/ttyUSB0, /dev/ttyUSB1 and /dev/ttyUSB2. These are the devices for the UMTS modem, for the GSM modem and a device for sending an receiving SMS, respectively

Establishing an Internet connection

You might want to talk directly to the modem using a minicom for example. Here is a list of commands the modem understands:


AT&V
&C: 2; &D: 2; &E: 0; &F: 0; &S: 0; &W: 0; E: 1; L: 0; M: 0; Q: 0; V: 1;
X: 0; Z: 0; \Q: 3; \S: 0; \V: 0; S0: 0; S2: 43; S3: 13; S4: 10; S5: 8;
S6: 2; S7: 50; S8: 2; S9: 6; S10: 14; S11: 95; S30: 0; S103: 1; S104: 1;
+FCLASS: 0; +ICF: 3,3; +IFC: 2,2; +IPR: 115200; +DR: 0; +DS: 0,0,2048,6;
+WS46: 12; +CBST: 0,0,1;
+CRLP: (61,61,48,6,0),(61,61,48,6,1),(240,240,52,6,2);
+CV120: 1,1,1,0,0,0; +CHSN: 0,0,0,0; +CSSN: 0,0; +CREG: 0; +CGREG: 0;
+CFUN:; +CSCS: "IRA"; +CSTA: 129; +CR: 0; +CRC: 0; +CMEE: 0; +CGDCONT: (1,"IP","
internet.eplus.de","0.0.0.0",0,0)
; +CGDSCONT: ; +CGTFT: ; +CGEQREQ: (1,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(2,2,0,0,
0,0,2,0,"0E0","0E0",3,0,0),(3,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(4,2,0,0,0,0,2,0,
"0E0","0E0",3,0,0),(5,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(6,2,0,0,0,0,2,0,"0E0","0
E0",3,0,0),(7,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(8,2,0,0,0,0,2,0,"0E0","0E0",3,0,
0),(9,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(10,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(11,
2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(12,2,0,0,0,0,2,0,"0E
0","0E0",3,0,0),(13,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(14,2,0,0,0,0,2,0,"0E0","0E
0",3,0,0),(15,2,0,0,0,0,2,0,"0E0","0E0",3,0,0),(16,2,0,0,0,0,2,0,"0E0","0E0",3,0
,0)
; +CGEQMIN: ; +CGQREQ: ; +CGQMIN: ; ; +CGEREP: 0,0; +CGCLASS: "A";
+CGSMS: 0; +CSMS: 0; +CMGF: 0; +CSAS: 0; +CRES: 0; +CSCA: "",;
+CSMP: ,,0,0; +CSDH: 0; +CSCB: 0,"",""; +FDD: 0; +FAR: 0; +FCL: 0;
+FIT: 0,0; +ES: ,,; +ESA: 0,,,,0,0,255,; +CMOD: 0; +CVHU: 1; ; +CPIN: ,;
+CMEC: 0,0,0; +CKPD: 1,1; +CGATT: 0; +CGACT: 0; +CPBS: "SM";
+CPMS: "SM","SM","SM"; +CNMI: 0,0,0,0,0;  +CMMS: 2; +FTS: 0; +FRS: 0;
+FTH: 3; +FRH: 3; +FTM: 96; +FRM: 96; +CCUG: 0,0,0; +COPS: 0,2,"";
+CUSD: 0; +CAOC: 1; +CCWA: 0; +CCLK: ""; +CLVL: 2; +CMUT: 0;
+CPOL: 0,2,"",0,0,0; +CPLS: 0; +CTZR: 0; +CTZU: 0; +CLIP: 0; +COLP: 0;
+CDIP: 0; +CLIR: 0; ^PORTSEL: 0; ^CPIN: ,; ^ATRECORD: 0;
^FREQLOCK: 12535688,13095612; ^CVOICE: 0; ^DDSETEX: 0^@

The most important ones are:

ATI
Return modem ID
ATZ
Reset modem
AT&F
Load firmware defaults
AT&V
Return supported commands
AT+CGMI
Return manufacturer
AT+CGMM
Return model
AT+CGMR
Return version number
AT+CGSN
Return IMEI
AT+CPIN?
Return PIN status. Possible responses are:
+CPIN: SIM PUK
The PUK needs to be entered. After that, a new PIN needs to be set.
+CPIN: SIM PIN
A PIN has not been entered yet.
+CPIN: READY
A correct PIN has been entered. Modem is ready for use.
AT+CPIN="XXXX"
Enter the PIN. (Replace XXXX with the PIN)
AT+CPIN="YYYYYYYY","XXXX"
Set a new PIN. (Replace YYYYYYYY with the PUK and XXXX with the new PIN)
AT+CLCK="SC",0,"XXXX"
Disable PIN inquiry. (Replace XXXX with the PIN)
AT+CLCK="SC",1,"XXXX"
Enable PIN inquiry. (Replace XXXX with the PIN)
AT+CLCK="SC",2
Return PIN requirement. Possible responses are:
+CLCK: 0
PIN not required
+CLCK: 1
PIN required
AT+CREG?
Return modem status. Possible responses are:
+CREG: 0,1
Modem logged in
+CREG: 0,2
Modem not logged in
AT+COPS?
Return the network the modem is logged in
AT+COPS=?
Return all available networks. This might take a while to complete.
AT+CSQ
Signal strength and biterrorrate
AT+CGDCONT=
Set the APN (Access Point Name). This value depends on your ISP. Normally something like AT+CGDCONT=1,"IP","internet" should work. For e-plus, this is: AT+CGDCONT=1,"IP","internet.eplus.de","0.0.0.0"
ATD*99#
Connect to the preset APN
ATD*99***1#
Connect to the first APN stored in the modem

Now, in theory it should be possible to connect to your ISP with pppd and a chat script that will enter the PIN. However, up until now, this never worked out. The peer will refuse to supply an IP address and the configuration of the link fails. You need to install and use wvdial.
Here are the configuration files:

[Dialer pin]
Modem = /dev/ttyUSB0
Init1 = AT+CPIN=XXXX (Replace XXXX with your PIN)

[Dialer umts]
Modem = /dev/ttyUSB0
Baud = 460800
New PPPD = yes
Dial Command = ATDT
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+cgdcont=1,"IP","internet.eplus.de","0.0.0.0" (Modify for your ISP. This is for e-plus only.)
ISDN = 0
Modem Type = Analog Modem
Phone = *99#
Username = eplus
Password = gprs
Timeout = 120
Stupid Mode = yes
Idle Seconds = 500

/etc/ppp/peers/wvdial 
noccp
noauth
debug
lock
defaultroute
noipdefault
usepeerdns

Summary

To set up an Internet connection:

  1. Switch the modem to modem mode using usb_modeswitch if required.
  2. Have the kernel driver option available. (And also others.)
  3. Do a wvdial pin and wait for the modem to log in. The LED should change color to blue when logged into an UMTS network.
  4. Do a wvdial umts and enjoy!

NOTE:

I am not a Linux professional, I spend parts of my free time on Linux. This document is intended only to share my experience with other users. Please keep that in mind if you should mail me. You are always welcome to contribute to this document.


With respect to German law, this is the .