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

/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之输入子系统的更多相关文章
- linux-2.6内核驱动学习——jz2440之按键
//以下是学习完韦东山老师视屏教程后所做学习记录中断方式取得按键值: #include <linux/module.h> #include <linux/kernel.h> ...
- linux驱动学习之Input输入子系统
以前,看过国嵌关于input子系统的视频课程,说实话,我看完后脑子里很乱,给我的印象好像是input子系统驱动是一个全新的驱动架构,疑惑相当多.前几天在网上,看到有很多人介绍韦东山老师的linux驱动 ...
- Linux内核驱动学习(八)GPIO驱动模拟输出PWM
文章目录 前言 原理图 IO模拟输出PWM 设备树 驱动端 调试信息 实验结果 附录 前言 上一篇的学习中介绍了如何在用户空间直接操作GPIO,并写了一个脚本可以产生PWM.本篇的学习会将写一个驱动操 ...
- linux内核驱动学习指南
1. 参考链接 小白的博客 ONE_Tech 你为什么看不懂Linux内核驱动源码? 求教怎么学习linux内核驱动
- Linux内核驱动学习(六)GPIO之概览
文章目录 前言 功能 如何使用 设备树 API 总结 前言 GPIO(General Purpose Input/Output)通用输入/输出接口,是十分灵活软件可编程的接口,功能强大,十分常用,SO ...
- Linux内核驱动学习(三)字符型设备驱动之初体验
Linux字符型设备驱动之初体验 文章目录 Linux字符型设备驱动之初体验 前言 框架 字符型设备 程序实现 cdev kobj owner file_operations dev_t 设备注册过程 ...
- Linux内核驱动学习(十)Input子系统详解
文章目录 前言 框架 如何实现`input device` 设备驱动? 头文件 注册input_dev设备 上报按键值 dev->open()和dev->close() 其他事件类型,处理 ...
- Linux内核驱动学习(九)GPIO外部输入的处理
文章目录 前言 设备树 两个结构体 gpio_platform_data gpio_demo_device 两种方式 轮询 外部中断 总结 附录 前言 前面是如何操作GPIO进行输出,这里我重新实现了 ...
- Linux内核驱动学习(一)编写最简单Linux内核模块HelloWorld
文章目录 准备工作 什么是内核模块 编写 hello.c 模块编译 相关指令 测试结果 模块加载 模块卸载 准备工作 在进行以下操作前,首先我准备了一台电脑,并且安装了虚拟机,系统是Ubuntu16. ...
随机推荐
- Ubuntu 16.04 小飞机启动失败
好长时间没用小飞机了,今天打开发现,无法启动了. 查看了日志: Initialising ciphers... AES-256/CFB (aes-256-cfb) initialised. Runni ...
- python 字符串格式化符号含义及注释
字符串格式化符号含义 符号 说明 %C 格式化字符及其ASCII码 %S 格式化字符串 %d 格式化整数 %o 格式化无符号八进制数 %x 格式化无符号十六进制数 %X 格式化无符号十六进制数(大写) ...
- maven jstl、jsp、servlet依赖
jstl.jsp.servlet依赖 <dependency> <groupId>javax.servlet</groupId> <artifactId> ...
- eval解析json字符串
场景:在springMVC,手动拼接的list,转成本json字符串后,传到前台, 解决:需要解析成json对象,获取对象的属性,动态生成table. 首先,以下是后台准备好的list,list中有两 ...
- Java简单方法批量修改Windows文件夹下的文件名(简单IO使用)
package test.tttt; import java.io.File; import java.util.ArrayList; import java.util.List; public cl ...
- mysql(5.7.17)字符集设置(character_set/collation)
0 查看字符集(character_set/collation) use information_schema;desc tables; --一定记住tables表,information_sc ...
- show tables from information_schema/performance_schema/sys;
root@localhost:3306.sock [performance_schema]>select version();+------------+| version() |+----- ...
- [翻译] FBLikeLayout
FBLikeLayout This is an UICollectionView layout inspired by the photo section of facebook. This layo ...
- [翻译] RAReorderableLayout
RAReorderableLayout A UICollectionView layout which you can move items with drag and drop. 一种UIColle ...
- scrapy爬虫框架之Xpath选择器
问题: 本篇博文主要记录scrapy框架爬取伯乐在线文章的相关知识,在实践中学习对框架的理解.今天主要记录了xpath的相关用法以及语法规范. ----->>>点击进入爬取页面 一. ...