Huawei E220 3G data card and Linux (Tele2 Sweden)
In August 2007 my employer ordered a 3G data card with a subscription from Tele2 Sweden.
The deal is as follows:
Setup fee: 295 SEK
USB 3G modem: 1195 SEK (not locked to any operator!!)
99 SEK / month during year 1 and then
199 SEK / month
Minimum 12 months in total.
Unlimited data traffic 24/7.*
* "Unlimited data" was back in the good old days before 3G data became too popular (according to the operators). The type of 3G contract at Tele2 that is closest to the one mentioned above costs 219 SEK / month with a data transfer limit of 5 GB per month. / M. Lantto 2009-07-30
All prices include 25 % Swedish VAT.
During the last year, USB-connected modems have become more and more popular. They are easier to connect to a stationary computer which normally lacks the PCMCIA connector used on other types of data cards. Of course it is also possible to connect the USB modem to a laptop computer, however my personal opinion is that a PCMCIA 3G data card looks better in those cases. :-) The USB modem is attached to the computer through a short USB cable which means that it will be hanging from the USB port. Well... it still works. It's just a matter of aestethics.
Since I earlier this year got the E620 PCMCIA card to work in Linux I had to give this one a try also. When connecting it to a Windows computer it behaves BOTH as a USB mass storage device , just like a USB memory stick, AND a serial device which is the most important part.
The "mass storage" part contains a setup kit with drivers and software for Windows, hopefully simplifying the setup procedure for a Windows user. This is definately the case for those who want to connect the USB modem to a laptop computer without a CD/DVD unit. For Linux users, this part won't do any good. Instead, this complicates the setup as the kernel modules "see" some kind of mass storage part and not the three serial ports that should be there. Compare this to the Huawei E620. In my case, I can see ONE serial port but i can't communicate with the device through it.
I run Ubuntu 7.04 Feisty Fawn on a hp compaq d230T tower-model computer.
When connecting the USB 3G modem, dmesg shows (after a while):
[88880.487879] usb 3-2: new full speed USB device using uhci_hcd and address 16
[88880.650836] usb 3-2: configuration #1 chosen from 1 choice
[88880.653861] usb-storage: device ignored
[88880.653915] option 3-2:1.0: GSM modem (1-port) converter detected
[88880.654389] usb 3-2: GSM modem (1-port) converter now attached to ttyUSB0
The command lsusb shows (only the interesting part listed):
Bus 003 Device 017: ID 12d1:1003
We will have to unload the usb-storage module and the usbserial module because it has to be reloaded with a few parameters pointing out the USB device. This way, the three serial ports will hopefully become visible and ready for use.
Open a terminal and run the following commands:
sudo rmmod usb-storage
sudo rmmod option
sudo rmmod usbserial
sudo modprobe usbserial vendor=0x12d1 product=0x1003
This removes the modules usb-storage and usbserial. In my case I needed to also unload the module option before unloading usbserial. Note the parameters to the modprobe command and compare it to the output from lsusb. Other versions of this USB modem could possibly use other product ID:s so take notice of which one you have.
A new output from dmesg:
[89741.143539] usbcore: registered new interface driver usbserial
[89741.145025] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[89741.236714] usbserial_generic 3-2:1.0: generic converter detected
[89741.239522] usb 3-2: generic converter now attached to ttyUSB0
[89741.240026] usbserial_generic 3-2:1.1: generic converter detected
[89741.248096] usb 3-2: generic converter now attached to ttyUSB1
[89741.248587] usbserial_generic 3-2:1.2: generic converter detected
[89741.251995] usb 3-2: generic converter now attached to ttyUSB2
[89741.252443] usbcore: registered new interface driver usbserial_generic
[89741.252454] drivers/usb/serial/usb-serial.c: USB Serial Driver core
Yes!! :-)
We will need ppp and wvdial. Make sure you have them installed (sudo apt-get [insert package name here]).
My wvdial.conf for Tele2 (only the PIN code is changed to 1234):
[Dialer defaults]
Modem = /dev/ttyUSB0
[Dialer tele2]
Modem = /dev/ttyUSB0
Baud = 115200
Init2 = AT+CGDCONT=1,"IP","internet.tele2.se"
Phone = *99#
Username = *
Password = *
New PPPD = yes
Auto DNS = 1
[Dialer pin]
Modem = /dev/ttyUSB0
Baud = 115200
Init1 = AT+CPIN=1234
Time to connect to Internet! First, unlock the SIM with your PIN code as specified in wvdial.conf:
wvdial pin
You can see the LED on the device changing color from green to blue. When this is done, run:
wvdial tele2
If this fails (sometimes I get "modem not responding"), try to unplug the modem and repeat from unloading the modules (rmmod...))
If the connection succeeds you should see wvdial output something like this:
--> Carrier detected. Waiting for prompt.
--> Don't know what to do! Starting pppd and hoping for the best.
--> Starting pppd at Thu Sep 27 13:04:29 2007
--> Warning: Could not modify /etc/ppp/pap-secrets: Permission denied
--> --> PAP (Password Authentication Protocol) may be flaky.
--> Warning: Could not modify /etc/ppp/chap-secrets: Permission denied
--> --> CHAP (Challenge Handshake) may be flaky.
--> Pid of pppd: 15838
--> Using interface ppp0
--> local IP address 83.188.171.59
--> remote IP address 10.64.64.64
--> primary DNS address 130.244.127.161
--> secondary DNS address 130.244.127.169
Now we are online! The resolv.conf should be updated automatically setting the DNS servers correctly. You will need to make sure your system knows about the default gateway. Open another terminal window and check your routing table:
route -n
Kernel IP routing table
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
As we can see here, there is no default gateway set. Your system knows that the host 10.64.64.64 is reachable through ppp0 which is your 3G data connection. This is also the default gateway:
sudo route add default gw 10.64.64.64
That's it! Now, try opening a web browser and loading a webpage.
Happy surfing!
I don't claim this setup to be optimal. Maybe it won't use the full HSDPA capabilities when they become available. I will update this page as soon as I get more info about it. For me, this works OK and makes it possible to use the E220 in Linux.
References
http://ubuntuforums.org/showthread.php?t=262867
Previous page: Huawei E620 3G data card and Linux (TeliaSonera Sweden)
Next page: WLAN