Input_输入子系统
Posted panda-w
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Input_输入子系统相关的知识,希望对你有一定的参考价值。
应用 open() read() write() close() (type,code,value)
(创建设备节点,实现FOPS)|------------->event-------> ↑ struct_input_eveent
input_handler层 | 1.创建设备节点 >event_client (口—口—口) 数组队列
(evdev.c) (input_handler)-->connect-->2.分配event对象-->input_handle*handler , *dev
(创建个类,申请编号) ↓ input_handler_list
input_core层 恒匹配
(input.c) ↑ input_device_list
(input_dev)------->input_event;input_sync
input_device层
(自己写) --->(1.分配对象 2.初始对象 3.注册对象 4.初始迎检)
硬件 EV_ABS EV_KEY EV_REL
<结构体>
struct input_dev
const char *name;
const char *phys;
const char *uniq;
struct input_id id;
//位表
unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; //表示能够产生哪种类型的数据:EV_KEY,EV_ABS
unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; //表示能够产生哪些按键数据
unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; //表示能够产生哪些相对坐标数据
unsigned long absbit[BITS_TO_LONGS(ABS_CNT)]; //表示能够产生哪些绝对坐标数据
unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)];
unsigned long ledbit[BITS_TO_LONGS(LED_CNT)];
unsigned long sndbit[BITS_TO_LONGS(SND_CNT)];
unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
unsigned long swbit[BITS_TO_LONGS(SW_CNT)];
struct device dev; //父类
struct list_head h_list;
struct list_head node; //链表的节点
;
struct input_event //上报给用户的输入设备的数据包的类型
struct timeval time; //时间戳
__u16 type; //读到的数据类型:EV_KEY,EV_ABS,EV_REL
__u16 code; //编码值
__s32 value; //状态
;
<笔记>
1.input_core
编程:
1,分配一个 input device对象
2,初始化input device对象
3,注册input device对象
4,硬件初始化,获取到硬件的数据,上报给input handler
以上是关于Input_输入子系统的主要内容,如果未能解决你的问题,请参考以下文章