input_system
2022-08-01 17:51:19 0 举报
input system框架
作者其他创作
大纲/内容
struct kobject
const char\t\t*name;\t//virtualstruct kobject\t\t*parent;struct kset\t\t*kset;\t\t\tstruct kobj_type\t*ktype;\t//dynamic_kobj_ktypestruct sysfs_dirent\t*sd;
const char\t\t*name;\t\t//inputstruct kobject\t\t*parent;struct kset\t\t*kset;\t\t\tstruct kobj_type\t*ktype;\t\t\tstruct sysfs_dirent\t*sd;
NULL
user 系统调用(devfs)
next
Event Data
struct input_handle
void *private; int open;const char *name; //event0struct input_dev *dev; ///ft5x06_ts struct input_handler *handler; //evdevstruct list_head\td_node;struct list_head\th_node;
input_handler_list某一类的inputdev的通用处理逻辑
struct evdev_client
unsigned int head;unsigned int tail;unsigned int packet_head;spinlock_t buffer_lock;struct wake_lock wake_lock;bool use_wake_lock;char name[28];struct fasync_struct *fasync;struct evdev *evdev;struct list_head node;int clkid;unsigned int bufsize;struct input_event buffer[];
input device句柄
prev
const char\t\t*name;\tdevices (/sys/devices)struct kobject\t\t*parent;struct kset\t\t*kset;\t\t\tstruct kobj_type\t*ktype;\t\t\tstruct sysfs_dirent\t*sd;
struct input_dev
const char *name; //ft5x06_ts struct list_head\tnode;
struct list_head h_list; //handle head
sysfs中input相关节点
input_handler_list
const char\t\t*name;\t\t\tiinput0struct kobject\t\t*parent;struct kset\t\t*kset;\t\t\tdevices_ksetstruct kobj_type\t*ktype;\t\t\tdevice_ktypestruct sysfs_dirent\t*sd;
/sys/devices/virtual/input/input0
...
/sys/devices/virtual
const char *name; //xxx2struct list_head\tnode;
struct file_operations
input_handler-node input_handler_list
/dev/input/event0
struct device
struct device\t\t *parent; //sys/device/virtual/input/input0struct device_private\t *p;struct kobject kobj;const char\t\t *init_name;const struct device_type *type; struct bus_type\t *bus;\t\tstruct device_driver *driver;\tvoid\t\t *platform_data;\tstruct device_node\t *of_node;dev_t\t\t\t devt; //13:64+Xu32\t\t\t id;\tstruct klist_node\t knode_class;struct class\t\t *class; //input_class
/sys/devices
input_dev-node input_dev_list
/sys/devices/virtual/input
evdev device句柄
event_open alloc
struct cdev
\tstruct kobject kobj;\tstruct module *owner;\tconst struct file_operations *ops;\tstruct list_head list;\tdev_t dev;\tunsigned int count;
struct input_handler
const char *name; //keyboardstruct list_head\tnode;
struct device\t\t *parent;struct device_private\t *p;struct kobject kobj;const char\t\t *init_name;const struct device_type *type; //input_dev_typestruct bus_type\t *bus;\t\tstruct device_driver *driver;\tvoid\t\t *platform_data;\tstruct device_node\t *of_node;dev_t\t\t\t devt; u32\t\t\t id;\tstruct klist_node\t knode_class;struct class\t\t *class; //input_class
\tconst char\t\t*name;\t\t\t//event0\tstruct kobject\t\t*parent;\tstruct kset\t\t*kset;\t\t\tdevices_kset\tstruct kobj_type\t*ktype;\t\t\tdevice_ktype\tstruct sysfs_dirent\t*sd;
user的每一个进程去Open /dev/input/eventx时都会创建一个对应的client
input_dev_list
/sys/devices/virtual/input/input0/event0
struct evdev
int open;struct input_handle handle;wait_queue_head_t wait;struct evdev_client __rcu *grab;struct list_head client_list;spinlock_t client_lock; struct mutex mutex;struct device dev;struct cdev cdev;bool exist; //true
input_device_list由input_register_device时注册到该列表中
const char *name; //xxx1struct list_head\tnode;
const char *name; //evdev struct list_head\tnode;
.event = evdev_event.events = evdev_event1.connect = evdev_connect.disconnect = evdev_disconnectstruct list_head h_list; //handle head
const char *name; //mousedevstruct list_head\tnode;
\tunsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)];\tunsigned long evbit[BITS_TO_LONGS(EV_CNT)];\tunsigned long keybit[BITS_TO_LONGS(KEY_CNT)];\tunsigned long relbit[BITS_TO_LONGS(REL_CNT)];\tunsigned long absbit[BITS_TO_LONGS(ABS_CNT)];\tunsigned long mscbit[BITS_TO_LONGS(MSC_CNT)];\tunsigned long ledbit[BITS_TO_LONGS(LED_CNT)];\tunsigned long sndbit[BITS_TO_LONGS(SND_CNT)];\tunsigned long ffbit[BITS_TO_LONGS(FF_CNT)];\tunsigned long swbit[BITS_TO_LONGS(SW_CNT)];
0 条评论
下一页