Huawei E160 and Linux
Sat, 27 Sep 2008 13:40 - Daniel - Other - Comments (3)
I recently got a Huawei E160 3G modem and use it on my Asus EEE 701 for mobile browsing. Since the E160 has two modes. In the default mode it acts like a read only USB drive, in the second mode, the modem is available. To change between these modes, you need a tool called usb_modeswtich.
The solution I'm describing here works on my EEE with fluxflux (a PCLinuxOS-remaster). It should work with other distributions too, but I havn't tested it. This solutions is based on Thomas Schönhütl's post about how to get the E169 working with fluxflux (german).
First, we need to get usb_modeswitch and compile it. You need libusb-dev (or libusb-devel on some distros) installed for this.
wget http://www.draisberghof.de/usb_modeswitch/usb_modeswitch-0.9.4.tar.bz2tar -xjf usb_modeswitch-0.9.4.tar.bz2cd usb_modeswitch-0.9.4./compile.shcp usb_modeswitch /usr/local/bin/
Now install ivman. Ivman is a daemon to auto-mount and manage media devices. We'll use ivman to run usb_modeswitch when the E160 is connected. I tried to do this with udev but failed. If anyone is successfull by doing it with udev, let me know.
apt-get install ivmanivman
Add ivman to you autostart. In ubuntu you can do this by going to System->Preferences->Sessions and adding a new Startup Program.
Now, lets adjust the ivman config file. Open $HOME/.ivman/IvmConfigActions.xml and add this befor </ivm:ActionsConfig>
<!-- Change Huawei E160 Mode -->
<ivm:Match name="hal.storage.physical_device" value="/org/freedesktop/Hal/devices/usb_device_12d1_1003_noserial_if0">
<ivm:Option name="exec" value="xterm -e $HOME/.e160.sh" />
</ivm:Match>
Now create a file named .e160.sh in you home folder and open it with you favourite text editor. Paste this to the file
!/bin/bash
if [ -z "`/bin/ls /dev/ttyUSB0`" ]; then
if [ "`/usr/sbin/lsusb | grep 12d1 | cut -d : -f3 | cut -b -4`" = "1003" ]; then
/usr/local/bin/usb_modeswitch -v 12d1 -p 1003 -d 1
/usr/local/bin/usb_modeswitch -v 12d1 -p 1003 -H 1
fi
fi
Save the file and make it executable.
chmod +x .e160.sh
Restart ivman (or reboot) and the next time you connect you E160 3G modem, it should be switched to the correct mode automatically.
Tags: e160 linux huawei 3g umts ivman
Comments
Dan Finnimore, United Kingdom - Tue, 06 Jan 2009 09:53
Many thanks for the above help.
I have a e160g and am using debian 2.04 etch. I have managed to do all of the above except pasting the script into /ivm:ActionsConfig>, as I cannot locate the correct place to paste.
Your extra help would be appreciated
Dan
Daniel, Austria - Tue, 06 Jan 2009 13:47
In your home folder should be a file named .ivman/IvmConfigActions.xml containing some xml code. Just past the above snipped at the bottom of the file but before the last xml tag () and you should be fine.
Mubarak Adam, Kenya - Mon, 09 Feb 2009 07:15
Hi,
Was refered here by Mr. Alan Orth of alaninkenya.org.
Same scenario, did what you have said here and voila... works like a charm.
Good day.