udev: fix SUBSYSTEMS and ATTRS{idVendor} checks

Rules with a single condition where a parent property is checked with != don't
work properly. E.g.:
  SUBSYSTEMS!="usb", GOTO="end"
or:
  ATTRS{idVendor}!="abcd", GOTO="end"

Instead, we can mix both those previous parent rules and match them:
  SUBSYSTEMS=="usb",ATTRS{idVendor}=="abcd", GOTO="next"
  GOTO="end"
  LABEL="next"
  # Apply rules here
  LABEL="end"

In this case both SUBSYSTEMS and ATTRS conditions apply to the parent usb_device
(idVendor attribute is only available in the usb_device), so they apply to all
ports of the same device.
This commit is contained in:
Aleksander Morgado
2016-09-18 14:08:20 +02:00
parent 546d33db6c
commit aa0e108107
11 changed files with 40 additions and 42 deletions

View File

@@ -1,9 +1,10 @@
# do not edit this file, it will be overwritten on update # do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_cinterion_port_types_end" ACTION!="add|change|move", GOTO="mm_cinterion_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_cinterion_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="1e2d", GOTO="mm_cinterion_port_types"
SUBSYSTEM!="tty", GOTO="mm_cinterion_port_types_end" GOTO="mm_cinterion_port_types_end"
ATTRS{idVendor}!="1e2d", GOTO="mm_cinterion_port_types_end"
LABEL="mm_cinterion_port_types"
ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0053", ATTRS{bInterfaceNumber}=="01", ENV{ID_MM_CINTERION_PORT_TYPE_GPS}="1" ATTRS{idVendor}=="1e2d", ATTRS{idProduct}=="0053", ATTRS{bInterfaceNumber}=="01", ENV{ID_MM_CINTERION_PORT_TYPE_GPS}="1"

View File

@@ -1,9 +1,10 @@
# do not edit this file, it will be overwritten on update # do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_haier_port_types_end" ACTION!="add|change|move", GOTO="mm_haier_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_haier_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="201e", GOTO="mm_haier_port_types"
SUBSYSTEM!="tty", GOTO="mm_haier_port_types_end" GOTO="mm_haier_port_types_end"
ATTRS{idVendor}!="201e", GOTO="mm_haier_port_types_end"
LABEL="mm_haier_port_types"
# Haier CE81B # Haier CE81B
ATTRS{idVendor}=="201e", ATTRS{idProduct}=="10f8", ATTRS{bInterfaceNumber}=="03", ENV{ID_MM_HAIER_PORT_TYPE_MODEM}="1" ATTRS{idVendor}=="201e", ATTRS{idProduct}=="10f8", ATTRS{bInterfaceNumber}=="03", ENV{ID_MM_HAIER_PORT_TYPE_MODEM}="1"

View File

@@ -1,7 +1,9 @@
# do not edit this file, it will be overwritten on update # do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_huawei_port_types_end" ACTION!="add|change|move", GOTO="mm_huawei_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_huawei_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", GOTO="mm_huawei_port_types"
ATTRS{idVendor}!="12d1", GOTO="mm_huawei_port_types_end" GOTO="mm_huawei_port_types_end"
LABEL="mm_huawei_port_types"
# MU609 does not support getportmode (crashes modem with default firmware) # MU609 does not support getportmode (crashes modem with default firmware)
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1573", ENV{ID_MM_HUAWEI_DISABLE_GETPORTMODE}="1" ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1573", ENV{ID_MM_HUAWEI_DISABLE_GETPORTMODE}="1"

View File

@@ -12,13 +12,9 @@
# cmser.inf lists the aux ports that may be either AT-capable or not but # cmser.inf lists the aux ports that may be either AT-capable or not but
# cannot be used for PPP. # cannot be used for PPP.
ACTION!="add|change|move", GOTO="mm_longcheer_port_types_end" ACTION!="add|change|move", GOTO="mm_longcheer_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_longcheer_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="1c9e", GOTO="mm_longcheer_vendorcheck"
SUBSYSTEM!="tty", GOTO="mm_longcheer_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="1bbb", GOTO="mm_tamobile_vendorcheck"
ATTRS{idVendor}=="1c9e", GOTO="mm_longcheer_vendorcheck"
ATTRS{idVendor}=="1bbb", GOTO="mm_tamobile_vendorcheck"
GOTO="mm_longcheer_port_types_end" GOTO="mm_longcheer_port_types_end"
LABEL="mm_longcheer_vendorcheck" LABEL="mm_longcheer_vendorcheck"

View File

@@ -1,13 +1,11 @@
# do not edit this file, it will be overwritten on update # do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_mbm_end" ACTION!="add|change|move", GOTO="mm_mbm_end"
SUBSYSTEMS!="usb", GOTO="mm_mbm_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bdb", GOTO="mm_mbm_ericsson_vendorcheck"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0fce", GOTO="mm_mbm_sony_vendorcheck"
ATTRS{idVendor}=="0bdb", GOTO="mm_mbm_ericsson_vendorcheck" SUBSYSTEMS=="usb", ATTRS{idVendor}=="413c", GOTO="mm_mbm_dell_vendorcheck"
ATTRS{idVendor}=="0fce", GOTO="mm_mbm_sony_vendorcheck" SUBSYSTEMS=="usb", ATTRS{idVendor}=="03f0", GOTO="mm_mbm_hp_vendorcheck"
ATTRS{idVendor}=="413c", GOTO="mm_mbm_dell_vendorcheck" SUBSYSTEMS=="usb", ATTRS{idVendor}=="0930", GOTO="mm_mbm_toshiba_vendorcheck"
ATTRS{idVendor}=="03f0", GOTO="mm_mbm_hp_vendorcheck"
ATTRS{idVendor}=="0930", GOTO="mm_mbm_toshiba_vendorcheck"
GOTO="mm_mbm_end" GOTO="mm_mbm_end"
LABEL="mm_mbm_ericsson_vendorcheck" LABEL="mm_mbm_ericsson_vendorcheck"

