udev: add tags also on bind action

When a new USB device is hotplugged, e.g. a USB<->RS232 converter that
exposes a single ttyUSB0, these udev events happen:

  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb/usb-device)
  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb/usb-interface)
  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0 (usb-serial)
  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)
  bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0 (usb-serial)
  bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb/usb-interface)
  bind /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb/usb-device)

Our udev rules in MM only added tags in the 'add' events, and it looks
like the only ones 'persistent' after this sequence are those of the
last event happening on the specific path.

This meant that all TTY subsystem rules (e.g. ID_MM_CANDIDATE) would
be stored for later check (e.g. if ModemManager is started after these
rules have been applied), which was ok. "udevadm info -p ..." would
show these tags correctly always.

But this also meant that the 'bind' udev event happening for the USB
device didn't get any of our device-specific tags, and so we would be
missing them (e.g. ID_MM_DEVICE_MANUAL_SCAN_ONLY) if MM is started
after the last event has happened. "udevadm info -p ..." would
not show these tags.

Modify all our rules to also run at the 'bind' events.

See, for context:
  https://github.com/systemd/systemd/issues/8221
This commit is contained in:
Aleksander Morgado
2018-05-27 16:39:17 +02:00
parent 4bc7d6862d
commit c07382a486
18 changed files with 18 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
# 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|bind", GOTO="mm_cinterion_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1e2d", GOTO="mm_cinterion_port_types"
GOTO="mm_cinterion_port_types_end"

View File

@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_dell_port_types_end"
ACTION!="add|change|move|bind", GOTO="mm_dell_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="413c", GOTO="mm_dell_vendorcheck"
GOTO="mm_dell_port_types_end"

View File

@@ -1,6 +1,6 @@
# 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|bind", GOTO="mm_haier_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="201e", GOTO="mm_haier_port_types"
GOTO="mm_haier_port_types_end"

View File

@@ -1,5 +1,5 @@
# 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|bind", GOTO="mm_huawei_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", GOTO="mm_huawei_port_types"
GOTO="mm_huawei_port_types_end"

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
# 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|bind", 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"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="07d1", GOTO="mm_dlink_port_types_vendorcheck"

View File

@@ -1,6 +1,6 @@
# 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|bind", GOTO="mm_nokia_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0421", GOTO="mm_nokia_port_types"
GOTO="mm_nokia_port_types_end"

View File

@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_sierra_end"
ACTION!="add|change|move|bind", GOTO="mm_sierra_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1199", GOTO="mm_sierra"
GOTO="mm_sierra_end"

View File

@@ -10,7 +10,7 @@
# *ser.inf lists the aux ports that may be used for PPP.
ACTION!="add|change|move", GOTO="mm_simtech_port_types_end"
ACTION!="add|change|move|bind", GOTO="mm_simtech_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1e0e", GOTO="mm_simtech_port_types"
GOTO="mm_simtech_port_types_end"

View File

@@ -1,6 +1,6 @@
# 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|bind", GOTO="mm_telit_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1bc7", GOTO="mm_telit_port_types"
GOTO="mm_telit_port_types_end"

View File

@@ -1,5 +1,5 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_ublox_port_types_end"
ACTION!="add|change|move|bind", GOTO="mm_ublox_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1546", GOTO="mm_ublox_port_types"
GOTO="mm_ublox_port_types_end"

View File

@@ -8,7 +8,7 @@
# aux ports that may be either AT-capable or not but cannot be used for PPP.
ACTION!="add|change|move", GOTO="mm_x22x_port_types_end"
ACTION!="add|change|move|bind", GOTO="mm_x22x_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1bbb", GOTO="mm_x22x_generic_vendorcheck"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0b3c", GOTO="mm_x22x_olivetti_vendorcheck"
GOTO="mm_x22x_port_types_end"

View File

@@ -1,6 +1,6 @@
# 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|bind", GOTO="mm_zte_port_types_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="19d2", GOTO="mm_zte_port_types"
GOTO="mm_zte_port_types_end"

View File

@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_pcmcia_device_blacklist_end"
ACTION!="add|change|move|bind", GOTO="mm_pcmcia_device_blacklist_end"
SUBSYSTEM!="pcmcia", GOTO="mm_pcmcia_device_blacklist_end"
# Gemplus Serial Port smartcard adapter

View File

@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_usb_device_blacklist_end"
ACTION!="add|change|move|bind", GOTO="mm_usb_device_blacklist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end"
# APC UPS devices

View File

@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update
ACTION!="add|change|move", GOTO="mm_usb_serial_adapters_greylist_end"
ACTION!="add|change|move|bind", GOTO="mm_usb_serial_adapters_greylist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_serial_adapters_greylist_end"
# Belkin F5U183 Serial Adapter

View File

@@ -7,7 +7,7 @@
# that don't have this tag. MM will still get the udev 'add' event for the
# device a short while later and then process it as normal.
ACTION!="add|change|move", GOTO="mm_candidate_end"
ACTION!="add|change|move|bind", GOTO="mm_candidate_end"
# Opening bound but disconnected Bluetooth RFCOMM ttys would initiate the
# connection. Don't do that.