Hi Klaus, and thanks for your bugreport.

Le mardi 14 avril 2009 09:34:05 Klaus Ade Johnstad, vous avez écrit :
> Package: usb-modeswitch
> Version: 0.9.6-2
> Severity: normal
>
> usb-switchmode seems not to work out-of-the-box. I need to remove the
> supplied /etc/udev/rules.d/usb_modeswitch.rules, otherwise it seems not to
> want to switch.
>
> I have captured what happens:
> :~# #insert zte mf636 modem
> :~# lsusb
>
> Bus 004 Device 014: ID 19d2:2000 ONDA Communication S.p.A.
>
> :~# usb_modeswitch -v 0x19d2 -p 0x2000 -V 0x19d2 -P 0x0031  -m 0x01 -M
> : 55534243123456782000000080000c85010101180101010101000000000000

(…)> … Errors due to the fact that a udev rule with different parameters was 
run 
first.

The idea of the udev rules is that you _do_not_ need to run usb_modeswitch 
after 
plugging your device in.

The usb_modeswitch.rules file is generated from the .conf file at build time. 
It 
contains generated "usb_modeswitch" commandlines which are supposed to be 
triggered when you plug your device in.

But there is a BIG problem with those 3G keys in general, which is not solvable 
with udev rules or anything else AFAICS: several devices with same 
idVendor:idProduct identifiers need different commands on the usb port.

That's why the generated usb_modeswitch.rules file contains all the possible 
devices/commands combinations but with several ones commented. See for example 
the 0x19d2:0x2000 series (which is your the identifier of your key by the way):

          ZTE MF620 (aka "Onda MH600HS")
        # ZTE MF622 (aka "Onda MDC502HS")
        # ZTE MF622 (probably different version)
        # ZTE MF628
        # ZTE MF628+ (tested version from Telia / Sweden) - ZTE MF626
        # ZTE MF638 (aka "Onda MDC525UP")
        # ONDA MT503HS (most likely a ZTE model)
        # ONDA MT505UP (most likely a ZTE model)

There are 8 devices with the _same_ idVendor:idProduct string and no way to see 
a difference between them. That's why the first one is uncommented and all the 
following ones are commented. That's the best I can do: it will work for some 
people that have the first device listed and won't work for the others. 

To make your device work "out-of-the-box", you just need to edit the rules file 
(/etc/udev/rules.d/usb_modeswitch.rules) so that the line corresponding to your 
device is the only one commented out for its idVendor:idProduct string.

> :~# mv /etc/udev/rules.d/usb_modeswitch.rules 
> : /etc/udev/rules.d/usb_modeswitch.rules.old ~# #remove zte mf636 modem
> :~# #reinsert zte mf636 modem
> :~# lsusb
>
> Bus 004 Device 015: ID 19d2:2000 ONDA Communication S.p.A.
>
> :~# usb_modeswitch -v 0x19d2 -p 0x2000 -V 0x19d2 -P 0x0031  -m 0x01 -M
> : 55534243123456782000000080000c85010101180101010101000000000000

(…)> … Message telling that it worked correctly.

> :~# lsusb
>
> Bus 004 Device 016: ID 19d2:0031 ONDA Communication S.p.A.

The commandline that you are using is in the rules file at line 156:

        #SUBSYSTEM=="usb", SYSFS{idVendor}=="19d2", SYSFS{idProduct}=="2000", 
        RUN+="/usr/sbin/usb_modeswitch --DefaultVendor 0x19d2 --DefaultProduct
        0x2000 --MessageEndpoint 0x01 --MessageContent
        55534243123456782000000080000c85010101180101010101000000000000"

But it is commented. Just comment it out in the rules files (and comment line 
122, where a line for a same idVendor:idProduct exists) and it should "just 
work". (aka "when you plug your device in, usb_modeswitch will be run with the 
correct parameters and your device will disappear as zeroconf device and appear 
as modem - it just takes a few seconds).

> After I put the -v,-p,-V,-P options into /etc/usb_modeswitch.conf, it's
> ready to work with umtsmon, together with this file:
>
> cat /etc/udev/rules.d/90-zte.rules
> ACTION!="add", GOTO="ZTE_End"
> #
> SUBSYSTEM=="usb", SYSFS{idProduct}=="0031",
> SYSFS{idVendor}=="19d2", GOTO="ZTE_Modem"
> #
> LABEL="ZTE_Modem"
> RUN+="/sbin/modprobe usbserial vendor=0x19d2 product=0x0031",
> MODE="660", GROUP="dialout"
> #
> LABEL="ZTE_End"

I guess that your file will work correctly and modprobe will be run after 
modeswitch, when the device appear.

By the way, you should be able to see what happens (i.e. debugging) by 
following 
syslog: you will see the first zeroconf device appear and then disappear and 
the modem appear (after usb_modeswitch has run in the background).

I hope that these explanations made the whole a little clearer !

Best regards, 

OdyX

-- 
Didier Raboud, proud Debian user and usb_modeswitch maintainer.
CH-1802 Corseaux
did...@raboud.com

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to