udev: fix tagging per interface number

Commit 7ff57f9808 introduced a change to try to
use ATTRS{bInterfaceNumber} as a common way to match by interface number, but
this logic is broken because all the rules that we use to match by interface
number (attribute in the interface device) also require matching by idVendor
and idProduct (attributes in the physdev device), and udev rules forbid matches
from more than one parent device at a time.

We could use ATTR{bInterfaceNumber} (instead of ATTRS) to tag the actual USB
interface device, but that would require a change in all the plugins to look for
the tag not in the TTY device, but in its parent.

So, recover the original behavior, where a hidden property is created containing
the first bInterfaceNumber found in the list of parent devices, and then run
the matches against idVendor and idProduct only if the hidden property is found
with the expected value.
This commit is contained in:
Aleksander Morgado
2016-09-18 15:43:30 +02:00
parent aa0e108107
commit c7d8ac622a
10 changed files with 307 additions and 291 deletions

View File

@@ -15,21 +15,22 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="1e0e", GOTO="mm_simtech_port_types"
GOTO="mm_simtech_port_types_end"
LABEL="mm_simtech_port_types"
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
# A-LINK 3GU
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="cefe", ATTRS{bInterfaceNumber}=="02", ENV{ID_MM_SIMTECH_PORT_TYPE_MODEM}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="cefe", ATTRS{bInterfaceNumber}=="00", ENV{ID_MM_SIMTECH_PORT_TYPE_AUX}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="cefe", ATTRS{bInterfaceNumber}=="01", ENV{ID_MM_SIMTECH_PORT_TYPE_AUX}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="cefe", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_SIMTECH_PORT_TYPE_MODEM}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="cefe", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_SIMTECH_PORT_TYPE_AUX}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="cefe", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_SIMTECH_PORT_TYPE_AUX}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="cefe", ENV{ID_MM_SIMTECH_TAGGED}="1"
# Prolink PH-300
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9100", ATTRS{bInterfaceNumber}=="03", ENV{ID_MM_SIMTECH_PORT_TYPE_MODEM}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9100", ATTRS{bInterfaceNumber}=="01", ENV{ID_MM_SIMTECH_PORT_TYPE_AUX}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9100", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_SIMTECH_PORT_TYPE_MODEM}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9100", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_SIMTECH_PORT_TYPE_AUX}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9100", ENV{ID_MM_SIMTECH_TAGGED}="1"
# SCT UM300
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9200", ATTRS{bInterfaceNumber}=="03", ENV{ID_MM_SIMTECH_PORT_TYPE_MODEM}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9200", ATTRS{bInterfaceNumber}=="01", ENV{ID_MM_SIMTECH_PORT_TYPE_AUX}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9200", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_SIMTECH_PORT_TYPE_MODEM}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9200", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_SIMTECH_PORT_TYPE_AUX}="1"
ATTRS{idVendor}=="1e0e", ATTRS{idProduct}=="9200", ENV{ID_MM_SIMTECH_TAGGED}="1"
LABEL="mm_simtech_port_types_end"