[PATCH] udev: add tags also on bind action
aleksander at aleksander.es
Sat Jun 2 15:00:25 UTC 2018
On Wed, May 30, 2018 at 10:24 PM, Dan Williams <dcbw at redhat.com> wrote:
> On Sun, 2018-05-27 at 17:03 +0200, Aleksander Morgado wrote:
>> When a new USB device is hotplugged, e.g. a USB<->RS232 converter
>> 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-
>> add /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0
>> 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
>> bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb/usb-
>> 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
>> 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
>> 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.
> Unfortunate, but LGTM.
Pushed to git master.
More information about the ModemManager-devel