Linux and the Huawei E169G
13 May 2008 - 10:10Last Friday morning our ADSL broadband connection stopped working with the usual authentication failure messages. Being reluctant to phone up and be referred to the Indian call center to be talked through a script checking things I had already checked, I left it for a few hours in the hope that the fault would be detected and fixed. It wasn't, so I had to call. Nothing worked, the problem was "escalated" and I faced a weekend (at least) without Internet. So I decided to get a mobile data connection to use as a backup.
I chose a Broadband Lite package from 3, which is currently very inexpensive (half the regular price if you're already a 3 mobile phone customer.) I picked the Huawei E169G USB modem in black and chrome because it looks cool and matches my black Asus Eee PC. However, on getting it home the first problem I faced was that it was not detected by the Eee PC's Linux OS, nor the version I use on my Toshiba laptop. It's things like this that make you realize why Windows (or a Mac) are the right solutions for most people. When you have a problem that you urgently need to solve, you don't need further obstacles placed in your way before you can solve them.
Being Linux, there is a solution, as long as you are competent at searching with Google and confident about carrying out complex configuration tasks. But finding the solutions is quite hard if you don't have a working Internet connection! Fortunately, we still had an old Toshiba laptop running a copy if Windows XP, so I was able to install the USB modem on that to check that it was working, and then look for ways to get it going under Linux.
The problem with the E169G USB modem is that it is a dual mode device, also known as a ZeroCD device. When you first plug it in it makes itself look like a CD-ROM drive containing the Windows drivers for the device. This makes for a really easy install under Windows. Once the drivers are installed the device makes itself look like a modem. The trouble is, this switching doesn't happen automatically under Linux, so the OS doesn't even realize that the device is a modem at all.
I found the answer to getting the Huawei E169G USB modem working on the Eee PC on Dale Lane's blog. Actually, it's a lot easier than the blog entry makes it seem, since Dale describes all the trials and tribulations he encountered on the way to making it work. Basically, all you need to do is download a utility called USB_ModeSwitch, then use the Administrator mode File Manager to extract the executable binary from the file you downloaded and move it to a system folder like /usr/bin. After that, you plug in the modem, wait for the File Manager window to appear, then open an Administrator mode console, and issue two commands:
usb_modeswitch -v 0x12d1 -p 0x1001 -d 1 usb_modeswitch -v 0x12d1 -p 0x1001 -H 1
The first command disables the CD-ROM mode and the second enables the modem mode. After that, you can use the Eee PC's Configure Network Connections wizard to create an entry to start the connection.
If plugging in the stick on subsequent occasions causes the Eee PC File Manager to open displaying the contents of the virtual CD-ROM drive then you'll need to run these two commands every time before you try to use the device. If this becomes a bit of a pain, there are ways to automate it, though they involve some pretty advanced Linux hacking. I'm not an advanced Linux hacker, so don't ask me for advice if the following suggestion doesn't work for you, but it seems to work for me.
Using the Administrator mode file manager go to/etc/udev/rules.d and open 50-xandros-udev.rules in a text editor (it would be wise to make a copy if this file before changing it.) Search for the line that starts # Huewai Cards. This may appear twice - you want to change the first instance. Below this you will find about three lines that include the text SYSFS{idProduct}=="1003". If this section (between the # Huewai Cards comment and the next one) contains any lines that include SYSFS{idProduct}=="1001", delete them. (I recommend turning word wrap off in the editor before doing this, so that it is clear what a 'line' really is.) Then, before the lines for idProduct 1003, insert the following three lines:
BUS=="usb", SYSFS{idVendor}=="12d1", SYSFS{idProduct}=="1001",
RUN+="/usr/bin/usb_modeswitch -v 0x12d1 -p 0x1001 -d 1"
BUS=="usb", SYSFS{idVendor}=="12d1", SYSFS{idProduct}=="1001",
RUN+="/bin/sleep 5"
BUS=="usb", SYSFS{idVendor}=="12d1", SYSFS{idProduct}=="1001",
RUN+="/usr/bin/usb_modeswitch -v 0x12d1 -p 0x1001 -H 1"
Note that I have had to break each line at the RUN parameter so it didn't overrun the width of the page. If you copy and paste from here, join each pair of lines up to make three lines beginning "BUS ..." before you save.
Restart the computer to make it read the new file. Now the mode switching commands should be run automatically when the modem is plugged in. Hopefully this will stop the Eee PC responding as if a CD has been inserted every time you plug the modem in, and will result in the modem being ready to use when you start the network connection.
Since there are now newer versions of the Eee, which may have different configuration files, I can't guarantee that the steps described above will work on your computer, or even that they won't break something. Try at your own risk. Hopefully newer models will support the Huawei E169G out of the box.
The solution described here was not sufficient to get the modem working on my Toshiba laptop, even though it runs Xandros Desktop, an older version of the Linux used on the Asus Eee. But time is running out, so that solution will have to be the subject of a later posting.

Trackback link:Please enable javascript to generate a trackback url
Leave a comment