Bug 740354

Summary: Huawei 3G usb modem E173 does not switch mode automatically
Product: [openSUSE] openSUSE 12.1 Reporter: Luiz Angelo Daros de Luca <luizluca>
Component: BasesystemAssignee: Gerhard Schlotter <gschlotter>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None CC: erich.klose, mcaj, sndirsch
Version: Final   
Target Milestone: ---   
Hardware: x86-64   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Luiz Angelo Daros de Luca 2012-01-09 20:37:28 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1

Hello,

When I plug the Huawei 3G usb modem E173, it does not change to "modem mode" using usb_modeswitch command. I still see the "storage id" in lsusb

$ $ lsusb | grep 12d1
Bus 001 Device 010: ID 12d1:1c0b Huawei Technologies Co., Ltd. 

The modem mode is "12d1:1c05"
According to udev, it should run usb_modeswitch:

$ grep -n 1c0b /lib/udev/rules.d/40-usb_modeswitch.rules
344:ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1c0b", RUN+="usb_modeswitch '%b/%k'"

I switched udev to debug mode:

# udevadm control --log-priority=debug

I found that it really runned usb_modeswitch:

Jan  9 18:22:04 linux udevd[15592]: RUN 'usb_modeswitch '%b/%k'' /lib/udev/rules.d/40-usb_modeswitch.rules:344
(...)
Jan  9 18:22:05 tresc020239 udevd[15592]: 'usb_modeswitch '/1-7:1.0'' [15619] exit with return code 0

But nothing happened! I still get the same usbid in lsusb and no modem is detected.

However, it I run it manually, it works:

# /lib/udev/usb_modeswitch '/1-7:1.0'

usbid changes and network manager detects it.

$ lsusb | grep 12d1
Bus 001 Device 015: ID 12d1:1c05 Huawei Technologies Co., Ltd.

Alternatively, I can run usb_modeswitch directly

sudo usb_modeswitch -c /usr/share/usb_modeswitch/12d1\:1c0b

Maybe it is just some missing env variable or udev undo the switch afterwards.

Reproducible: Always

Steps to Reproduce:
1. Plug the modem

Actual Results:  
2. No modem is detected

