linux - uinput 文档

标签 linux linux-kernel linux-device-driver

我非常努力地寻找 uinput 的文档,但我唯一找到的是 linux/uinput.h。我还在互联网上找到了一些教程,但根本没有文档!

例如,我想知道 UI_SET_MSCBIT 的作用,但我找不到任何相关信息。

人们如何知道如何使用 uinput

最佳答案

好吧,对于这种微妙的事情需要一些调查工作。从 drivers/input/misc/uinput.cinclude/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 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.

恐怕这是你能找到的最好的 UI_SET_MSCBIT 了。

关于linux - uinput 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39311803/

相关文章:

linux - request_irq() 和 setup_irq() 的区别

linux - 如何在 bash 中评论参数列表

c - 系统调用 read 和 write 的行为如何以及为什么线程无法工作?

linux - Wind River Linux,失败的依赖错误

linux-kernel - virtualbox上的内核开发

linux - 将 nl 命令中的行增量设置为 float

linux - 如何从 Linux 内核模块中的逻辑地址获取物理地址?

linux - MTU 对环回接口(interface)的意义

linux - 使用结构来设置功能

linux-kernel - 设备树不匹配 : . 从未调用过探测器