Author Message

<  Setup Discussion  ~  Huawei E173s

PostPosted: Wed Aug 17, 2011 11:37 pm Reply with quote
Posts: 3Joined: Wed Aug 17, 2011 11:20 pm
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:
# 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:
#!/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


Offline Profile
PostPosted: Thu Aug 18, 2011 6:59 pm Reply with quote
Site AdminPosts: 6239Joined: Sat Nov 03, 2007 12:30 am
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:
WaitBefore=2
This does pretty much the same thing as your script, but it sure looks better :roll:



Offline Profile
PostPosted: Thu Aug 18, 2011 11:28 pm Reply with quote
Posts: 3Joined: Wed Aug 17, 2011 11:20 pm
Quote:
Code:
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_modeswitch/bb/viewtopic.php?t=552 and their final solution was to add
WaitBefore=3. So my resulting file is:

/etc/usb_modeswitch.d/12d1:1c0b
Code:
#######################################################
# Huawei E173s

DefaultVendor= 0x12d1
DefaultProduct=0x1c0b

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

MessageContent="55534243123456780000000000000011062000000100000000000000000000"

CheckSuccess=20

WaitBefore=3



Offline Profile

Display posts from previous:  Sort by:

All times are UTC + 1 hour [ DST ]
Page 1 of 1
3 posts
Users browsing this forum: No registered users and 1 guest
Search for:
Post new topic  Reply to topic
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum