Ubuntu Dapper 6.06 and a Huawei E220 UMTS/GPRS Box

Overview

These are my experiences with UMTS/GPRS networking using my new Huawei E220 box on a Ubuntu Dapper installation.

You may compare this with my previous HOWTO for the ICON GlobeSurfer Box, it's similar but not the same.

I guess this box is also sold under various rebrands from several providers, my device is from One.

device image

Details

The box operates in two states:

USB Vendor/Device ID in both states (this is a difference to the GlobeSurfer Box which changes its IDs): 12d1:1003

Again there is a command available to switch from flash to modem state:
http://www.kanoistika.sk/bobovsky/archiv/umts/huaweiAktBbo.c by Miroslav Bobovsky. (local copy huaweiAktBbo.c)

Note: This is possibly only needed for old kernels like that 2.6.15 kernel in Ubuntu Dapper!


Compile it with (you need libusb-dev installed)

 sudo apt-get install libusb-dev wget build-essential # possibly not necessary
 wget http://www.kanoistika.sk/bobovsky/archiv/umts/huaweiAktBbo.c
 cc huaweiAktBbo.c -lusb -o huaweiAktBbo

and install it to /sbin/huaweiAktBbo and call it with root privileges.

 sudo cp huaweiAktBbo /sbin/

When in modem state, the box offers three serial USB devices:
/dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2
Use /dev/ttyUSB0 to examine modem settings using minicom or go online via PPP.
The default modem settings are (One, AT):

&C: 1; &D: 2; &F: 0; E: 1; L: 1; M: 0; Q: 0; V: 1; X: 4; Z: 0; S0: 0;
S3: 13; S4: 10; S5: 8; S6: 2; S7: 45; S8: 2; S9: 6; S10: 14; S11: 95;
+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: 2; +CGDCONT: (1,"IP","fullspeed","",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,); +CGEQMIN: ; +CGQREQ: ; +CGQMIN: ; +CGEREP: 0,0; +CGDATA: "PPP";
+CGCLASS: "B"; +CGSMS: 0; +CSMS: 0; +CMGF: 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,0,"";
+CUSD: 0; +CAOC: 1; +CCWA: 0; +CPOL: 0,2,"",0,0,0; +CPLS: 0; +CTZR: 0;
+CTZU: 0; +CLIP: 0; +COLP: 0; +CDIP: 0; ^PORTSEL: 0;
^CPIN: ��������,��������; ^ATRECORD: 0; ^FREQLOCK: 11296852,1162820144

You have to provide the options vendor=0x12d1 and product=0x1003 when loading the usbserial module, e.g via

modprobe usbserial vendor=0x12d1 product=0x1003

Automatic module loading via udev

Create a udev script /etc/udev/rules.d/50-huawei-e220.rules with the content:

SUBSYSTEM=="usb", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1", RUN+="/sbin/huaweiAktBbo"
SUBSYSTEM=="usb", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1", RUN+="/bin/sleep 5"
SUBSYSTEM=="usb", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1", RUN+="/sbin/modprobe usbserial vendor=0x12d1 product=0x1003"

With this udev script there is no need for an option entry in an /etc/modprobe.d/... or /etc/modules file.

In contrast to the GlobeSurfer Box there is no two-stage switch script needed ...

PPP configuration

The PPP configuration needs some special chat scripts. This is for two reasons:

/etc/ppp/peers/hui:

# usbserial device, some options:
/dev/ttyUSB0
460800
idle 7200
lock
crtscts
modem
noauth
# dns, routing
usepeerdns
replacedefaultroute
defaultroute
noipdefault
# avoid compression:
noccp
nobsdcomp
novj
# usually doesnt matter for GPRS/UMTS connections:
user "web"
password ""
# connect script
connect "/usr/sbin/hui-chat.sh"
# t-mobile specific?
ipcp-restart 8
ipcp-max-configure 50
ipcp-accept-local
ipcp-accept-remote

a rather unusual two stage connect script /usr/sbin/hui-chat.sh:

#!/bin/sh

