UMTS on Debian with Huawei E220 USB-modem
This page describes howto setup a Debian 4.0 Etch system to use the Huawei E220 USB modem (Vodafone Connect)
- Huawei E220 @ Vodafone UMTS-HSDPA USB-modem
- Huawei E220 @ Wikipedia Huawei E220
Prepare Debian
The E220 is recognized as a CDROM for older kernels. The kernel-module “usb-storage” will claim the usb-device.
From kernels > 2.6.20, the “usbserial” kernel-module recognizes the usb-device and creates the nessacery devices /dev/ttyUSB0 and /dev/ttyUSB1
For Debian 4.0 Etch, you can install the “ethnhalf” kernel:
echo "deb http://kernel-archive.buildserver.net/debian-kernel/ trunk main" \ >> /etc/apt/sources.list apt-get update apt-get install linux-image-2.6.24-etchnhalf.1-486 reboot
Info:
- alternative kernels in Debian → http://wiki.debian.org/DebianKernel
- etch-and-a-half → http://www.debian.org/releases/etch/debian-installer/etchnhalf
Disable PIN-code
Install minicom:
apt-get install minicom
Prepare this minicom config file:
> cat /etc/minicom/minirc.ttyUSB0 # Machine-generated file - use "minicom -s" to change parameters. pu port /dev/ttyUSB0 pu baudrate 230400 pu bits 8 pu parity N pu stopbits 1 pu minit ATZ
Connect using (disconnect using ctrl-A, Q):
> minicom ttyUSB0
Some AT-commands (reference only):
# Show model and EMEI number: ATI Manufacturer: huawei Model: E220 Revision: 11.117.09.04.00 IMEI: 354111128111119 +GCAP: +CGSM,+DS,+ES OK # show registers AT&V # provide pin-code: AT+CPIN="0000" OK # Get the network signal strength: the first value. # Typical values from 5 to 22. # Minimum acceptable for reliable connections is 12. AT+CSQ +CSQ: 16,99 OK # (replace xxxx with your own PIN) # Turn off the PIN question AT+CLCK="SC",0,"XXXX" # To turn the PIN question on again, type AT+CLCK="SC",1,"XXXX" # Check if the PIN question is on or off. # "+CLCK: 0" PIN is off, "+CLCK: 1" the PIN is on. AT+CLCK="SC",2 +CLCK: 1 OK
Disable PIN procedure in minicom:
# first login with PIN AT+CPIN="0000" OK # disable PIN, providing PIN again: AT+CLCK="SC",0,"0000" OK # check if disabled (0=disabled, 1=enabled) AT+CLCK="SC",2 +CLCK: 0
Set PPP interface
Install wvdial:
apt-get install wvdial
Add the ppp0 interface:
> cat /etc/network/interfaces auto ppp0 iface ppp0 inet wvdial provider VodafoneNL # NOTE: "provider VodafoneNL" will call 'wvdial VodafoneNL' # and this uses the section [Dialer VodafoneNL] in /etc/wvdial.conf
Add this file, which is used to start the PPP connection: (note: no other pppd/chat file is required)
> cat /etc/wvdial.conf [Dialer Defaults] Phone = Username = Password = New PPPD = yes [Dialer VodafoneNL] Modem = /dev/ttyUSB0 Baud = 460800 Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 Init3 = Area Code = Phone = *99# Username = ppp Password = ppp Ask Password = 0 Dial Command = ATDT Compuserve = 0 Force Address = Idle Seconds = 0 DialMessage1 = DialMessage2 = ISDN = 0 Auto DNS = 1 Auto Reconnect = 1 Dial Attempts = 0
Start, Stop and test the ppp0 interface
ifup ppp0 ifdown ppp0
The “auto” keyword in /etc/network/interfaces will do a “ifup” automatically at boottime.
Check and restart after failure
This script will check and restart the ppp0 interface, should the connection be down (e.g. replug of USB-modem)
> cat /usr/local/bin/check_restart_ppp0.sh #!/bin/bash # (c)2009 John de Graaff # add in crontab: # cat /etc/crontab # */1 * * * * root /usr/local/bin/check_restart_ppp0.sh LOGGER=/usr/bin/logger MSG="$0 (PID:$$) started" echo $MSG $LOGGER "$MSG" PROG="wvdial" PID=`pidof $PROG` if test "$PID" != "" ; then echo "$PROG seems to be running (PID: $PID)..." exit 0 fi MSG="$0 (PID:$$): $PROG not running!! Starting $PROG now ..." echo $MSG $LOGGER "$MSG" CMD="/sbin/ifdown ppp0" MSG="$0 (PID:$$): executing cmd: $CMD " echo $MSG $LOGGER "$MSG" $CMD sleep 2 CMD="/sbin/ifup ppp0" MSG="$0 (PID:$$): executing cmd: $CMD " echo $MSG $LOGGER "$MSG" $CMD exit 0
Make the script executable:
chmod +x /usr/local/bin/check_restart_ppp0.sh
Add this line to the crontab:
> cat /etc/crontab */1 * * * * root /usr/local/bin/check_restart_ppp0.sh
Make the cron daemon reload the config file:
> /etc/init.d/cron reload
Light Indicators
| Light colour | Explanation |
|---|---|
| Green blinking | A GPRS network has been found and the modem is ready to connect |
| Green solid | Connected to a GPRS network - data being sent and received |
| Blue blinking | A 3G network has been found and the modem is ready to connect |
| Blue solid | Connector to 3G network |
| Light blue solid | Connected to a HASDPA network |

