Josh Sanford
Josh Sanford

Reputation: 672

How to determine when new devices are added with evdev?

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.

Upvotes: 1

Views: 522

Answers (1)

Setop
Setop

Reputation: 2490

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

Upvotes: 2

Related Questions