View File

@@ -1,11 +1,9 @@
# do not edit this file, it will be overwritten on update # do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_mtk_port_types_end" ACTION!="add|change|move", GOTO="mm_mtk_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_mtk_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="0e8d", GOTO="mm_mtk_port_types_vendorcheck"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2001", GOTO="mm_dlink_port_types_vendorcheck"
ATTRS{idVendor}=="0e8d", GOTO="mm_mtk_port_types_vendorcheck" SUBSYSTEMS=="usb", ATTRS{idVendor}=="07d1", GOTO="mm_dlink_port_types_vendorcheck"
ATTRS{idVendor}=="2001", GOTO="mm_dlink_port_types_vendorcheck"
ATTRS{idVendor}=="07d1", GOTO="mm_dlink_port_types_vendorcheck"
GOTO="mm_mtk_port_types_end" GOTO="mm_mtk_port_types_end"
# MediaTek devices --------------------------- # MediaTek devices ---------------------------

View File

@@ -1,9 +1,10 @@
# do not edit this file, it will be overwritten on update # do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_nokia_port_types_end" ACTION!="add|change|move", GOTO="mm_nokia_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_nokia_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="0421", GOTO="mm_nokia_port_types"
SUBSYSTEM!="tty", GOTO="mm_nokia_port_types_end" GOTO="mm_nokia_port_types_end"
ATTRS{idVendor}!="0421", GOTO="mm_nokia_port_types_end"
LABEL="mm_nokia_port_types"
# For Nokia Internet Sticks (CS-xx) the modem/PPP port appears to always be USB interface 1 # For Nokia Internet Sticks (CS-xx) the modem/PPP port appears to always be USB interface 1

View File

@@ -11,9 +11,10 @@
ACTION!="add|change|move", GOTO="mm_simtech_port_types_end" ACTION!="add|change|move", GOTO="mm_simtech_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_simtech_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="1e0e", GOTO="mm_simtech_port_types"
SUBSYSTEM!="tty", GOTO="mm_simtech_port_types_end" GOTO="mm_simtech_port_types_end"
ATTRS{idVendor}!="1e0e", GOTO="mm_simtech_port_types_end"
LABEL="mm_simtech_port_types"
# A-LINK 3GU # 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}=="02", ENV{ID_MM_SIMTECH_PORT_TYPE_MODEM}="1"

View File

@@ -1,9 +1,10 @@
# do not edit this file, it will be overwritten on update # do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_telit_port_types_end" ACTION!="add|change|move", GOTO="mm_telit_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_telit_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="1bc7", GOTO="mm_telit_port_types"
SUBSYSTEM!="tty", GOTO="mm_telit_port_types_end" GOTO="mm_telit_port_types_end"
ATTRS{idVendor}!="1bc7", GOTO="mm_telit_port_types_end"
LABEL="mm_telit_port_types"
# UC864-E, UC864-E-AUTO, UC864-K, UC864-WD, UC864-WDU # UC864-E, UC864-E-AUTO, UC864-K, UC864-WD, UC864-WDU
ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1003", ATTRS{bInterfaceNumber}=="00", ENV{ID_MM_TELIT_PORT_TYPE_MODEM}="1" ATTRS{idVendor}=="1bc7", ATTRS{idProduct}=="1003", ATTRS{bInterfaceNumber}=="00", ENV{ID_MM_TELIT_PORT_TYPE_MODEM}="1"

View File

@@ -9,11 +9,8 @@
ACTION!="add|change|move", GOTO="mm_x22x_port_types_end" ACTION!="add|change|move", GOTO="mm_x22x_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_x22x_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="1bbb", GOTO="mm_x22x_generic_vendorcheck"
SUBSYSTEM!="tty", GOTO="mm_x22x_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="0b3c", GOTO="mm_x22x_olivetti_vendorcheck"
ATTRS{idVendor}=="1bbb", GOTO="mm_x22x_generic_vendorcheck"
ATTRS{idVendor}=="0b3c", GOTO="mm_x22x_olivetti_vendorcheck"
GOTO="mm_x22x_port_types_end" GOTO="mm_x22x_port_types_end"
# Generic JRD devices --------------------------- # Generic JRD devices ---------------------------

View File

@@ -1,8 +1,10 @@
# do not edit this file, it will be overwritten on update # do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_zte_port_types_end" ACTION!="add|change|move", GOTO="mm_zte_port_types_end"
SUBSYSTEMS!="usb", GOTO="mm_zte_port_types_end" SUBSYSTEMS=="usb", ATTRS{idVendor}=="19d2", GOTO="mm_zte_port_types"
ATTRS{idVendor}!="19d2", GOTO="mm_zte_port_types_end" GOTO="mm_zte_port_types_end"
LABEL="mm_zte_port_types"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0001", ATTRS{bInterfaceNumber}=="00", ENV{ID_MM_ZTE_PORT_TYPE_MODEM}="1" ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0001", ATTRS{bInterfaceNumber}=="00", ENV{ID_MM_ZTE_PORT_TYPE_MODEM}="1"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0001", ATTRS{bInterfaceNumber}=="02", ENV{ID_MM_ZTE_PORT_TYPE_AUX}="1" ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0001", ATTRS{bInterfaceNumber}=="02", ENV{ID_MM_ZTE_PORT_TYPE_AUX}="1"