Expected Results:  
2. when udev called usb_modeswitch, it should switch mode
Comment 1 Hannes Reinecke 2012-01-11 11:03:28 UTC
Too bad.
Comment 2 Oliver Neukum 2012-01-16 08:23:13 UTC
(In reply to comment #0)
 
> $ lsusb | grep 12d1
> Bus 001 Device 015: ID 12d1:1c05 Huawei Technologies Co., Ltd.
> 
> Alternatively, I can run usb_modeswitch directly
> 
> sudo usb_modeswitch -c /usr/share/usb_modeswitch/12d1\:1c0b
> 
> Maybe it is just some missing env variable or udev undo the switch afterwards.

If udev undid the change you'd see udev logging that.
This looks at first glance unfortunately like a timing issue.

In /lib/udev/rules.d/40-usb_modeswitch.rules please replace

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1c0b", RUN+="usb_modeswitch
'%b/%k'"

with

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1c0b", RUN+="sleep 10 ; usb_modeswitch '%b/%k'"
Comment 3 Luiz Angelo Daros de Luca 2012-01-16 18:49:48 UTC
Yes, I confirmed that it is a timing issue. However I had to add sleep inside /lib/udev/usb_modeswitch as uded does not accept multiple commands (separated with ";") in its config file.

BTW, for older modems (also from Huawei), it worked without the sleep.
Comment 4 Oliver Neukum 2012-01-17 11:12:02 UTC
Can you please test whether the existing -w option does the job?
Comment 5 Luiz Angelo Daros de Luca 2012-01-17 15:30:00 UTC
Which "existing -w option" are you talking about?

There is no option like this in /lib/udev/usb_modeswitch.
Comment 6 Erich Klose 2012-01-25 09:27:13 UTC
I had the same problem wit a E-156 usb modem.

I found out that udev looks for /lib/udev/modem-modeswitch and we have lib/udev/usb_modeswitch . So I copied it under the new name and now it works. I have to boot with the usb-stick, after I've to disconnect it, and when I plug it again it ask me for pin and root-pwd.After I can find it in the network-manager from kde.
After I enable it there and it works.
Comment 7 Oliver Neukum 2012-01-26 16:42:48 UTC
What did you do to find this out?
Comment 8 Erich Klose 2012-01-26 17:36:39 UTC
I plugged the usb-stick during booting. After I read the logfile.There it was written that he look for /lib/udev/modem-modeswitch.So I made a test.

It was in 11.3 or like this when I've to look for /etc/udev/rules.d/55-umts.rules
to start it running. I means it wasn't new for me to hunt this modeswitch problems.And sometimes you need luck too.

I hope it help you for fixing the rpm.

Greetings Erich
Comment 9 Martin Caj 2012-04-20 14:35:23 UTC
I had the same trouble with this modem on the OpenSuse 12.1. 

It looks like time trouble and after two days testing and searching on the web I found very easy fix /workaround.

Just add the one line into the config file for the modem.
echo WaitBefore=3 >>/usr/share/usb_modemswitch/12d1\:1c00

After 3 seconds the moddem will appeared in the NetworkManager - if you are using it.

Can you test it and latter add into package fix ?


Martin
Comment 10 Stefan Dirsch 2012-09-28 09:49:41 UTC
(In reply to comment #5)
> Which "existing -w option" are you talking about?
> 
> There is no option like this in /lib/udev/usb_modeswitch.

It's mentioned in the manual page

       -w --release-delay NUM
                 After issuing all bulk messages, wait  for  NUM  milliseconds
                 before  releasing the interface.  Required for some modems on
                 older systems (especially after an EJECT message)

but *not* in "usb_modeswitch --help" output. Also it's missing in the header
of the manual page. So there is another bug.

So the idea whould be to use

  usb_modeswitch -w 10000 '%b/%k

in the udev rule.
Comment 11 Stefan Dirsch 2012-09-28 09:53:39 UTC
(In reply to comment #8)
> I plugged the usb-stick during booting. After I read the logfile.There it was
> written that he look for /lib/udev/modem-modeswitch.So I made a test.
> 
> It was in 11.3 or like this when I've to look for
> /etc/udev/rules.d/55-umts.rules
> to start it running. 

Seems you have two udev rules for the same device on your system. And the wrong/ outdated one wins. Is /etc/ude/rules.d/55-umts.rules still part of a package?
Which one?
Comment 12 Stefan Dirsch 2012-09-28 10:25:34 UTC
(In reply to comment #9)
> I had the same trouble with this modem on the OpenSuse 12.1. 
> 
> It looks like time trouble and after two days testing and searching on the web
> I found very easy fix /workaround.
> 
> Just add the one line into the config file for the modem.
> echo WaitBefore=3 >>/usr/share/usb_modemswitch/12d1\:1c00
> 
> After 3 seconds the moddem will appeared in the NetworkManager - if you are
> using it.

Possible, but there is no

  usb_modeswitch.d/12d1:1c00

file available for patching, but we can use usb_modeswitch"s "-w" option here. I guess WaitBefore is specified in seconds. Then this would be 3000 ms.

Gerhard, could take care of these two changes, i.e. another udev rule for 12d1:1c00 device and the change in usb_modeswitch.d/1c0b? Thanks.
Comment 13 Gerhard Schlotter 2012-09-28 12:50:36 UTC
submit request created for 12.1 (#136348) and 12.2 (#136349).
Comment 14 Gerhard Schlotter 2012-09-28 13:09:54 UTC
submit request created for Factory (#136358)
Comment 15 Bernhard Wiedemann 2012-09-29 14:00:08 UTC
This is an autogenerated message for OBS integration:
This bug (740354) was mentioned in
https://build.opensuse.org/request/show/136413 Factory / usb_modeswitch
Comment 16 Swamp Workflow Management 2012-10-08 12:09:39 UTC
openSUSE-RU-2012:1311-1: An update that has one recommended fix can now be installed.

Category: recommended (low)
Bug References: 740354
CVE References: 
Sources used:
openSUSE 12.2 (src):    usb_modeswitch-1.2.3-2.5.1
openSUSE 12.1 (src):    usb_modeswitch-1.1.7-4.4.1