But I had to scratch my head a while to find out why automatic switching failed. Turns out the usb-storage interface number is odd:
Code: Select all
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 38 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=19d2 ProdID=2000 Rev= 0.00
S: Manufacturer=ZTE,Incorporated
S: Product=ZTE WCDMA Technologies MSM
S: SerialNumber=xxx
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=500mA
I:* If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Applying this patch made it all work. Please consider it for the next release, or maybe remove the interface number test? Is it necessary?
Code: Select all
bjorn@nemi:/tmp/y$ diff -u /{lib,etc}/udev/rules.d/40-usb_modeswitch.rules
--- /lib/udev/rules.d/40-usb_modeswitch.rules 2012-05-31 11:11:44.000000000 +0200
+++ /etc/udev/rules.d/40-usb_modeswitch.rules 2012-07-02 19:22:29.000000000 +0200
@@ -15,8 +15,8 @@
# against a list of known modems, or else no action
ATTR{bInterfaceClass}=="ff", ATTR{bInterfaceNumber}=="00", ATTRS{bNumConfigurations}=="*", RUN+="usb_modeswitch --driver-bind %p %s{idVendor} %s{idProduct} %E{PRODUCT}"
-# Most known install partitions are on interface 0, one on 5, one on 9
-ATTRS{bInterfaceNumber}!="0[059]", GOTO="modeswitch_rules_end"
+# Most known install partitions are on interface 0, one on 3, one on 5, one on 9
+ATTRS{bInterfaceNumber}!="0[0359]", GOTO="modeswitch_rules_end"
# handle only storage class devices
ATTRS{bDeviceClass}=="08", GOTO="modeswitch_rules_begin"
After switching, the device ID changes to 1402 having QCDM, AT, QMI/wwan and usb-storage interfaces:
Code: Select all
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 40 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=19d2 ProdID=1402 Rev= 0.00
S: Manufacturer=ZTE,Incorporated
S: Product=ZTE WCDMA Technologies MSM
S: SerialNumber=xxx
C:* #Ifs= 4 Cfg#= 1 Atr=c0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Interface #2 does support ethernet, and *some* QMI commands. Most QMI_WDS commands will make the firmware crash, so it cannot be used like most other QMI/wwan devices. But sending a QMI_CTL "set instance id" command enables the IP support, and the interface can then be configured using DHCP:
Code: Select all
#perl -e 'print pack("C*", map {hex} @ARGV)' 01 0f 00 00 00 00 00 00 20 00 04 00 01 01 00 00 >/dev/cdc-wdm2
# dhclient -d -4 wwan3
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wwan3/62:c9:d2:38:b0:c4
Sending on LPF/wwan3/62:c9:d2:38:b0:c4
Sending on Socket/fallback
DHCPDISCOVER on wwan3 to 255.255.255.255 port 67 interval 8
DHCPREQUEST on wwan3 to 255.255.255.255 port 67
DHCPOFFER from 192.168.0.1
DHCPACK from 192.168.0.1
bound to 192.168.0.100 -- renewal in 33556 seconds.