Why interface class check moved to dispatcher for 19d2:2000?
Posted: 13 Jul 2013, 14:52
In the old style (ver 20120815), I have found the udev rule for checking the interface class of my ZTE modem working after a small FIX (described below).
And thus, I am very curious why the interface class was moved away from configurable and user changeable text file: /lib/udev/rules.d/40-usb_modeswitch.rules to the unconfigurable, already compiled program usb_modeswitch_dispatcher? Is there some deeper reason, or it is just a hack. If so, my fix should help avoid this hack.
I have ZTE MF60 (default 19d2:2000, target 19d2:1402) and the old version (usb-modeswitch-data, version 20120815) was not working. But the fix is easy to include. The problem with the old udev rule not working was use of ATTRS instead of ATTR.
Old version was:
ATTRS{bInterfaceNumber}=="03", ATTRS{bInterfaceClass}=="08", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", GOTO="modeswitch_rules_begin"
my working version is:
ATTR{bInterfaceNumber}=="03", ATTR{bInterfaceClass}=="08", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", GOTO="modeswitch_rules_begin"
I have noticed that in the new version of usb-modeswitch-data, this check was removed from the text configuration file. However it was added to a compiled dispatcher in the usb-modeswitch package.
In the file: usb_modeswitch.tcl then loaded and compiled as dispatcher.c in usb-modeswitch package one can see:
if {$iface < 0} {
if {$usb(idVendor)=="19d2" && $usb(idProduct)=="2000"} {
set iface [ChkIface 3]
}
And there is only one block of this type, only for this single manufacturer. This looks like an unnecessary hack, which I hope can be avoided by editing udev rule.
Cheers,
Jan Skowron
And thus, I am very curious why the interface class was moved away from configurable and user changeable text file: /lib/udev/rules.d/40-usb_modeswitch.rules to the unconfigurable, already compiled program usb_modeswitch_dispatcher? Is there some deeper reason, or it is just a hack. If so, my fix should help avoid this hack.
I have ZTE MF60 (default 19d2:2000, target 19d2:1402) and the old version (usb-modeswitch-data, version 20120815) was not working. But the fix is easy to include. The problem with the old udev rule not working was use of ATTRS instead of ATTR.
Old version was:
ATTRS{bInterfaceNumber}=="03", ATTRS{bInterfaceClass}=="08", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", GOTO="modeswitch_rules_begin"
my working version is:
ATTR{bInterfaceNumber}=="03", ATTR{bInterfaceClass}=="08", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", GOTO="modeswitch_rules_begin"
I have noticed that in the new version of usb-modeswitch-data, this check was removed from the text configuration file. However it was added to a compiled dispatcher in the usb-modeswitch package.
In the file: usb_modeswitch.tcl then loaded and compiled as dispatcher.c in usb-modeswitch package one can see:
if {$iface < 0} {
if {$usb(idVendor)=="19d2" && $usb(idProduct)=="2000"} {
set iface [ChkIface 3]
}
And there is only one block of this type, only for this single manufacturer. This looks like an unnecessary hack, which I hope can be avoided by editing udev rule.
Cheers,
Jan Skowron