Thursday, July 3, 2008

Configuring Huawei E220 USB GSM modem on Kubuntu Hardy

Managed to get my hands on a repackaged Huawei E220 USB GSM modem provided by Maxis via their Maxis Broadband package. Since there's no instructions to install and use it on Linux (Windows and OSX instructions are provided), I decided to see how Linux will behave when it's plugged into the USB port.

Lo and behold; my system's /var/log/messages when it's plugged in:
Jul 3 10:56:50 mymachine kernel: [ 3190.180769] usb 3-1: new full speed USB device using uhci_hcd and address 4
Jul 3 10:56:50 mymachine kernel: [ 3190.308736] usb 3-1: configuration #1 chosen from 1 choice
Jul 3 10:56:50 mymachine kernel: [ 3190.329557] scsi8 : SCSI emulation for USB Mass Storage devices
Jul 3 10:56:50 mymachine kernel: [ 3190.372427] usb 3-1: USB disconnect, address 4
Jul 3 10:56:51 mymachine kernel: [ 3191.032621] usb 3-1: new full speed USB device using uhci_hcd and address 5
Jul 3 10:56:51 mymachine kernel: [ 3191.162740] usb 3-1: configuration #1 chosen from 1 choice
Jul 3 10:56:51 mymachine kernel: [ 3191.165275] usb-storage: probe of 3-1:1.0 failed with error -5
Jul 3 10:56:51 mymachine kernel: [ 3191.165306] airprime 3-1:1.0: GSM modem (1-port) converter detected
Jul 3 10:56:51 mymachine kernel: [ 3191.165537] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0
Jul 3 10:56:51 mymachine kernel: [ 3191.171112] usb-storage: probe of 3-1:1.1 failed with error -5
Jul 3 10:56:51 mymachine kernel: [ 3191.171143] airprime 3-1:1.1: GSM modem (1-port) converter detected
Jul 3 10:56:51 mymachine kernel: [ 3191.171330] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1
Jul 3 10:56:51 mymachine kernel: [ 3191.225441] scsi11 : SCSI emulation for USB Mass Storage devices
Jul 3 10:56:56 mymachine kernel: [ 3194.912815] scsi 11:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
Jul 3 10:56:56 mymachine kernel: [ 3194.944743] sr1: scsi-1 drive
Jul 3 10:56:56 mymachine kernel: [ 3194.944943] sr 11:0:0:0: Attached scsi generic sg2 type 5
Kubuntu Hardy detected it just fine! This should work on any other distros as well. Next comes running wvdialconf as root. It should detect the modem at /dev/ttyUSB0. wvdialconf goes through some init sequences and finally writes the config file at /etc/wvdial.conf. Mine looks like this after a little bit of tweaking:
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Phone = *99***1#
ISDN = 0
Password = password
New PPPD = yes
Username = username
Modem = /dev/ttyUSB0
Baud = 9600
The phone number was found by a little Googling. You can use any Username and Password value as the dialler doesn't check for it. Once you're done, perform a test by executing wvdial. It should work. Here's what I see from my /var/log/messages:
Jul 3 10:58:10 mymachine pppd[21698]: pppd 2.4.4 started by mike, uid 1000
Jul 3 10:58:10 mymachine pppd[21698]: Using interface ppp0
Jul 3 10:58:10 mymachine pppd[21698]: Connect: ppp0 <--> /dev/ttyUSB0
Jul 3 10:58:10 mymachine pppd[21698]: PAP authentication succeeded
Jul 3 10:58:10 mymachine kernel: [ 3231.815307] PPP BSD Compression module registered
Jul 3 10:58:10 mymachine kernel: [ 3231.881861] PPP Deflate Compression module registered
Jul 3 10:58:13 mymachine pppd[21698]: Could not determine remote IP address: defaulting to xxx.xxx.xxx.xx
Jul 3 10:58:13 mymachine pppd[21698]: local IP address xxx.xxx.xxx.xx
Jul 3 10:58:13 mymachine pppd[21698]: remote IP address xxx.xxx.xxx.xx
Jul 3 10:58:13 mymachine pppd[21698]: primary DNS address xxx.xxx.xxx.xx
Jul 3 10:58:13 mymachine pppd[21698]: secondary DNS address xxx.xxx.xxx.xx
Jul 3 10:59:04 mymachine pppd[21698]: Terminating on signal 15
Jul 3 10:59:04 mymachine pppd[21698]: Connect time 0.9 minutes.
Jul 3 10:59:04 mymachine pppd[21698]: Sent 0 bytes, received 0 bytes.
Jul 3 10:59:04 mymachine pppd[21698]: Connection terminated.
Also make sure you're assigned an IP and use ifconfig to see that ppp0 interface is up and running.

Next, I tried to configure a dialup connection via KNetworkManager, but it's broken. A bug report has been filed here. Instead, I fired up KPPP and configured a new modem with the second init string (Init2) with the same values written in /etc/wvdial.conf. The phone number should follow that in the config file as well. Once you're done, fill in the username and password values and away you go :)

Have fun!

No comments: