Hacker News new | ask | show | jobs
by ur-whale 1643 days ago
> sleep 1

One second latency ... not ideal.

Is there any way to sleepwait on a USB config change instead?

[EDIT]: this might help:

https://stackoverflow.com/questions/469243/how-can-i-listen-...

2 comments

Add udev rule, to launch script when an input is connected:

   ACTION=="add", DEVPATH=="*/input/*", RUN+="/usr/local/bin/script.sh $devnode"
You can use `udevadm monitor` or venture into `dbus-monitor` to capture events from udev.