• 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. Repeat Array Generator & String.repeat

      Repeat Array Generator RepeatArrayGenerator "use strict"; /** * * @author xgqfrms * @licen ...

    2. Spoj-ODDDIV Odd Numbers of Divisors

      Given a positive odd integer K and two positive integers low and high, determine how many integers b ...

    3. Spring入门之setter DI注入

      1.新建Java项目导入依赖jar包,参考前一章 2.以不同文件格式输出为例 3.定义接口IOutputGenerator.java package com.spring.output; public ...

    4. *Codeforces963C. Cutting Rectangle

      $n \leq 200000$种互不相同的矩形,给长宽和数量,都$\leq 1e12$,问有多少种大矩形只沿平行长和宽切正好切成这些矩形. 首先可以发现在一个合法情况下,有些矩形的位置是可以乱挪的,比 ...

    5. Oracle常用操作【自己的练习】

      Oracle查询的时候条件要用单引号包裹,不能用双引号;Oracle的in子查询里面的值最多有1000个........ 连接orcl数据库 C:\Windows\system32@orcl as s ...

    6. python生成器及迭代器

      一.迭代器 迭代器是访问集合元素的一种方式 迭代器是一个可以记住遍历的位置的对象. 迭代器对象从集合的第一个元素开始访问,直到所有的元素被访问完结束.迭代器只能往前不会后退. 迭代器有两个基本的方法: ...

    7. 网上找的一篇博文,原文搞错了,应该是\r\n,本文已改正!——回车CR和换行line feed

      "回车"(carriage return)和"换行"(line feed)与 ASCII表 关于“回车”(carriage return)和“换行”(line  ...

    8. maven自动导入包失败

      pom.xml文件依赖添加后,让maven自动导入包,老是失败,文件夹中有其他文件,就是缺少jar文件 解决: // 进入pom.xml所在的文件夹,执行下面的命令,下载jar包 mvn -f pom ...

    9. 模拟用户登录-SpringMVC+Spring+Mybatis整合小案例

      1. 导入相关jar包 ant-1.9.6.jarant-launcher-1.9.6.jaraopalliance.jarasm-5.1.jarasm-5.2.jaraspectj-weaver.j ...

    10. FireDac心得

      usesFireDAC.Phys.MySQL, FireDAC.Stan.Def, FireDAC.DApt, FireDAC.Comp.Client, FireDAC.Comp.UI, FireDA ...