1

What is the preferred way to determine when new devices become available as /dev/input/eventX?

Do I have to periodically examine the /dev/input directory, comparing my open files against the list of /dev/input/eventX devices, or is there a simpler way?

I have taken a brief look at hotplug.txt, but I think that would notify me of the underlying raw /dev/input device creation, and not necessarily the corresponding /dev/input/eventX creation.

Josh Sanford
  • 622
  • 5
  • 18

1 Answers1

2

You can use inotify. Something like inotifywait -r -m /dev/input

Setop
  • 2,262
  • 13
  • 28
  • Thank you. I did not know about inotify. I will actually be doing this from code, but this points me in the right direction. – Josh Sanford May 04 '17 at 17:14