# 99-kbd-disp.rules — shared monitor follows the keyboard dongle
#
# Replace 3151:4015 with YOUR device's USB IDs (see `lsusb`).
# The dongle may carry a mouse + hub; the rule matches the device itself,
# so one event per plug.
#
# NOTE: remove events lack ID_VENDOR_ID / ATTR{idVendor} (the usb_id builtin
# does not run on remove and the sysfs attributes are already gone) — match
# on the kernel's PRODUCT env var instead. Bare DEVTYPE== is not a valid
# udev key; use ENV{DEVTYPE}.
SUBSYSTEM=="usb", ATTR{idVendor}=="3151", ATTR{idProduct}=="4015", ACTION=="add", RUN+="/usr/local/sbin/kbd_disp_switch attach"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="3151/4015/*", ACTION=="remove", RUN+="/usr/local/sbin/kbd_disp_switch detach"