2013年10月13日

linux 输入子系统(4)---- input子系统的初始化

摘要: Input子系统的初始化函数为input_init(),如下:static int __init input_init(void){ int err; input_init_abs_bypass(); err = class_register(&input_class); if (err) { printk(KERN_ERR "input: unable to register input_dev class\n"); return err; } err = input_proc_init(); if (err) ... 阅读全文

posted @ 2013-10-13 18:48 熊猫酒仙是也 阅读(877) 评论(0) 推荐(0) 编辑

linux 输入子系统(3)----事件处理(input_handler层)

摘要: 输入子系统主要设计input_dev、input_handler、input_handle。如下:【1】每个struct input_dev代表一个输入设备struct input_dev { const char *name;//设备名 const char *phys; const char *uniq; struct input_id id;//用于匹配事件处理层handler unsigned long evbit[BITS_TO_LONGS(EV_CNT)];//用于记录支持的事件类型的位图 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];. 阅读全文

posted @ 2013-10-13 15:47 熊猫酒仙是也 阅读(1620) 评论(0) 推荐(0) 编辑

linux 输入子系统(2)----简单实例分析系统结构(input_dev层)

摘要: 实例代码如下:#include #include #include #include #include #define BUTTON_IRQ 123static struct input_dev *button_dev ;/*输入设备结构体*/static irqreturn_t button_interrupt(int irq, void *dummy) /*中断处理函数*/{ input_report_key(button_dev, BTN_0, inb(BUTTON_PORT) & 1);/*向输入子系统报告产生按键事件*/ ===========》》》》》【3】 i... 阅读全文

posted @ 2013-10-13 14:17 熊猫酒仙是也 阅读(1290) 评论(0) 推荐(0) 编辑

linux 输入子系统(1)----系统概述

摘要: 输入设备的工作中,只是中断、读键值/坐标值是设备相关的,而输入事件的缓冲区管理以及字符设备驱动的file_operations接口则对输入设备是通用的,基于此,内核设计了input输入子系统,由核心层处理公共事务。 Linux内核输入子系统的框架如下图: 由上图可以看出,input子系统由设备驱动层、输入子系统核心层(input core)和事件处理层(event handler)3部分组成。如下图所示: 一个输入事件,如鼠标移动,通过 驱动层=》核心层=》事件层=》用户空间 的顺序到达用户空间并传递给应用程序。 阅读全文

posted @ 2013-10-13 12:29 熊猫酒仙是也 阅读(351) 评论(0) 推荐(0) 编辑

(转载)Linux usbtouchscreen驱动分析

摘要: 在Linux内核中自带USB触摸屏驱动,以linux-2.6.33.3\drivers\input\touchscreen.c为例,进行解析:1.驱动加载:static int __init usbtouch_init(void){return usb_register(&usbtouch_driver); //驱动注册}其中usbtouch_driver定义为: static struct usb_driver usbtouch_driver = {.name = "usbtouchscreen", //驱动名称.probe = usbtouch_probe, / 阅读全文

posted @ 2013-10-13 09:52 熊猫酒仙是也 阅读(928) 评论(0) 推荐(0) 编辑

导航