Calendar

<<February>>
MoTuWeThFrSaSu
  12345
6789101112
13141516171819
20212223242526
272829    

Huawei E160 and Linux

Sat, 27 Sep 2008 13:40 - Daniel - Other - Comments (7)


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.bz2
tar -xjf usb_modeswitch-0.9.4.tar.bz2
cd usb_modeswitch-0.9.4
./compile.sh
cp 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 ivman
ivman

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



< << 1 2