我非常努力地寻找 uinput
的文档,但我唯一找到的是 linux/uinput.h
。我还在互联网上找到了一些教程,但根本没有文档!
例如,我想知道 UI_SET_MSCBIT
的作用,但我找不到任何相关信息。
人们如何知道如何使用 uinput
?
最佳答案
好吧,对于这种微妙的事情需要一些调查工作。从
drivers/input/misc/uinput.c
和 include/uapi/linux/uinput.h
文件你可以看到 UI_SET_*
定义的位,像这样:
MSC
REL
LED
等等
在内核源代码目录中运行下一个命令:
$ git grep --all-match -e 'MSC' -e 'REL' -e 'LED' -- Documentation/*
或者使用常规的 grep
,如果你的内核没有 .git
目录:
$ grep -rl MSC Documentation/* | xargs grep -l REL | xargs grep -l LED
您将获得此文件:Documentation/input/event-codes.txt ,从中可以看出:
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 anuint32
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.
恐怕这是你能找到的最好的 UI_SET_MSCBIT
了。
关于linux - uinput 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39311803/