linux驱动子系统之输入子系统(5)
来源:互联网 发布:office mac 2011 编辑:程序博客网 时间:2024/05/21 06:11
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关系图:
原文见:http://blog.csdn.net/paul_liao/article/details/7016153
- 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)
- JSONObject与JSONArray的使用
- 美团大众各自的10年创业路
- 计算两GPS点之间的距离(比较精确)
- STL源码剖析学习原因案例解析(二)
- 随感
- linux驱动子系统之输入子系统(5)
- 为linux系统增加swap资源
- centos
- Android ActionSheet动画效果实现
- 【小项目】仿真预测理发馆的经营状况
- 每天进步一点点----------Ruby之虚拟主机小程序
- 别了2013,喜迎2014开启我的第一篇博客
- 泛型数组的局限
- 无知的暴虐2