Install Huawei E220 HSDPA USB Modem on Slackware 12.2

Huawei E220 USB Modem is a powerfull device to be used as a modem to access internet. Currently the max speed can reach 7.2 Mbps (much more than enough for me to browse webs and download some files from internet). The speed you get will depend on your network cellular operator, whether you get the GPRS, 3G or HSDPA networks.

This tutorial is to help you installing the device on Linux, especially on Slackware 12.2 running kernel 2.6.27.7, installing softwares, and doing some configurations so we can dial using the modem to access internet. If you use Centos 5.4 or Fedora 12, click here for Centos 5.4 or here for Fedora 12 to follow the tutorials.

Here are the softwares you must have to follow this tutorial:
– huaweiAktBbo-i386.out. This tool is used to switch Huawei E220 to the correct mode for the serial ports.
You can download here
– wvstream (requirement for wvdial)
– wvdial (a tool for dialling the modem to your internet provider). You can download both wvstream and wvdial here.

I assume you already have pppd, gcc, and gnu make installed in your Linux system. If not, install them first!
To make it easier, create a directory /home/yours/download/huawei and store all the files above in it.

Lets go to the installations.
Firstly if you plug the modem in to the usb ports, the system will detect it automatically. Here are the logs on my
system after plugging in the modem to a usb port.

Jul 24 00:45:28 slackier kernel: usb 3-1: new full speed USB device using uhci_hcd and address 3
Jul 24 00:45:29 slackier kernel: usb 3-1: configuration #1 chosen from 1 choice
Jul 24 00:45:29 slackier kernel: scsi8 : SCSI emulation for USB Mass Storage devices
Jul 24 00:45:29 slackier kernel: usb 3-1: New USB device found, idVendor=12d1, idProduct=1003
Jul 24 00:45:29 slackier kernel: usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jul 24 00:45:29 slackier kernel: usb 3-1: Product: HUAWEI Mobile
Jul 24 00:45:29 slackier kernel: usb 3-1: Manufacturer: HUAWEI Technologies
Jul 24 00:45:29 slackier kernel: usbcore: registered new interface driver usbserial
Jul 24 00:45:29 slackier kernel: usbserial: USB Serial support registered for generic
Jul 24 00:45:29 slackier kernel: usbcore: registered new interface driver usbserial_generic
Jul 24 00:45:29 slackier kernel: usbserial: USB Serial Driver core
Jul 24 00:45:29 slackier kernel: usbserial: USB Serial support registered for GSM modem (1-port)
Jul 24 00:45:29 slackier kernel: option 3-1:1.0: GSM modem (1-port) converter detected
Jul 24 00:45:29 slackier kernel: usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0
Jul 24 00:45:29 slackier kernel: option 3-1:1.1: GSM modem (1-port) converter detected
Jul 24 00:45:29 slackier kernel: usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1
Jul 24 00:45:29 slackier kernel: usbcore: registered new interface driver option
Jul 24 00:45:29 slackier kernel: option: USB Driver for GSM modems: v0.7.2
Jul 24 00:45:34 slackier kernel: scsi 8:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
Jul 24 00:45:34 slackier kernel: sr 8:0:0:0: Attached scsi generic sg1 type 5

You can see above that the device is detected as a ‘Mass Storage’ and we will switch it to be the correct mode for

serials port. That’s why we need the ‘huaweiAktBbo-i386.out’ tool.

Change to the directory /home/yours/download/huawei. Make it executable and run it.

$ chmod +x huaweiAktBbo-i386.out
$ sudo ./huaweiAktBbo-i386.out
Hladam HUAWEI E220 a prepnem na modem - bbo 06
4 set feature request returned -1
Prepnute-OK, Mas ttyUSB0 ttyUSB1 (cez usbserial vendor=0x12d1 product=0x1003)
pozri /proc/bus/usb/devices

If there is no error, the tool run properly and the modem has been successfully switched to the correct mode serial ports.

Then, install wvstream and wvdial respectively. Install the wvstream first because it is a requirement before
installing the wvdial.

$ tar zxf wvstreams-4.6.tar.gz
$ cd wvstreams-4.6
$ ./configure && make && sudo make install

