linux 输入子系统(2) platform device
Input platform device 一般是在板级bsp注册了的资源。
以gpio-keys为例:
#####################gpio_key.h##############################
#ifndef _GPIO_KEYS_H
#define _GPIO_KEYS_H
struct gpio_keys_button {
/* Configuration parameters */
unsigned int code; /* input event code (KEY_*, SW_*) */ //上报事件的code
int gpio; /* gpio num*/
int active_low; //是否低电平有效
const char *desc; /* 功能描述 */
unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */
int wakeup; /* configure the button as a wake-up source */
int debounce_interval; /* debounce ticks interval in msecs *//* 去抖动间隔,单位微秒*/
int lock_interval; /* pause for a moment when the key is pressed */
bool can_disable;
int value; /* axis value for EV_ABS */
};
struct gpio_keys_platform_data {
struct gpio_keys_button *buttons;
int nbuttons;
unsigned int poll_interval; /* polling interval in msecs -
for polling driver only */
unsigned int rep:1; /* enable input subsystem auto repeat */
int (*enable)(struct device *dev);
void (*disable)(struct device *dev);
const char *name; /* input device name */
};
#endif
######################################################################
#ifdef CONFIG_KEYBOARD_GPIO
/*以下表明即将注册五个gpio button信息*/
static struct gpio_keys_button board_buttons[] = {
#ifdef GPIO_RECORD
{
.gpio = GPIO_RECORD,
.code = KEY_RECORD,
.desc = "record key",
.active_low = 1,
},
#endif
#ifdef GPIO_AP_STA
{
.gpio = GPIO_AP_STA,
.code = KEY_MODE,
.desc = "ap/sta shift",
.active_low = 1,
},
#endif
#ifdef GPIO_POWER
{
.gpio = GPIO_POWER,
.code = KEY_POWER,
.desc = "power wakeup",
.active_low = 1,
.wakeup = 1,
},
#endif
#ifdef GPIO_VOLUMEDOWN
{
.gpio = GPIO_VOLUMEDOWN,
.code = KEY_VOLUMEDOWN,
.desc = "volum down key",
.active_low = 1,
},
#endif
#ifdef GPIO_VOLUMEUP
{
.gpio = GPIO_VOLUMEUP,
.code = KEY_VOLUMEUP,
.desc = "volum up key",
.active_low = 1,
},
#endif
};
static struct gpio_keys_platform_data board_button_data = {
.buttons = board_buttons,
.nbuttons = ARRAY_SIZE(board_buttons),
};
static struct platform_device button_device = {
.name = "gpio-keys",
.id = -1,
.num_resources = 0,
.dev = {
.platform_data = &board_button_data,
}
};
#endif/* CONFIG_KEYBOARD_GPIO */
//注册platform button device
#ifdef CONFIG_KEYBOARD_GPIO
platform_device_register(&button_device);
#endif
linux 输入子系统(2) platform device的更多相关文章
- Linux输入子系统详解
input输入子系统框架 linux输入子系统(linux input subsystem)从上到下由三层实现,分别为:输入子系统事件处理层(EventHandler).输入子系统核心层(Input ...
- linux输入子系统
linux输入子系统(linux input subsystem)从上到下由三层实现,分别为:输入子系统事件处理层(EventHandler).输入子系统核心层(InputCore)和输入子系统设备驱 ...
- linux输入子系统(input subsystem)之evdev.c事件处理过程
1.代码 input_subsys.drv.c 在linux输入子系统(input subsystem)之按键输入和LED控制的基础上有小改动,input_subsys_test.c不变. input ...
- Linux输入子系统(转)
Linux输入子系统(Input Subsystem) 1.1.input子系统概述 输入设备(如按键,键盘,触摸屏,鼠标等)是典型的字符设备,其一般的工作机制是低层在按键,触摸等动作发生时产生一个中 ...
- Linux输入子系统(Input Subsystem)
Linux输入子系统(Input Subsystem) http://blog.csdn.net/lbmygf/article/details/7360084 input子系统分析 http://b ...
- Linux输入子系统框架分析(1)
在Linux下的输入设备键盘.触摸屏.鼠标等都能够用输入子系统来实现驱动.输入子系统分为三层,核心层和设备驱动层.事件层.核心层和事件层由Linux输入子系统本身实现,设备驱动层由我们实现.我们在设备 ...
- linux输入子系统概念介绍
在此文章之前,我们讲解的都是简单的字符驱动,涉及的内容有字符驱动的框架.自动创建设备节点.linux中断.poll机制.异步通知.同步互斥.非阻塞.定时器去抖动. 上一节文章链接:http://blo ...
- linux输入子系统简述【转】
本文转载自:http://blog.csdn.net/xubin341719/article/details/7678035 1,linux输入子系统简述 其实驱动这部分大多还是转载别人的,linux ...
- 7.Linux 输入子系统分析
为什么要引入输入子系统? 在前面我们写了一些简单的字符设备的驱动程序,我们是怎么样打开一个设备并操作的呢? 一般都是在执行应用程序时,open一个特定的设备文件,如:/dev/buttons .... ...
随机推荐
- USACO Runaround Numbers
题目大意:问最近的比n大的循环数是多少 思路:第n遍暴力大法好 /*{ ID:a4298442 PROB:runround LANG:C++ } */ #include<iostream> ...
- CentOS7下安装Docker-Compose No module named 'requests.packages.urllib3'
在使用Docker的时候,有一个工具叫做 docker-compose,安装它的前提是要安装pip工具. 1.首先检查Linux有没有安装Python-pip包,直接执行 yum install p ...
- 转载:C++读取特定路径下文件目录及文件名称
转载地址:http://www.cnblogs.com/tgyf/p/3839894.html void getAllFiles( string path, vector<string>& ...
- Elasticsearch 禁止Body覆盖URL中的参数
以通过设置参数rest.action.multi.allow_explicit_index为false来关闭覆盖功能. 这个设置会对所有的节点起作用,设置方法如下: 在config/elasticse ...
- indexedDB 增删改查
/** * 打开数据库 */ export function openDB() { return new Promise((resolve, reject) => { let indexedDB ...
- POJ 2096 (dp求期望)
A - Collecting Bugs Time Limit:10000MS Memory Limit:64000KB 64bit IO Format:%I64d & %I64 ...
- go gin框架 static 静态文件
项目结构: DemoPro: .. .. static/ test.txt .. router := gin.Default() router.Static("/static", ...
- web开发规范文档
Web前端开发规范文档 规范目的: 使开发流程更加规范化. 通用规范: TAB键用两个空格代替(windos下tab键占四个空格,linux下TAB键占八个空格). CSS样式属性或者JAVASCR ...
- HTML 中 SELECT 选项分组
<select name="viewType"> <option value selected>选择排序/显示方式</option> <o ...
- Codeforces 864E Fire(DP)
题目链接 Fire 题意 有n个物品,每个物品的挽救时间代价为ti, 消失时刻为di, 价值为pi. 如果要救某个物品,必须在他消失之前救出来. 同一时刻最多只能救一件物品. 当前耗时为当前已经救出的 ...