博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux Kernel input 上报事件
阅读量:4152 次
发布时间:2019-05-25

本文共 1855 字,大约阅读时间需要 6 分钟。

 
/** * input_event() - report new input event * @dev: device that generated the event * @type: type of the event * @code: event code * @value: value of the event * * This function should be used by drivers implementing various input * devices to report input events. See also input_inject_event(). * * NOTE: input_event() may be safely used right after input device was * allocated with input_allocate_device(), even before it is registered * with input_register_device(), but the event will not reach any of the * input handlers. Such early invocation of input_event() may be used * to 'seed' initial state of a switch or initial position of absolute * axis, etc. */void input_event(struct input_dev *dev,		 unsigned int type, unsigned int code, int value){	unsigned long flags;	if (is_event_supported(type, dev->evbit, EV_MAX)) {		spin_lock_irqsave(&dev->event_lock, flags);		input_handle_event(dev, type, code, value);		spin_unlock_irqrestore(&dev->event_lock, flags);	}}EXPORT_SYMBOL(input_event);
 
/** * input_inject_event() - send input event from input handler * @handle: input handle to send event through * @type: type of the event * @code: event code * @value: value of the event * * Similar to input_event() but will ignore event if device is * "grabbed" and handle injecting event is not the one that owns * the device. */void input_inject_event(struct input_handle *handle,			unsigned int type, unsigned int code, int value){	struct input_dev *dev = handle->dev;	struct input_handle *grab;	unsigned long flags;	if (is_event_supported(type, dev->evbit, EV_MAX)) {		spin_lock_irqsave(&dev->event_lock, flags);		rcu_read_lock();		grab = rcu_dereference(dev->grab);		if (!grab || grab == handle)			input_handle_event(dev, type, code, value);		rcu_read_unlock();		spin_unlock_irqrestore(&dev->event_lock, flags);	}}EXPORT_SYMBOL(input_inject_event);

转载地址:http://lwhti.baihongyu.com/

你可能感兴趣的文章
如何在Ubuntu下编辑PDF文件
查看>>
用gdb如何查看指定地址的内存内容?
查看>>
__builtin_expect详解
查看>>
关于vmlinux和bzImage
查看>>
分配task_struct时分配页面的大小的问题
查看>>
情景分析中的一个例程
查看>>
rt_mutex
查看>>
Linux 2.6内核中新的锁机制--RCU
查看>>
关于volatile
查看>>
2.4内核中task_struct结构体全解
查看>>
内核/内存管理中的VSS/RSS/PSS/USS
查看>>
用宏初始化结构体
查看>>
Linux3.0.6内核task_struct注释
查看>>
好的学习linux内核的网站
查看>>
malloc函数
查看>>
Linux内核中的简称/前缀/后缀总结
查看>>
ubuntu联网
查看>>
ubuntu arm 交叉编译环境的搭建
查看>>
Ubuntu打不开文件夹
查看>>
内核进程创建之分配task_struct(do_fork->copy_process->dup_task_struct())
查看>>