如果按照上一篇记录的那样,只有本公司的人或者自己才能使用驱动。想写出一个通用的驱动程序,让其他应用程序来无缝移植,需要使用现成的驱动——输入子系统。

/drivers/input/input.c


#define EV_SYN 0x00  //同步类
#define EV_KEY 0x01  //按键类
#define EV_REL 0x02  //相对位移类
#define EV_ABS 0x03  //绝对位移 


struct input_dev {

    void *private;

    const char *name;
const char *phys;
const char *uniq;
struct input_id id; unsigned long evbit[NBITS(EV_MAX)]; //表示能产生哪类时间
unsigned long keybit[NBITS(KEY_MAX)];    //表示能产生哪些按键
unsigned long relbit[NBITS(REL_MAX)];    //表示能产生哪些相对位移事件
unsigned long absbit[NBITS(ABS_MAX)];    //表示能产生哪些绝对位移事件
unsigned long mscbit[NBITS(MSC_MAX)];
unsigned long ledbit[NBITS(LED_MAX)];
unsigned long sndbit[NBITS(SND_MAX)];
unsigned long ffbit[NBITS(FF_MAX)];
unsigned long swbit[NBITS(SW_MAX)]; unsigned int keycodemax;
unsigned int keycodesize;
void *keycode;
int (*setkeycode)(struct input_dev *dev, int scancode, int keycode);
int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode); struct ff_device *ff; unsigned int repeat_key;
struct timer_list timer; int state; int sync; int abs[ABS_MAX + ];
int rep[REP_MAX + ]; unsigned long key[NBITS(KEY_MAX)];
unsigned long led[NBITS(LED_MAX)];
unsigned long snd[NBITS(SND_MAX)];
unsigned long sw[NBITS(SW_MAX)]; int absmax[ABS_MAX + ];
int absmin[ABS_MAX + ];
int absfuzz[ABS_MAX + ];
int absflat[ABS_MAX + ]; int (*open)(struct input_dev *dev);
void (*close)(struct input_dev *dev);
int (*flush)(struct input_dev *dev, struct file *file);
int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); struct input_handle *grab; struct mutex mutex; /* serializes open and close operations */
unsigned int users; struct class_device cdev;
union { /* temporarily so while we switching to struct device */
struct device *parent;
} dev; struct list_head h_list;
struct list_head node;
};

linux-2.6内核驱动学习——jz2440之输入子系统的更多相关文章

  1. linux-2.6内核驱动学习——jz2440之按键

      //以下是学习完韦东山老师视屏教程后所做学习记录中断方式取得按键值: #include <linux/module.h> #include <linux/kernel.h> ...

  2. linux驱动学习之Input输入子系统

    以前,看过国嵌关于input子系统的视频课程,说实话,我看完后脑子里很乱,给我的印象好像是input子系统驱动是一个全新的驱动架构,疑惑相当多.前几天在网上,看到有很多人介绍韦东山老师的linux驱动 ...

  3. Linux内核驱动学习(八)GPIO驱动模拟输出PWM

    文章目录 前言 原理图 IO模拟输出PWM 设备树 驱动端 调试信息 实验结果 附录 前言 上一篇的学习中介绍了如何在用户空间直接操作GPIO,并写了一个脚本可以产生PWM.本篇的学习会将写一个驱动操 ...

  4. linux内核驱动学习指南

    1. 参考链接 小白的博客 ONE_Tech 你为什么看不懂Linux内核驱动源码? 求教怎么学习linux内核驱动

  5. Linux内核驱动学习(六)GPIO之概览

    文章目录 前言 功能 如何使用 设备树 API 总结 前言 GPIO(General Purpose Input/Output)通用输入/输出接口,是十分灵活软件可编程的接口,功能强大,十分常用,SO ...

  6. Linux内核驱动学习(三)字符型设备驱动之初体验

    Linux字符型设备驱动之初体验 文章目录 Linux字符型设备驱动之初体验 前言 框架 字符型设备 程序实现 cdev kobj owner file_operations dev_t 设备注册过程 ...

  7. Linux内核驱动学习(十)Input子系统详解

    文章目录 前言 框架 如何实现`input device` 设备驱动? 头文件 注册input_dev设备 上报按键值 dev->open()和dev->close() 其他事件类型,处理 ...

  8. Linux内核驱动学习(九)GPIO外部输入的处理

    文章目录 前言 设备树 两个结构体 gpio_platform_data gpio_demo_device 两种方式 轮询 外部中断 总结 附录 前言 前面是如何操作GPIO进行输出,这里我重新实现了 ...

  9. Linux内核驱动学习(一)编写最简单Linux内核模块HelloWorld

    文章目录 准备工作 什么是内核模块 编写 hello.c 模块编译 相关指令 测试结果 模块加载 模块卸载 准备工作 在进行以下操作前,首先我准备了一台电脑,并且安装了虚拟机,系统是Ubuntu16. ...

随机推荐

  1. ciscn2018-pwn-wp

    前言 2018全国大学生网络安全竞赛 ,做了2 道题 task_supermarket change_desc 里面调用 realloc 会触发 uaf 利用 uaf 修改 obj->desc_ ...

  2. SqlSugarClientHelper

    using SqlSugar; using System; using System.Collections.Generic; using System.Configuration; using Sy ...

  3. jquery validation表单验证插件。

    这个是刚学的,觉得对以后挺有用的,就想把自己所学的分享一下. 校验规则: (1)required:true 必输字段 (2)number:true 必须输入合法的数字(负数,小数) (3)digits ...

  4. 国内一元钱 正常搭建android开发环境

    如果你人在gfw之外,那么此篇文章对你来说毫无用处,请自动略过.. 笔者自android出来之后,就一直想尝试一下.可惜,几年来一直未能够定下身心来研究尝试.而所做的工作也与android没有关系,所 ...

  5. ExpressRoute 线路预配工作流和线路状态

    本页从较高层面引导你完成服务预配和路由配置工作流. 下图和相应的步骤说明了预配端到端 ExpressRoute 线路所要执行的任务. 使用 PowerShell 配置 ExpressRoute 线路. ...

  6. .Net Core+Vue.js+ElementUI 实现前后端分离

    .Net Core+Vue.js+ElementUI 实现前后端分离 Tags: Vue 架构 前端采用:Vue.js.Element-UI.axios 后端采用:.Net Core Mvc 本项目是 ...

  7. python基础_类型_str

    #python不用考虑变量,可随时变换,自动分配内存,比如a = 'jjj'后a = 123是可以的 #str 文本 字符串 #常用函数 a = ' abcefg \n' a.strip() #去掉前 ...

  8. [UI] 精美UI界面欣赏[9]

    精美UI界面欣赏[9]

  9. Redis学习---Redis操作之Hash

    hash表现形式上有些像pyhton中的dict,可以存储一组关联性较强的数据[有点像嵌套字典] hset(name, key, value) --> 设置hash的操作 # 参数:     # ...

  10. python3: 字符串和文本

    1. 分割字符串-使用多个界定符[re.split()] >>> line = 'asdf fjdk; afed, fjek,asdf, foo' >>> impo ...