• 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. 【转载】标准C语言的输入输出流(i/o)方法详解

      标准 C I/O clearerr 语法: #include <stdio.h> void clearerr( FILE *stream ); clearerr函数重置错误标记和给出的流的 ...

    2. zoj2112 主席树动态第k大 (主席树&&树状数组)

      Dynamic Rankings Time Limit: 10 Seconds      Memory Limit: 32768 KB The Company Dynamic Rankings has ...

    3. 九度oj 题目1012:畅通工程

      题目描述: 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇.省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路 ...

    4. nginx的简介和配置文件实例(一)

      此文章配合 nginx配置文件解答    共同分享,了解. 一.nginx服务简介Nginx是一个高性能的HTTP和反向代理服务器 使用 Nginx 前必须了解的事项: 1)Nginx 本身只是一个 ...

    5. 【Luogu】P1896互不侵犯King(状压DP)

      题目链接 真是可恶,被数据范围坑了一把.想要一遍AC的希望破灭了…… 以后大家在做状压DP的时候一定要开long long…… 设f[i][j][k]表示考虑前i行,总共放了j个King,第i行状态为 ...

    6. 算法复习——凸包加旋转卡壳(poj2187)

      题目: Description Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest ...

    7. Spoj-VISIBLEBOX Decreasing Number of Visible Box

      Shadowman loves to collect box but his roommates woogieman and itman don't like box and so shadowman ...

    8. LA 3263 平面划分

      Little Joey invented a scrabble machine that he called Euler, after the great mathematician. In his ...

    9. net8:XML的读写操作【广告控件的XML文件实例】

      原文发布时间为:2008-08-05 -- 来源于本人的百度文章 [由搬家工具导入] 【用了datalist控件,datalist控件自己学会,主要知道其他按钮COMMANDNAME属性应该改为edi ...

    10. msp430项目编程57

      msp430综合项目---扩展项目七57 1.电路工作原理 2.代码(显示部分) 3.代码(功能实现) 4.项目总结