I'm looking for a robust method for identifying a device's type (mouse, keyboard, joystick)
by its input event handler.

There are parameters which cannot be trusted, such as device name/vendor-id etc. since that they are supplied by the device itself.
AFAIK, the input event handler (part of the Linux Input Subsystem) corresponds to a device type.

So how do you absolutely know that the device is e.g. a keyboard ?
By matching its input event handler to a known keyboard-event-handler's name.

I'm familiar with the file /proc/bus/input/devices which provides also several handlers, but it doesn't feel "the right place to look" since that I didn't find any official explanation about this file, and:

... BSD type OSes generally do not have /proc at all, so much of what you find under here is non-portable.

The intended solution for this mess in Linux's /proc is /sys. Ideally, all the non-process information that got glommed into the /proc tree should have moved to /sys by now, but historical inertia has kept a lot of stuff in /proc.

From here.

For example in my system, the event handler for a keyboard is kbd.

How do I find a device's input event handler without accessing /proc ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.