Emtel has recently started selling a USB modem (a Huawei E220) which uses its 3G cellular network (specifically HSDPA) to provide an Internet connection of up to 1.8Mbits/s.
A good friend of mine has bought one for his company but has not been able to make it work with Linux. Always looking for a new technical challenge (yes, I am a geek), I told him that I was willing to give it a try during the week-end. And this post is about what I did to make it work.
I run Kubuntu 7.10 (with kernel 2.6.22 which is > 2.6.19 which means that everything should normally work out of the box). Of course, this was mostly true in my case. Here is the exact version of Linux I’m using:
Linux noulakaz 2.6.22-14-generic #1 SMP Sun Oct 14 23:05:12 GMT 2007 i686 GNU/Linux
Plugging the Huawei E220 and typing dmesg, I get:
[ 112.528000] usb 2-1: new full speed USB device using uhci_hcd and address 2
[ 112.688000] usb 2-1: configuration #1 chosen from 1 choice
[ 112.796000] usbcore: registered new interface driver usbserial
[ 112.800000] /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c:
USB Serial support registered for generic
[ 112.800000] usbcore: registered new interface driver usbserial_generic
[ 112.800000] /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c:
USB Serial Driver core
[ 112.808000] /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c:
USB Serial support registered for GSM modem (1-port)
[ 112.812000] option 2-1:1.0: GSM modem (1-port) converter detected
[ 112.812000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 112.812000] usbcore: registered new interface driver option
[ 112.812000] /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/option.c:
USB Driver for GSM modems: v0.7.1
[ 112.824000] usbcore: registered new interface driver libusual
Of course, the important information here is:
GSM modem (1-port) converter now attached to ttyUSB0
In /dev, the following device is created automatically:
crw-rw—- 1 root dialout 188, 0 2007-12-16 10:24 ttyUSB0
BIG PROBLEM!
/dev/ttyUSB1 and /dev/ttyUSB2 do not exist meaning that the modem won’t respond. After searching, I found the solution online on Mohd Shakir Zakaria‘s weblog. The solution is to remove the uhci_hcd kernel module, reload it and wait for ttyUSB1 and ttyUSB2 to be created (this looks like a bug in uhci_hcd) [Thanks to Shakir who sent me a mail to tell me that uhci_hcd only has to be removed and reloaded once for the appropriate devices to be created…]
sudo modprobe -r uhci_hcd
sudo modprobe uhci_hcd
and the following is logged after some time:
[ 776.960000] option 2-1:1.0: GSM modem (1-port) converter detected
[ 776.960000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 776.964000] option 2-1:1.1: GSM modem (1-port) converter detected
[ 776.964000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 776.968000] option 2-1:1.2: GSM modem (1-port) converter detected
[ 776.968000] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
There is a script which automates this process.
Connection to the Emtel network using wvdial is then trivial. This is my wvdial.conf:
[Dialer Emtel]
Phone = *99***1#
Modem = /dev/ttyUSB0
Username = user
Password = pass
ISDN = 0
New PPPD = yes
Baud = 1843200
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Running:
sudo wvdial Emtel
produces:
WvDial<*1>: WvDial: Internet dialer version 1.56
WvModem<*1>: Cannot get information for serial port.
WvDial<*1>: Initializing modem.
WvDial<*1>: Sending: ATZ
WvDial Modem<*1>: ATZ
WvDial Modem<*1>: OK
WvDial<*1>: Sending: ATZ
WvDial Modem<*1>: ATZ
WvDial Modem<*1>: OK
WvDial<*1>: Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
WvDial Modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
WvDial Modem<*1>: OK
WvDial<*1>: Modem initialized.
WvDial<*1>: Sending: ATDT*99***1#
WvDial<*1>: Waiting for carrier.
WvDial Modem<*1>: ATDT*99***1#
WvDial Modem<*1>: CONNECT
WvDial<*1>: Carrier detected. Waiting for prompt.
WvDial<Notice>: Don’t know what to do! Starting pppd and hoping for the best.
WvDial<Notice>: Starting pppd at Sun Dec 16 10:35:57 2007
WvDial<Notice>: Pid of pppd: 6193
WvDial<*1>: Using interface ppp0
WvDial<*1>: local IP address 10.11.80.28
WvDial<*1>: remote IP address 10.64.64.64
WvDial<*1>: primary DNS address 196.192.4.4
WvDial<*1>: secondary DNS address 213.200.89.89
I tested the Huawei E220 by downloading a couple of my own MP3s:
time wget https://www.noulakaz.net/avinash/music/so-logical/07-play.mp3
Length: 4,879,827 (4.7M)
real 2m5.443s
The download speed is 304 kbits/s
time wget https://www.noulakaz.net/avinash/music/so-logical/04-helium.mp3
Length: 4,276,087 (4.1M)
real 2m5.200s
Download speed is 267 kbits/s
And I also downloaded a 6Mb file from an official Ubuntu server:
time wget http://mu.archive.ubuntu.com/ubuntu/ls-lR.gz
Length: 6,000,019 (5.7M)
real 4m35.690s
Download speed is only 170 kbits/s which is nothing to shout about – but, at least, it works :-)
6 January 2007: an update
I’ve added sudo everywhere because I’ve realized that many Ubuntu (or Kubuntu) users do not know how to log in as root (which is excellent :-) ). I’ve also used dmesg command instead of having a look in the log files directly.