I have a udev rule to halt the system when a usb hub is removed:

SUBSYSTEM=="usb", ACTION=="remove", ENV{ID_VENDOR_ID}="050d", ENV{ID_MODEL_ID}="0237", RUN+="/sbin/halt"

Unfortunately, this also triggers when a device plugged into that hub is removed. I have looked through output from udevadm monitor --udev --property while plugging and unplugging the devices and there is no set of fields which can be isolated as unique to removing the hub.

Does anyone know how I can target just the hub and not include remove events for devices attached to it?


Guess who used "=" instead of "==", meaning the rule would match any remove event? Whoops...

There is a lot of overlap in the two sets of events but the line that will target that hub is:

ACTION=="remove", ENV{PRODUCT}=="50d/237/100", RUN+="/sbin/shutdown -h now"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.