splitbrain.org

electronic brain surgery since 2001

Huawai 3G UMTS Stick on Arch Linux

My EeePC is a great device when traveling but since it has no 3G modem I'm always dependent on WiFi. So it was time to get a solution.

What I learned just recently is that you can get a second SIM card from T-Mobile Germany for a one-time payment of 30€. And you can use that second card in a UMTS modem, reusing the data plan you already have on your contract. Now the great thing is, that I already got a UMTS flatrate with my iPhone contract. Excellent!

After some research I finally bought an UMTS USB stick and got it working with Arch Linux on my Eee. Here is how.


The Hardware

Let's start with the good news: there is Kernel support in the standard Arch Linux Kernel. Just plug in the stick and the correct drivers are loaded.

Here's what dmesg has to tell.

usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for GSM modem (1-port)
option 1-3:1.0: GSM modem (1-port) converter detected
usb 1-3: GSM modem (1-port) converter now attached to ttyUSB0
option 1-3:1.1: GSM modem (1-port) converter detected
usb 1-3: GSM modem (1-port) converter now attached to ttyUSB1
usbcore: registered new interface driver option
option: v0.7.2:USB Driver for GSM modems

lsusb lists the device as:

ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem

Now the hard part is to identify the stick ;-). While it is clear that Huawai is the manufacturer, the actual model number isn't clear at all. And it isn't made easier by the fact that Huawai seems to sell to Telcos only who then rebrand the device.

The lsusb line above suggests it to be the E220 model, but looking at Huawai's product line it's more probably a E176.

I bought the device as “T-Mobile web'n'walk Stick IV (weiss)”. The addition “weiss” (white) might be important, because T-Mobile Germany also sells this stick in pre-paid bundles but in black. Rumor is that those black sticks have a custom T-Mobile firmware that does not work on Linux. I have no idea if that is true.

The interesting thing is that such a pre-paid card bundle costs just about 50€ while the white stick without any contract is listed at 150€. However you can buy the stick at other sites for about 100€ and that's what I did.

Configuring PPP

The connection will be created by good old pppd. So install the package first:

$> sudo pacman -S ppp

The pppd needs kernel support. Best add the ppp_generic module to the module list in /etc/rc.conf:

MODULES=(ppp_generic)

Or to load it it manually use

$> sudo modprobe ppp_generic

Unlike other distros Arch doesn't ship any ip-up or ip-down scripts. So we need at least two very simple files to make DNS work correctly.

/etc/ppp/ip-up:

#!/bin/sh
# This script is run by pppd when there's a successful ppp connection.
if [ -e /etc/ppp/resolv.conf ]; then
    cp -f /etc/resolv.conf /etc/resolv.conf.pre-ppp
    cp -f /etc/ppp/resolv.conf /etc/resolv.conf
    chmod 644 /etc/resolv.conf
fi

/etc/ppp/ip-down:

#!/bin/sh
# This script is run by pppd after the connection has ended.
if [ -e /etc/resolv.conf.pre-ppp ]; then
    mv /etc/resolv.conf.pre-ppp /etc/resolv.conf
    chmod 644 /etc/resolv.conf
fi

Configuring wvdial

To ease the ppp setup we'll use wvdial:

$> sudo pacman -S wvdial

Now we can configure wvdial by creating a /etc/wvdial.conf file. Here's the one I use with T-Mobile Germany:

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 460800
 
[Dialer pin]
Init1 = AT+CPIN=1234
 
[Dialer provider]
Phone = *99***1#
Username = username
Password = password
Stupid Mode = 1
Dial Command = ATDT
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init4 = AT+CGDCONT=1,"IP","internet.t-mobile.de"

The above config should be correct for everyone using a Huawai E220 stick, but there are two values you need to adjust. The first is the 1234 in the pin section. Set that number to the PIN of your SIM card. The other thing you might need to change is the internet.t-mobile.de string. That's the access point name (APN) defined by your provider (check this list). The username and password are usually not used and can be left untouched.

Connecting

Now every time you connect your Huawai, you need to set the PIN first. This has to be (and in fact can only) be done once after powering the device. Just call wvdial like this:

$> sudo wvdial pin

Then you can connect to the internet like this:

$> sudo wvdial provider

To disconnect, press CTRL-C.

Getting some Statistics

Once you have a connection you might want to get some info about the current connection. You can get it from a small tool called he220stat.

Just download and compile it:

wget http://oozie.fm.interia.pl/src/he220stat.tar.bz2
tar -xjvf he220stat.tar.bz2
cd he220stat-0x03
./configure
sudo make install

Then run he220stat or xhe22stat.

Tags:
umts, 3g, linux, arch, huawai
Similar posts: