Am 19.11.2015 um 01:00 schrieb Blake Miner:
> The catch-all udev rule does not work:
>
> # Generic entry for all Huawei devices
> ATTRS{idVendor}=="12d1", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"
Thanks for the report. Upstream dev here.
This has been a puzzle for some time now. Most people don't have any problems with this rule, but there are occasional hiccups like your's.
There is an educated guess that it's not the rule itself that is to blame. It's very likely that the installed systemd version affects the respective outcome.
The problem is related to the creation of "instance units" for systemd. USB_ModeSwitch requires this as there are possibly several instances started in parallel (if there is more than one device connected which needs a mode switch).
These instances are defined by the *filename*, meaning that the template unit file "usb_modeswitch@.service" will be instantiated as "usb_modeswitch@<bus/kernel_name>.service".
Originally, the unchanged parameter from the RUN directive was used to name the instance. At the time of testing, systemd translated the "/" character transparently. However, there seems to have been a change so that re-translation did not work as before, and subsequently the dispatcher script failed to recognize the parameter when the instance name was passed on by the unit.
In usb-modeswitch 2.2.2, the parameter format was altered: "/" is replaced by "_" *before* the systemd service unit is started. The dispatcher was modified accordingly.
I'm not sure if a version update is possible for Debian. Anyway, here is a little patch that you can try (after restoring the 'catch-all' rule to its original form). The patch is against 2.2.1 in the upstream version but should be easy to apply to the Debian source manually.
Best regards,
Josh