axe
axe

Reputation: 2371

Get linux input devices

I need to get list of input devices on Linux operating system. Something similar to parsing /proc/bus/input/devices, but I actually don't want to reinvent the wheel. I believe there should be some system functions to enumerate devices and things like that. It is an embedded Linux, so I am limited in libraries I can use.

Upvotes: 3

Views: 7042

Answers (2)

solanum
solanum

Reputation: 21

It sounds like you wanted the command:

libinput list-devices

Upvotes: 2

Mats Petersson
Mats Petersson

Reputation: 129324

So, to find the mouse event handler, you search for a line that begins with "H:" and has a "mouseN" on it. It will then have a "eventM" on the same line. Should be doable with about half a dozen or so lines of code to open /proc/bus/input/devices, read a line, check if it's "H:" start, and if so, parse the rest of it for "mouse" and "event" bits.

Upvotes: 0

Related Questions