SP5*_*RFD 23 c c++ linux structure input
有人可以告诉我input_event结构使用的数据类型的属性是什么?
它在input.h文件中定义如下:
struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;
};
Run Code Online (Sandbox Code Playgroud)
但没有其他描述!即使是谷歌搜索也没有给我带来任何有趣
我唯一知道的是time从纪元提供秒或毫秒并value给出按下按钮的代码.但即便是value财产的价值对我来说也不是很清楚.在我的程序中,每次击键都会产生六个事件.以下事件是按ENTER键的响应:
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
Run Code Online (Sandbox Code Playgroud)
那些是为了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
Run Code Online (Sandbox Code Playgroud)
我想将值解码为真实的字母,但我不明白属性的含义.
请帮忙!
Nom*_*mal 44
的struct input_event是,在其他中,在定义的包括/ LINUX/input.h.
从5. Linux内核中的事件接口Documentation/input/input.txt(并修改为提供正确的头文件名):
time 是时间戳,它返回事件发生的时间.
type例如EV_REL,EV_KEY对于按键或释放的相对时刻.include/linux/input-event-codes.h中定义了更多类型.
code例如,事件代码REL_X或者KEY_BACKSPACE,完整列表在include/linux/input-event-codes.h中.
value是事件带来的价值.无论是相对变化
EV_REL的,绝对的新价值EV_ABS(操纵杆...),或0用于EV_KEY发布,1对于按键和2用于自动重复.
对于指南和示例代码,请进行Web搜索"linux kernel" "input subsystem".