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 .... ...
随机推荐
- HTML与XML的区别
什么是HTML HTML的全拼是Hypertext Markup Language, 中文也就是超文本链接标示语言.HTML(HyperTextMark-upLanguage)即超文本标记语言,是WW ...
- 【LeetCode】Jewels and Stones(宝石与石头)
这道题是LeetCode里的第771道题. 题目要求: 给定字符串J 代表石头中宝石的类型,和字符串 S代表你拥有的石头. S 中每个字符代表了一种你拥有的石头的类型,你想知道你拥有的石头中有多少是宝 ...
- .NET重构(八):周结账单中,给报表添加参数
导读:进行完了日结报表的制作,大松一口气.不过,刚开始看着周结账单中的两个参数问题,也是愁了很久.不过,只要思想不滑坡,办法总比困难多.接下来,就写写我制作周结账单报表的过程. 一.添加参数 1,在日 ...
- HDU-4612 Warm up,tarjan求桥缩点再求树的直径!注意重边
Warm up 虽然网上题解这么多,感觉写下来并不是跟别人竞争访问量的,而是证明自己从前努力过,以后回头复习参考! 题意:n个点由m条无向边连接,求加一条边后桥的最少数量. 思路:如标题,tarjan ...
- [luoguP3110] [USACO14DEC]驮运Piggy Back(SPFA || BFS)
传送门 以 1,2,n 为起点跑3次 bfs 或者 spfa 那么 ans = min(ans, dis[1][i] * B + dis[2][i] * E + dis[3][i] * P) (1 & ...
- 洛谷P3759 - [TJOI2017]不勤劳的图书管理员
Portal Description 给出一个\(1..n(n\leq5\times10^4)\)的排列\(\{a_n\}\)和数列\(\{w_n\}(w_i\leq10^5)\),进行\(m(m\l ...
- 清除svn检出导致的所有文件的问号
问题:将svn项目检出到桌面后,桌面的图标都有问号了,怎么消除这一大堆问号? 解决方案:(1)新建一个a.txt文件,把这行代码复制进去for /r . %%a in (.) do @if exist ...
- 动态添加radiogroup
private LinearLayout layout; //布局 , 可以在xml布局中获得 private RadioGroup group ; //点选按钮组 public void onCre ...
- 438. Find All Anagrams in a Strin
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings ...
- Elasticsearch使用syslog发送Watcher告警事件
https://blog.csdn.net/mvpboss1004/article/details/70158864?locationNum=9&fps=1