# call the preparation chat script (with pin and if this fails without pin)
/usr/sbin/chat -V -f /etc/chatscripts/hui-prep || /usr/sbin/chat -V -f /etc/chatscripts/hui-prep-nopin
# wait to switch between GPRS/UMTS
sleep 20
# the final chat script:
/usr/sbin/chat -V -f /etc/chatscripts/hui
and the three above mentioned chat scripts /etc/chatscripts/hui-prep
ABORT BUSY
ABORT ERROR
ABORT 'NO CARRIER'
REPORT CONNECT
TIMEOUT 10
"" "ATZ"
# replace XXXX with your PIN:
OK "AT+CPIN=XXXX"
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
OK "AT+IPR=115200"
OK "ATE1"
SAY "\nWaiting 20 Seconds to switch between UMTS/GPRS ...\n"
/etc/chatscripts/hui-prep-nopin
ABORT BUSY
ABORT ERROR
ABORT 'NO CARRIER'
REPORT CONNECT
TIMEOUT 10
"" "ATZ"
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
OK "AT+IPR=115200"
OK "ATE1"
SAY "\nWaiting 20 Seconds to switch between UMTS/GPRS ...\n"
/etc/chatscripts/hui
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
REPORT CONNECT
TIMEOUT 10
SAY "Calling ONE\n"
TIMEOUT 60
"" "ATD*99***1#"
CONNECT \c

You may even try to avoid to put the PIN into the chat scripts by using some pin entry program within the connect shell script.

start your connection with

pppd call hui

or for debugging

pppd call hui nodetach

Notes

In contrast to other HOWTOs for the Huawei E220 I don't have to plug it in at boot time, it works without this.

The second serial device /dev/ttyUSB1 periodically spits out a ^BOOT: prompt followed by some parameters (frequencies?)
During a dialup session it shows even more status messages like ^DSFLOWRPT: followed by several hex numbers.

Connecting with minicom to /dev/ttyUSB2 during a session, the modem initialization killed this connection. Furthermore nothing was visible there.

Sources

PS:

Today I had the chance to configure another Huawei E220 (also from One), this time I noticed that it only started to work after I ran it once under Windows (which I also did with my first modem). I compared the modem default settings (AT&V) before and after, and it turned out that the firsttime start under Windows changed some of these values:

before:

      +CFUN:; +CSCS: "IRA"; +CSTA: 129; +CR: 0; +CRC: 0; +CMEE: 2; +CGDCONT: (1,"IP","","",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); 
      +CGEQMIN: ; +CGQREQ: ; +CGQMIN: ; +CGEREP: 0,0; +CGDATA: "PPP";
      

after (see above for full listing):

      +CFUN:; +CSCS: "IRA"; +CSTA: 129; +CR: 0; +CRC: 0; +CMEE: 2; +CGDCONT: (1,"IP","fullspeed","",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,); 
      +CGEQMIN: ; +CGQREQ: ; +CGQMIN: ; +CGEREP: 0,0; +CGDATA: "PPP";
      

Note the differences in +CGDCONT and the 3rd argument (and additional 4th argument) of +CGEREQ.

I guess instead of running it under Windows one time it will suffice to change these values with AT commands. But of course these values will depend on your provider ...

PPS:

It turned out, that adding the APN settings in the AT initialization files hui-prep* would be helpful, like

OK "AT+CGDCONT=1,\"IP\"\"internet\""
see e.g. http://www.pinstack.com/carrier_settings_apn_gateway.html for a collection of APN settings (thanks to Arjan Filius).

PS2:

A more detailed german HOWTO from Georg Frankenberger can be found at http://ubuntu.frankenberger.at/Huawei_E220.html.

PS3:

If you have any other device which uses the usbserial module, dont forget to unload the module before plugging your E220 in.

An example are WinCE/WindowsMobile PocketPCs, like HP iPAQs or HTC Smartphones (XDA/MDA/VPA/QTEK or similar), they use the ipaq module on top of the usbserial module for synchronizing via synce, but whith different communication parameters. (Maybe this applies only to old kernels like in Ubuntu Dapper (2.6.15))

PS4:

There is an interesting HOWTO which uses the Huawei on a ASUS WL-500GP Router with OpenWrt. Works, with some small modifications, installed it recently for a colleague this way.

Some other resources:


Albrecht Gebhardt

Valid XHTML 1.1