input_event结构描述(从Linux / input.h) [英] input_event structure description (from linux/input.h)

查看:924
本文介绍了input_event结构描述(从Linux / input.h)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我什么是由input_event结构中使用的数据类型的属性?

Can someone please tell me what are the properties of the datatypes used by the input_event structure?

它被定义为在input.h文件如下:

It is defined as follows in the input.h file:

struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;
};

,但没有其他说明!即使谷歌搜索给了我什么有趣的。

but there are no other descriptions! Even googling gave me nothing interesting.

我所知道的唯一的事情就是时间给秒或毫秒为单位,从时代和给code的pressed按钮。但是,即使属性的值是不是真的对我清楚。在我的节目每一次击键产生六个事件。以下事件响应为pressing ENTER键:

The only thing I know is that time gives seconds or miliseconds from epoch and value gives code of pressed button. But even value of value property isn't really clear for me. In my program every keystroke generates six events. Following events are response for pressing ENTER key:

type=4,code=4,value=458792
type=1,code=28,value=1
type=0,code=0,value=0
type=4,code=4,value=458792
type=1,code=28,value=0
type=0,code=0,value=0 

和那些用于 A 信:

type=4,code=4,value=458756
type=1,code=30,value=1
type=0,code=0,value=0
atype=4,code=4,value=458756
type=1,code=30,value=0
type=0,code=0,value=0

我想code值去到真正的信,但我不明白的属性的含义。

I would like to decode value to the real letter, but I don't understand the meaning of the properties.

请帮帮忙!

推荐答案

结构input_event 是,除其他外,在<一个href=\"https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/input.h\">include/linux/input.h.

5。 Event接口的Linux内核文档/输入/ input.txt的(和修改,以提供正确的头文件名):

From 5. Event interface in Linux kernel Documentation/input/input.txt (and modified to provide the correct header file names):


  • 时间为时间戳,它返回时,事件发生的时间。

  • time is the timestamp, it returns the time at which the event happened.

键入是例如 EV_REL 相对一刻, EV_KEY 一键preSS或
发布。更多类型在<定义href=\"https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/input-event-$c$cs.h\">include/linux/input-event-$c$cs.h.

type is for example EV_REL for relative moment, EV_KEY for a keypress or release. More types are defined in include/linux/input-event-codes.h.

code 是事件code,例如 REL_X KEY_BACKSPACE ,再次完整
列表是<一个href=\"https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/input-event-$c$cs.h\">include/linux/input-event-$c$cs.h.

code is event code, for example REL_X or KEY_BACKSPACE, again a complete list is in include/linux/input-event-codes.h.

是事件携带的值。无论是相对变化
EV_REL EV_ABS 绝对新值(操纵杆...),或 0 EV_KEY
发布 1 重点preSS和 2 为自动重复。

value is the value the event carries. Either a relative change for EV_REL, absolute new value for EV_ABS (joysticks ...), or 0 for EV_KEY for release, 1 for keypress and 2 for autorepeat.

有关指南和例如code,做 linux内核,输入子系统

For guides and example code, do a web search for "linux kernel" "input subsystem".

这篇关于input_event结构描述(从Linux / input.h)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