linux驱动子系统之输入子系统(5)
来源:互联网 发布:淘宝店铺托管公司排名 编辑:程序博客网 时间:2024/05/17 05:13
linux驱动子系统之输入子系统(5)
5. 总结
5.1 事件信息的上报过程分析
l 上报的大致过程:设备驱动层->核心层->事件处理层->应用层
l 具体调用的函数(以evdev为例):input_event()->input_handle_event() ->input_pass_event() ->handle->handler->event(handle,type, code, value) ->evdev_event() ->evdev_pass_event() ,然后通过client->buffer[client->head++]= *event赋值给client(是struct evdev_client)
很奇怪,这不还是在内核空间,根本就没传递到应用空间。别忘了事件驱动层还实现了一个file_operations,我们先来看下evdev_read函数:
static ssize_t evdev_read(struct file *file, char __user *buffer,
size_t count, loff_t *ppos)
{
struct evdev_client *client =file->private_data;
struct evdev *evdev =client->evdev;
struct input_eventevent;
while (retval +input_event_size() <= count &&
evdev_fetch_next_event(client,&event)) {
if (input_event_to_user(buffer +retval, &event))
return-EFAULT;
retval +=input_event_size();
}
}
看明白了吧,通过input_event_to_user()-> copy_to_user()把信息传递到用户空间。
5.2 input_dev、input_handler和input_handle三者的关系
l input_dev、input_handler和input_handle关系图:
- linux驱动子系统之输入子系统(5)
- linux驱动子系统之输入子系统(5)
- linux驱动子系统之输入子系统(5)
- linux驱动子系统之输入子系统(5)
- linux驱动子系统之输入子系统(1)
- linux驱动子系统之输入子系统(2)
- linux驱动子系统之输入子系统(3)
- linux驱动子系统之输入子系统(4)
- Linux驱动子系统之输入子系统
- Linux驱动子系统之输入子系统
- linux驱动子系统之输入子系统(1)
- linux驱动子系统之输入子系统(2)
- linux驱动子系统之输入子系统(3)
- linux驱动子系统之输入子系统(4)
- Linux驱动子系统之输入子系统
- Linux驱动子系统之输入子系统
- linux驱动子系统之输入子系统(2)
- linux驱动子系统之输入子系统(1)
- popupwindow进阶--自定义menu
- 关于VMware的安装
- 跟我一起写 Makefile
- linux驱动子系统之输入子系统(4)
- 监听器统计网站在线人数与在线会员数
- linux驱动子系统之输入子系统(5)
- SqlServer2008修改表栏位提示权限问题
- GCC使用入门
- using的几种用法
- 搜狗拼音的几个进程
- XA事务规范
- java代码实现选择法排序
- c#学习
- 轻量级开源的ANSI C下XML解析库—Mini-XML