Activation Codes and Methods, Hardware Details, Sniffing
Post Reply
bmork
Posts: 167
Joined: 15 Mar 2012, 22:47
Location: Oslo, Norway

ZTE MF60 need udev rule tweaking

Post by bmork » 02 Jul 2012, 19:57

ZTE reuse their 19d2:2000 device id for the MF60 "Global Mobile Hotspot", and the existing configuration does switch the device (as well as a simple eject, but I assume that is one of the magic USB storage commands in the config file...)

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
I'll send patches adding the device to the option and qmi_wwan drivers in a few minutes.

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.
The device itself can be configured by pointing a browser to its address: http://192.168.0.1/

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Post by Josh » 04 Jul 2012, 19:10

The "interface/class filter" intends to skip all USB devices (including modem sticks that have already switched) that don't look like they have a "fake CD".

I am sure it can be improved - maybe with the special cases matched explicitely. I'll think about it.

It's really all about preventing unnecessary rule checking for unrelated devices.


newjxmaster
Posts: 1
Joined: 14 Jul 2014, 06:52

Re: ZTE MF60 need udev rule tweaking

Post by newjxmaster » 14 Jul 2014, 06:58

Dear All, I'm new at programming and nooob conferning coding.. I have a ZTE MF60 and I would like
Customize the Carrier so that I can write for example my name instead of the mobile carrier.
thank you

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Re: ZTE MF60 need udev rule tweaking

Post by Josh » 16 Jul 2014, 21:36

Sorry, neither the right thread, nor the right forum, nor the right website for your request.

Post Reply