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 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 the KEYMAP, used to implement sparse keymaps.
If not supplied default mechanism'll be used*/
Int (* setkeycode) (struct input_dev *dev, int scancode, int keycode);
/*optional method to retrieve current keymap. If not supplied default mechanism'll be used*/
Int (* getkeycode) (struct input_dev *dev, int scancode, int *keycode);
struct Ff_device * FF; Force feedback structure associated and 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 while 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 was called when the very was 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-carry out the "requested action" (turn on a LED, play sound, etc)
The call was 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 have 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 was 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 h As been registered with the input core must take the 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 are only called when the first user O Pens device and Dev->closeis called when the very last user closes the device */
unsigned int users;
int Going_away; Marks devices that is 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 input Subsystem (4) Intput_dev Interface description