• Name
  • struct input_dev — represents an input device
  • Synopsis
  • struct input_dev {
  • const char * name; //name of the device
  • const char * phys; //physical path to the device in the system hierarchy
  • const char * uniq; //unique identification code for the device (if device has it)
  •   struct input_id id; //id of the device (struct input_id)
  •   unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; //bitmap of types of events supported by the device (EV_KEY, EV_REL, etc.)
  •   unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; //bitmap of keys/buttons this device has
  •   unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; //bitmap of relative axes for the device
  •   unsigned long absbit[BITS_TO_LONGS(ABS_CNT)]; //bitmap of absolute axes for the device
  •   unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)]; //bitmap of miscellaneous events supported by the device
  •   unsigned long ledbit[BITS_TO_LONGS(LED_CNT)]; //bitmap of leds present on the device
  •   unsigned long sndbit[BITS_TO_LONGS(SND_CNT)]; //bitmap of sound effects supported by the device
  •   unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; //bitmap of force feedback effects supported by the device
  •   unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; //bitmap of switches present on the device
  •   unsigned int keycodemax; //size of keycode table
  •   unsigned int keycodesize; //size of elements in keycode table
  •   void * keycode; //map of scancodes to keycodes for this device
  • /*optional method to alter current keymap, used to implement sparse keymaps.
  • If not supplied default mechanism will be used*/
  • int (* setkeycode) (struct input_dev *dev, int scancode, int keycode);
  • /*optional method to retrieve current keymap. If not supplied default mechanism will be used*/
  • int (* getkeycode) (struct input_dev *dev, int scancode, int *keycode);
  •   struct ff_device * ff; //force feedback structure associated with the device if device supports force feedback effects
  •   unsigned int repeat_key; //stores key code of the last key pressed; used to implement software autorepeat
  •   struct timer_list timer; //timer for software autorepeat
  • int sync; //set to 1 when there were no new events since last EV_SYNC
  • int abs[ABS_MAX + 1]; //current values for reports from absolute axes
  • int rep[REP_MAX + 1]; //current values for autorepeat parameters (delay, rate)
  •   unsigned long key[BITS_TO_LONGS(KEY_CNT)]; //reflects current state of device's keys/buttons
  •   unsigned long led[BITS_TO_LONGS(LED_CNT)]; //reflects current state of device's LEDs
  •   unsigned long snd[BITS_TO_LONGS(SND_CNT)]; //reflects current state of sound effects
  •   unsigned long sw[BITS_TO_LONGS(SW_CNT)]; //reflects current state of device's switches
  • int absmax[ABS_MAX + 1]; //maximum values for events coming from absolute axes
  • int absmin[ABS_MAX + 1]; //minimum values for events coming from absolute axes
  • int absfuzz[ABS_MAX + 1]; //describes noisiness for axes
  • int absflat[ABS_MAX + 1]; //size of the center flat position (used by joydev)
  • /*this method is called when the very first user calls input_open_device.
  • The driver must prepare the device to start generating events (start polling
  • thread, request an IRQ, submit URB, etc.) */
  • int (* open) (struct input_dev *dev);
  •   void (* close) (struct input_dev *dev); //this method is called when the very last user calls input_close_device.
  • /*purges the device. Most commonly used to get rid of force feedback effects
  •   loaded into the device when disconnecting from it */
  • int (* flush) (struct input_dev *dev, struct file *file);
  • /*event handler for events sent _to_ the device, like EV_LED or EV_SND.
  •   The device is expected to carry out the requested action (turn on a LED, play sound, etc.)
  •   The call is protected by event_lock and must not sleep */
  • int (* event) (struct input_dev *dev, unsigned int type, unsigned int code, int value);
  • /*input handle that currently has the device grabbed (via EVIOCGRAB ioctl).
  •   When a handle grabs a device it becomes sole recipient for all input events coming from the device */
  •   struct input_handle * grab;
  • /*this spinlock is is taken when input core receives and processes a new event for the device (in input_event). Code that accesses and/or modifies parameters of a device (such as keymap or absmin, absmax, absfuzz, etc.) after device has been registered with input core must take this lock. */
  •   spinlock_t event_lock;
  •   struct mutex mutex; //serializes calls to open, close and flush methods
  • /*stores number of users (input handlers) that opened this device. It is used by input_open_device and input_close_device to make sure that dev->open is only called when the first user opens device and dev->closeis called when the very last user closes the device */
  •   unsigned int users;
  • int going_away; //marks devices that are in a middle of unregistering and causes input_open_device*() fail with -ENODEV.
  •   struct device dev; //driver model's view of this device
  •   struct list_head h_list; //list of input handles associated with the device. When accessing the list dev->mutex must be held
  •   struct list_head node; //used to place the device onto input_dev_list
  • };
  • linux 输入子系统(4) intput_dev 接口描述的更多相关文章

    1. Linux输入子系统(转)

      Linux输入子系统(Input Subsystem) 1.1.input子系统概述 输入设备(如按键,键盘,触摸屏,鼠标等)是典型的字符设备,其一般的工作机制是低层在按键,触摸等动作发生时产生一个中 ...

    2. Linux输入子系统详解

      input输入子系统框架  linux输入子系统(linux input subsystem)从上到下由三层实现,分别为:输入子系统事件处理层(EventHandler).输入子系统核心层(Input ...

    3. linux输入子系统简述【转】

      本文转载自:http://blog.csdn.net/xubin341719/article/details/7678035 1,linux输入子系统简述 其实驱动这部分大多还是转载别人的,linux ...

    4. linux输入子系统

      linux输入子系统(linux input subsystem)从上到下由三层实现,分别为:输入子系统事件处理层(EventHandler).输入子系统核心层(InputCore)和输入子系统设备驱 ...

    5. 7.Linux 输入子系统分析

      为什么要引入输入子系统? 在前面我们写了一些简单的字符设备的驱动程序,我们是怎么样打开一个设备并操作的呢? 一般都是在执行应用程序时,open一个特定的设备文件,如:/dev/buttons .... ...

    6. linux输入子系统(input subsystem)之evdev.c事件处理过程

      1.代码 input_subsys.drv.c 在linux输入子系统(input subsystem)之按键输入和LED控制的基础上有小改动,input_subsys_test.c不变. input ...

    7. Linux输入子系统(Input Subsystem)

      Linux输入子系统(Input Subsystem) http://blog.csdn.net/lbmygf/article/details/7360084 input子系统分析  http://b ...

    8. Linux输入子系统框架分析(1)

      在Linux下的输入设备键盘.触摸屏.鼠标等都能够用输入子系统来实现驱动.输入子系统分为三层,核心层和设备驱动层.事件层.核心层和事件层由Linux输入子系统本身实现,设备驱动层由我们实现.我们在设备 ...

    9. linux输入子系统概念介绍

      在此文章之前,我们讲解的都是简单的字符驱动,涉及的内容有字符驱动的框架.自动创建设备节点.linux中断.poll机制.异步通知.同步互斥.非阻塞.定时器去抖动. 上一节文章链接:http://blo ...

    随机推荐

    1. 对于一棵二叉树,请设计一个算法,创建含有某一深度上所有结点的链表。 给定二叉树的根结点指针TreeNode* root,以及链表上结点的深度,请返回一个链表ListNode,代表该深度上所有结点的值,请按树上从左往右的顺序链接,保证深度不超过树的高度,树上结点的值为非负整数且不超过100000。

      /* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x ...

    2. 学习笔记1——下载和安装WordPress

      首先,到WordPress官方网站下载WordPress,下载地址https://cn.wordpress.org/txt-download/ 然后,将下载后的文件夹放在www目录下,到浏览器中输入l ...

    3. 【LeetCode】Two Sum(两数之和)

      这道题是LeetCode里的第1道题. 题目描述: 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标. 你可以假设每种输入只会 ...

    4. [转载] Laya性能优化精选内容整理

      第一是性能统计工具,这是LayaAir引擎内置的性能统计工具,在代码加入Laya.Stat.show(); 引擎内置的性能统计工具 打开这个工具后,可以用于观察性能,除了FPS越高越好外,其它的值越低 ...

    5. 爆炸几何之 CCPC网络赛 I - The Designer (笛卡尔定理)

      本文版权归BobHuang和博客园共有,不得转载.如想转载,请联系作者,并注明出处.   Nowadays, little hahahaha got a problem from his teache ...

    6. hdu2074

      我先求出交叉的gird,然后再一行一行求得.感觉还可以吧.思路比较清晰,开始想的是数是第几行然后从每一行的前后开始控制,好麻烦的感觉,我就先求出来了框架再做就好做多啦!后来PE,突然发现我特殊处理n= ...

    7. iOS学习笔记14-网络(三)WebView

      一.WebView WebView就是一个内嵌浏览器控件,在iOS中主要有两种WebView:UIWebView和WKWebView,UIWebView是iOS2之后开始使用,WKWebView是在i ...

    8. MyEclipse6.5增加对Tomcat7的支持

      MyEclipse6.5增加对Tomcat7的支持 最近在研究Servlet3.0,它是JavaEE6.0规范中的一部分 而Servlet3.0对服务器是有要求的,比如Tomcat7+(而Tomcat ...

    9. 洛谷 [P3480] KAM-Pebbles

      博弈论转化 本题的限制条件很多,我们尝试转化, 我们发现,定义 c[i] 为第 i 堆可以取得数量,如果第 i 堆取出了 x ,那么 c[i] - x , c[i + 1] + x 我们发现这是一个反 ...

    10. 16.1113 模拟考试T2

      测试题 #4 括号括号[问题描述]有一个长度为?的括号序列,以及?种不同的括号.序列的每个位置上是哪种括号是随机的,并且已知每个位置上出现每种左右括号的概率.求整个序列是一个合法的括号序列的概率.我们 ...