Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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