Installation of simyo Huawei E220 under Linux
Last friday I wrote about how to install a Huawei E220 modem under MacOSX. Today I will write the corresponding HowTo for Linux.
Usually installation of hardware with non-free drivers is a bit more difficult in Linux than in MacOS and Windows, because the drivers are only made for the latter two. However the E220 is well supported by the Linux kernel (starting at 2.6.20, apparently), so we only need to tweak some configuration files.
1 – Make the system see it properly
The Huawei E220 is a dual machine: apart from being a modem, it is also an USB flash device, with some space to save the Mac/Windows drivers, so that it will “autoinstall” when plugging it under those OSs.
This adds a small level of difficulty, because we have to make sure that the OS sees it as a modem, not as a storage device. In principle the command dmesg (or the file /var/log/messages) will tell us about it. However, I have had it work when dmesg would say that it was a storage device!
The short story is that some [[Kernel (computer science)|kernel modules]] must be loaded, and some others unloaded, when you plug the device. Needed modules: option, usbserial, ppp_async. Must not be present: airprime. In my case usb_storage made no harm, some people say you should unload it. For airprime not to be automatically loaded, put it in some [[Modprobe#Blacklist|blacklist]] file in /etc/modprobe.d/. I decided to add the following line to /etc/modprobe.d/blacklist-modem:
You can ensure the required modules are loaded by taking advantage of [[udev]], but it is not really necessary (in my case it wasn’t). udev can also give you a consistent name for the modem. For me the relevant device was always /dev/ttyUSB0, but you can make it /dev/huawei if you will. For that, you can put the following optional rules in a file in /etc/udev/rules.d/ (for example create 55-huawei.rules):
BUS==”usb”, SYSFS{idProduct}==”1003″, SYSFS{idVendor}==”12d1″, RUN+=”/sbin/modprobe option”
BUS==”usb”, SYSFS{idProduct}==”1003″, SYSFS{idVendor}==”12d1″, RUN+=”/sbin/modprobe ppp_async”
Two notes: the strings in idProduct and idVendor are obtained running the command lsusb when the modem is plugged. It will show something like:
This is a very neat trick for any USB device we want to manage with udev. The second note is that [[kppp]] (see later) only allows to choose a modem device from a list. If you make the modem be /dev/huawei, you will not be able to use kppp, since that device won’t appear in the list.
2 – Configure wvdial / kppp
You can make use of programs such as [[wvdial]] or [[kppp]] to make the actual connection. I use kppp myself, but that’s up to you (wvdial is apparently more flexible).
wvdial
To use it you have to create a /etc/wvdial.conf file. You can achieve this by running wvdialconf as root, or editing the file by hand, if you are brave.
For me, the output of wvdialconf yielded:
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.
Modem configuration written to /etc/wvdial.conf.
ttyUSB0
ttyUSB1
And my current /etc/wvdial.conf looks as follows:
;Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
ISDN = 0
New PPPD = yes
Modem = /dev/ttyUSB1
Baud = 9600
[Dialer simyo]
Dial Command = ATDT
Phone = *99#
Init2 = ATZ
Init4 = ATE0V1&D2&C1S0=0+IFC=2,2
Init3 = AT+CGDCONT=1,”IP”,”gprs-service.com“;
Stupid Mode = 1
Modem Type = Analog Modem
ISDN = 0
Modem = /dev/ttyUSB0
Username = whatever
Password = whatever
Baud = whatever
In bold, the relevant user-provided settings. In italics, some items in which you can put whatever, because it doesn’t seem to make a difference.
To connect, run wvdial simyo (or whatever you put in the “[Dialer xxx]” setting above), in the command line. To terminate, Ctrl+C.
kppp
This is the one I use. To open the config/run dialog, run kppp (you can do this as user). There you will have to configure two things: the account and the modem. By pressing “Configure” you will be presented with a window with four tabs. In the first one you will create a new account, in which the relevant data is:
- Phone number: *99#
- Authentication: PAP/CHAP
- Callback type: none
In the second tab you will configure the modem:
- Modem device: /dev/ttyUSB0
- Flow control: Hardware
- Line termination: CR/LF
- Connection speed: 921600
Please note that those are parameters that work for me. I can not assure that they are the “correct” ones. I have player around with different values, and many times the modem would work all the same with different settings. If you find some error in my setup, please tell me :^)
First impressions on a Neo FreeRunner | handyfloss said,
January 13, 2009 @ 18:50 pm
[…] of the SIM card are supported, so I will try to get hold of one (by the way, the simyo card I posted about some time ago works […]
Thomas said,
February 23, 2009 @ 22:49 pm
Thanks for your careful documentation on how to install the 3G modem with Simyo. I got mine to work right away with my eeepc1000 using wvdial and your /etc/wvdial.conf.
isilanes said,
February 23, 2009 @ 23:53 pm
Hi, Thomas! Thanks for caring to read the blog :^) Remind me to invite you for a beer next time I see you!