Huawei E620 3G data card and Linux (TeliaSonera Sweden)

Huawei E620 3G data card with Telia

In the fall of 2006 I bought a Huawei 3G data card along with a 12-month subscription for data traffic in the 2G, 2,5G and 3G networks of the Swedish operator TeliaSonera (Telia). The startup fee included the Huawei data card which was bundled with the subscription. 89 SEK a month includes free data traffic during off-peak hours which means between 1900 hrs and 0700 hours and weekends. The price per megabyte during peak hours is 15 SEK which is rather expensive. You better think twice before plugging in the card!

Note: This price plan is no longer available and hasn't been for quite some time now. (2009-08-05)

The data card comes with drivers and a neat control application for Windows but for Linux users, a little bit of hacking is needed to get that card to work. I will try to describe how I finally managed to use the 3G data connection on my laptop (IBM Thinkpad X31) running Ubuntu 6.10 (Edgy Eft).

IBM Thinkpad X31 with Huawei E620 data card

First of all, let's see what the standard kernel says about the card when we plug it in. A dmesg log follows:

[  119.336000] pccard: CardBus card inserted into slot 0
[  119.524000] ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
[  119.524000] PCI: Enabling device 0000:03:00.0 (0000 -> 0002)
[  119.524000] ACPI: PCI Interrupt 0000:03:00.0[A] -> Link [LNKA] -> GSI 11 (level, low) -> IRQ 11
[  119.524000] PCI: Setting latency timer of device 0000:03:00.0 to 64
[  119.524000] ohci_hcd 0000:03:00.0: OHCI Host Controller
[  119.528000] ohci_hcd 0000:03:00.0: new USB bus registered, assigned bus number 5
[  119.528000] ohci_hcd 0000:03:00.0: irq 11, io mem 0xc4000000
[  119.612000] usb usb5: configuration #1 chosen from 1 choice
[  119.612000] hub 5-0:1.0: USB hub found
[  119.612000] hub 5-0:1.0: 1 port detected
[  119.716000] PCI: Enabling device 0000:03:00.1 (0000 -> 0002)
[  119.716000] ACPI: PCI Interrupt 0000:03:00.1[B] -> Link [LNKA] -> GSI 11 (level, low) -> IRQ 11
[  119.716000] PCI: Setting latency timer of device 0000:03:00.1 to 64
[  119.716000] ohci_hcd 0000:03:00.1: OHCI Host Controller
[  119.716000] ohci_hcd 0000:03:00.1: new USB bus registered, assigned bus number 6
[  119.716000] ohci_hcd 0000:03:00.1: irq 11, io mem 0xc4001000
[  119.800000] usb usb6: configuration #1 chosen from 1 choice
[  119.804000] hub 6-0:1.0: USB hub found
[  119.804000] hub 6-0:1.0: 1 port detected
[  122.476000] usb 5-1: new full speed USB device using ohci_hcd and address 2
[  122.692000] usb 5-1: configuration #1 chosen from 1 choice
[  123.072000] usbcore: registered new interface driver usbserial
[  123.076000] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[  123.076000] usbcore: registered new interface driver usbserial_generic
[  123.076000] drivers/usb/serial/usb-serial.c: USB Serial Driver core
[  123.084000] drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
[  123.084000] pl2303 5-1:1.0: pl2303 converter detected
[  123.084000] usb 5-1: pl2303 converter now attached to ttyUSB0
[  123.084000] pl2303 5-1:1.1: pl2303 converter detected
[  123.084000] usb 5-1: pl2303 converter now attached to ttyUSB1
[  123.084000] pl2303 5-1:1.2: pl2303 converter detected
[  123.084000] usb 5-1: pl2303 converter now attached to ttyUSB2
[  123.084000] usbcore: registered new interface driver pl2303
[  123.084000] drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver
[  123.136000] drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)
[  123.136000] usbcore: registered new interface driver option
[  123.136000] drivers/usb/serial/option.c: USB Driver for GSM modems: v0.7.1

This tells us that the Huawei E620 contains a PCMCIA-to-USB controller AND a USB-to-serial controller. The latter one is the popular PL2303 from Prolific and we got three new serial ports: ttyUSB0, ttyUSB1 and ttyUSB2.

