Page 1 of 1

Huawei E173s

Posted: 17 Aug 2011, 23:37
by giox069
I'm using Ubuntu 11.04 with a 3G Huawei E173s usb stick.
This stick is listed in both UDEV rules (file: /lib/udev/rules.d/40-usb_modeswitch.rules) and in usb-modeswitch-data package (file: /usr/share/usb_modeswitch/configPack.tar.gz).
Whei I plug the E173s in my laptop, usb_modeswitch is unable to switch correctly the card to 3G modem. lsusb still shows the "storage mode" vendor and device IDs, and not the correct 3G modem ones.

So I changed /lib/udev/rules.d/40-usb_modeswitch.rules to insert a homemade script:

Code: Select all

# Huawei E173s
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1c0b", RUN+="/home/gio/a.sh '%b/%k'"
and this is the /home/gio/a.sh script:

Code: Select all

#!/bin/bash
sleep 2
/lib/udev/usb_modeswitch $* > /tmp/gio_out 2>&1
just adding a two second delay before calling usb_modeswitch did the trick: the E173s switches to modem mode and an ubuntu popup asks me the PIN of the SIM.
(please also note that /lib/udev/usb_modeswitch is not the standard usb_modeswitch but it's the one provided with udev which, in turn, calls /usr/sbin/usb_modeswitch_dispatcher which calls the standard /usr/sbin/usb_modeswitch)

Now my question are:

What is the better way to achieve the same result without this "dirty" script ? Is possible to tell usb_modeswitch to do an extra delay ? Or sould be udev instructed to wait for some other event before calling usb-modeswitch ? Has it already been fixed ?


Thank you
Giovanni

Re: Huawei E173s

Posted: 18 Aug 2011, 18:59
by Josh
giox069 wrote:What is the better way to achieve the same result without this "dirty" script ? Is possible to tell usb_modeswitch to do an extra delay ? Or sould be udev instructed to wait for some other event before calling usb-modeswitch ? Has it already been fixed ?
Unfortunately, the whole switching process tends to be timing-sensitive. It depends on software but also on hardware variations. There is no way to test all possible setups ...

But, yes, there is a parameter that you can put into the config file for the E173s:

Code: Select all

WaitBefore=2
This does pretty much the same thing as your script, but it sure looks better :roll:


Re: Huawei E173s

Posted: 18 Aug 2011, 23:28
by giox069

Code: Select all

WaitBefore=2
This does pretty much the same thing as your script, but it sure looks better :roll:
Wonderful ! It works :) Tested on two 3G sticks from H3G Italy in two different PCs.
Thank you

I also found this post http://www.draisberghof.de/usb_modeswit ... .php?t=552 and their final solution was to add
WaitBefore=3. So my resulting file is:

/etc/usb_modeswitch.d/12d1:1c0b

Code: Select all

#######################################################
# Huawei E173s

DefaultVendor= 0x12d1
DefaultProduct=0x1c0b

TargetVendor=  0x12d1
TargetProductList="1c05,1c08"

MessageContent="55534243123456780000000000000011062000000100000000000000000000"

CheckSuccess=20

WaitBefore=3