Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documentation for uinput

I am trying very hard to find the documentation for the uinput but the only thing I have found was the linux/uinput.h. I have also found some tutorials on the internet but no documentation at all!

For example I would like to know what UI_SET_MSCBIT does but I can't find anything about it.

How does people know how to use uinput?

like image 999
ProNOOB Avatar asked Sep 07 '25 23:09

ProNOOB


1 Answers

Well, it takes some investigation effort for such subtle things. From drivers/input/misc/uinput.c and include/uapi/linux/uinput.h files you can see bits for UI_SET_* definitions, like this:

  • MSC
  • REL
  • LED

etc.

Run next command in kernel sources directory:

$ git grep --all-match -e 'MSC' -e 'REL' -e 'LED' -- Documentation/*

or use regular grep, if your kernel doesn't have .git directory:

$ grep -rl MSC Documentation/* | xargs grep -l REL | xargs grep -l LED

You'll get this file: Documentation/input/event-codes.txt, from which you can see:

EV_MSC: Used to describe miscellaneous input data that do not fit into other types.

EV_MSC events are used for input and output events that do not fall under other categories.

A few EV_MSC codes have special meaning:

  • MSC_TIMESTAMP: Used to report the number of microseconds since the last reset. This event should be coded as an uint32 value, which is allowed to wrap around with no special consequence. It is assumed that the time difference between two consecutive events is reliable on a reasonable time scale (hours). A reset to zero can happen, in which case the time since the last event is unknown. If the device does not provide this information, the driver must not provide it to user space.

I'm afraid this is the best you can find out there for UI_SET_MSCBIT out there.

like image 156
Sam Protsenko Avatar answered Sep 09 '25 16:09

Sam Protsenko