We will only need the first serial port on the card, in this case ttyUSB0.

The card is a modem and we would like to start a PPP connection. When only plugged in, the LED on the card starts flashing green with two blinks at the time. It is not yet connected to the GSM or 3G network since the PIN code is still not provided.

Providning the PIN code for this mobile device could be done in more than one way. The serial terminal way or the more convenient "wvdial way". Directly below is the previous solution which I do not recommend. I kept the text for those who are interested. :-)  Go for the wvdial solution further below instead.

 

In the first case I use minicom. In a terminal window, write:

sudo minicom

If you don't already have minicom installed, you may need to

sudo apt-get install minicom

before running it... :-)

Settings: (CTRL+A and then O), Serial port setup:

Serial device: /dev/ttyUSB0
Bps/Par/Bits: 115200 8N1
Hardware flow control: No
Software flow control: Yes

(I didn't change the modem init string.)

Save these settings as default. You may need to restart minicom.

Now, the last output from the modem should be "OK" on a single line. It's time to provide the PIN code (in this example, the PIN is 1234):

at+cpin=1234

Another "OK" should show up which means that the modem accepted this command. The behavior of the LED on the data card should change to single blinks in a blue OR green color depending on the coverage of 3G. The data card prefers 3G when it's available, indicating this with blue blinks. GPRS/EDGE is indicated with green colour.

The data card is connected to the mobile network and we're just a few steps from being connected to the Internet. You can now exit minicom.

 

UPDATE 2008-03-05:

Providing a PIN code and connecting through wvdial

 

The package wvdial is needed for making the PPP connection and of course also when sending the PIN through a special parameter. If you don't have wvdial, go to Synaptic and install it or type the following line:

sudo apt-get install wvdial

 

If you haven't used wvdial on your computer before, the content in the file /etc/wvdial.conf can be replaced with the following (use your favourite editor):

[Dialer defaults]
Modem = /dev/ttyUSB0

[Dialer telia]
Modem = /dev/ttyUSB0
Baud = 115200
Init2 = AT+CGDCONT=1,"IP","online.telia.com"
Phone = *99#
Username = gprs
Password = internet
New PPPD = yes
Auto DNS = 1

[Dialer pin]
Modem = /dev/ttyUSB0
Baud = 115200
Init1 = AT+CPIN=1234

 

If you used the serial terminal solution for sending the PIN code, the [Dialer pin] part is not needed. But when using wvdial for sending the PIN code, type:

wvdial pin

and wait a couple of seconds for the device to register with you mobile access provider. The behavior of the LED on the data card should change to single blinks in a blue OR green color depending on the coverage of 3G. The data card prefers 3G when it's available, indicating this with blue blinks. GPRS/EDGE is indicated with green colour.

Now, type this command at the terminal prompt:

wvdial telia

You should see the modem connecting by looking at the output from wvdial. There could be pauses of a few seconds but when the LED on the data card is lit continuously, the PPP link is up and running! The color of the light from the LED tells us whether it's a 3G or GPRS/EDGE connection (see above).

Connected to 3G network

DNS servers will be set in /etc/resolv.conf. However, the only host that your computer knows about through the data card is that one single host to which it has a PPP connection. The routes on my computer looks like this just after a successful connection with wvdial:

 

 

Destination
Gateway
Genmask
Flags
Metric
Ref
Use
Iface
10.64.64.64
0.0.0.0
255.255.255.255
UH
0
0
0
ppp0

 

Open a new terminal window and type the following:

sudo route add -net 10.0.0.0 netmask 255.0.0.0 ppp0
sudo route add default gw 10.64.64.64

UPDATE 2008-03-05: the first line seems to be unneccesary now. I use Ubuntu Linux 7.10 Gutsy Gibbon.

You can now try to ping SUNET:

ping ping.sunet.se

 

If you get replies, everything should be working!

When finished, go back to the wvdial terminal window and press CTRL+C. This will stop the PPP connection.

 

This is just a quick guide that I hope can be useful for those of you trying to use PCMCIA 3G data cards in Linux. I'm sure the whole setup can be scripted and made as simple as when using the Windows-based control application. The setup above is for Huawei E620 connecting to Telia but can certainly be modified for another operator.