If there is no error, the wvstream has been successfully installed in the system.
Now the next step is install the wvdial tool.

$ tar zxf wvdial-1.60.tar.gz
$ cd wvdial-1.60
$ make && sudo make install

If there is no error, the tool has been successfully installed in /usr/local/bin directory or it depends on where you installed it.

The library files of wvstream and wvdial are installed in /usr/local/lib directory and you need to add this directory to /etc/ld.so.conf file and then run ‘sudo ldconfig’ to update the new installed shared libraries.

The next step, we will generate wvdial.conf file and store it in /etc folder. To generate it, we use ‘wvdialconf’ tool.

Run the below command and you will get logs showing on your screen like below:

$ sudo wvdialconf /etc/wvdial.conf
Editing \`/etc/wvdial.conf\'.

Scanning your serial ports for a modem.

Modem Port Scan<*1>: S0   S1   S2   S3
WvModem<*1>: Cannot get information for serial port.
ttyUSB0<*1>: ATQ0 V1 E1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB0<*1>: Modem Identifier: ATI -- Manufacturer: huawei
ttyUSB0<*1>: Speed 9600: AT -- OK
ttyUSB0<*1>: Max speed is 9600; that should be safe.
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
WvModem<*1>: Cannot get information for serial port.
ttyUSB1<*1>: ATQ0 V1 E1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB1<*1>: Modem Identifier: ATI -- Manufacturer: huawei
ttyUSB1<*1>: Speed 9600: AT -- OK
ttyUSB1<*1>: Max speed is 9600; that should be safe.
ttyUSB1<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found a modem on /dev/ttyUSB0.
/etc/wvdial.conf: Can not open /etc/wvdial.conf for reading: No such file or directory
/etc/wvdial.conf: ...starting with blank configuration.
Modem configuration written to /etc/wvdial.conf.
ttyUSB0: Speed 9600; init \"ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0\"
ttyUSB1: Speed 9600; init \"ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0\"

You can see that new modem configuration was written to /etc/wvdial.conf. Lets take a look at that file..

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
; Phone = 
ISDN = 0
; Username = 
Init1 = ATZ
; Password = 
Modem = /dev/ttyUSB0
Baud = 9600

Here you need to edit the value of Phone, Username, and Password to match your account of your cellular operator or whatever your internet provider. In this case I use IndosatM2 in Indonesia and the Phone number is ‘*99#’. After editing, the config file should look like this

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Phone = *99#
ISDN = 0
Username = secret
Init1 = ATZ
Password = secrettoo
Modem = /dev/ttyUSB0
Baud = 9600

All the configurations are complete and now it is the time to dial the modem using ‘wvdial’ tool/command. To see whats happen while dialling the modem, log it to a file e.g /var/log/wvdial.log

# wvdial > /var/log/wvdial.log 2>&1 
# tail -f /var/log/wvdial.log
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected.  Waiting for prompt.
--> Do not know what to do!  Starting pppd and hoping for the best.
--> Starting pppd at Fri Jul 24 01:17:26 2009
--> Pid of pppd: 9627
--> Using interface ppp0
--> pppd: ø½[07][08]À³[07][08]
--> pppd: ø½[07][08]À³[07][08]
--> pppd: ø½[07][08]À³[07][08]
--> pppd: ø½[07][08]À³[07][08]
--> pppd: ø½[07][08]À³[07][08]
--> pppd: ø½[07][08]À³[07][08]
--> local  IP address 114.59.39.38
--> pppd: ø½[07][08]À³[07][08]
--> remote IP address 10.64.64.64
--> pppd: ø½[07][08]À³[07][08]
--> primary   DNS address 202.155.0.10
--> pppd: ø½[07][08]À³[07][08]
--> secondary DNS address 202.155.0.15
--> pppd: ø½[07][08]À³[07][08]

Wow success. You can see I get the IP address and DNS address allocated dynamically from my cellular operator.

You have to manually  put those DNS addresses in /etc/resolv.conf file because the ‘wvdial’ will not write automatically for you.

Then try to ping or browse to internet.