From c7d8ac622a56142325af1e9b51d0cce1f06eaa3d Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Sun, 18 Sep 2016 15:43:30 +0200 Subject: udev: fix tagging per interface number Commit 7ff57f9808f35d434b638a67b84481271c67c90e 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. --- plugins/mtk/77-mm-mtk-port-types.rules | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'plugins/mtk') diff --git a/plugins/mtk/77-mm-mtk-port-types.rules b/plugins/mtk/77-mm-mtk-port-types.rules index 4353c669..dd8a067a 100644 --- a/plugins/mtk/77-mm-mtk-port-types.rules +++ b/plugins/mtk/77-mm-mtk-port-types.rules @@ -9,25 +9,26 @@ GOTO="mm_mtk_port_types_end" # MediaTek devices --------------------------- LABEL="mm_mtk_port_types_vendorcheck" +SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a1", ATTRS{bInterfaceNumber}=="00", ENV{ID_MM_MTK_MODEM_PORT}="1" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a1", ATTRS{bInterfaceNumber}=="01", ENV{ID_MM_MTK_AT_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a1", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_MTK_MODEM_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a1", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_MTK_AT_PORT}="1" ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a1", ENV{ID_MM_MTK_TAGGED}="1" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a2", ATTRS{bInterfaceNumber}=="00", ENV{ID_MM_MTK_MODEM_PORT}="1" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a2", ATTRS{bInterfaceNumber}=="01", ENV{ID_MM_MTK_AT_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a2", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_MTK_MODEM_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a2", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_MTK_AT_PORT}="1" ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a2", ENV{ID_MM_MTK_TAGGED}="1" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a4", ATTRS{bInterfaceNumber}=="00", ENV{ID_MM_MTK_MODEM_PORT}="1" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a4", ATTRS{bInterfaceNumber}=="02", ENV{ID_MM_MTK_AT_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a4", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_MTK_MODEM_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a4", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_MTK_AT_PORT}="1" ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a4", ENV{ID_MM_MTK_TAGGED}="1" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a5", ATTRS{bInterfaceNumber}=="02", ENV{ID_MM_MTK_MODEM_PORT}="1" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a5", ATTRS{bInterfaceNumber}=="03", ENV{ID_MM_MTK_AT_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a5", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_MTK_MODEM_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a5", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_MTK_AT_PORT}="1" ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a5", ENV{ID_MM_MTK_TAGGED}="1" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a7", ATTRS{bInterfaceNumber}=="02", ENV{ID_MM_MTK_MODEM_PORT}="1" -ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a7", ATTRS{bInterfaceNumber}=="03", ENV{ID_MM_MTK_AT_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a7", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_MTK_MODEM_PORT}="1" +ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a7", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_MTK_AT_PORT}="1" ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="00a7", ENV{ID_MM_MTK_TAGGED}="1" GOTO="mm_mtk_port_types_end" @@ -35,6 +36,7 @@ GOTO="mm_mtk_port_types_end" # D-Link devices --------------------------- LABEL="mm_dlink_port_types_vendorcheck" +SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}" # D-Link DWM-156 A3 ATTRS{idVendor}=="07d1", ATTRS{idProduct}=="7e11", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_MTK_MODEM_PORT}="1" @@ -42,8 +44,8 @@ ATTRS{idVendor}=="07d1", ATTRS{idProduct}=="7e11", ENV{.MM_USBIFNUM}=="03", ENV{ ATTRS{idVendor}=="07d1", ATTRS{idProduct}=="7e11", ENV{ID_MM_MTK_TAGGED}="1" # D-Link DWM-156 A5 (and later?) -ATTRS{idVendor}=="2001", ATTRS{idProduct}=="7d00", ATTRS{bInterfaceNumber}=="00", ENV{ID_MM_MTK_MODEM_PORT}="1" -ATTRS{idVendor}=="2001", ATTRS{idProduct}=="7d00", ATTRS{bInterfaceNumber}=="01", ENV{ID_MM_MTK_AT_PORT}="1" +ATTRS{idVendor}=="2001", ATTRS{idProduct}=="7d00", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_MTK_MODEM_PORT}="1" +ATTRS{idVendor}=="2001", ATTRS{idProduct}=="7d00", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_MTK_AT_PORT}="1" ATTRS{idVendor}=="2001", ATTRS{idProduct}=="7d00", ENV{ID_MM_MTK_TAGGED}="1" GOTO="mm_mtk_port_types_end" -- cgit v1.2.3-70-g09d2