'\" t .\" Title: struct input_dev .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: January 2017 .\" Manual: Input Subsystem .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "STRUCT INPUT_DEV" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Input Subsystem" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" struct_input_dev \- represents an input device .SH "SYNOPSIS" .sp .nf struct input_dev { const char * name; const char * phys; const char * uniq; struct input_id id; unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)]; unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; unsigned long absbit[BITS_TO_LONGS(ABS_CNT)]; unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)]; unsigned long ledbit[BITS_TO_LONGS(LED_CNT)]; unsigned long sndbit[BITS_TO_LONGS(SND_CNT)]; unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; unsigned int hint_events_per_packet; unsigned int keycodemax; unsigned int keycodesize; void * keycode; int (* setkeycode) (struct input_dev *dev,const struct input_keymap_entry *ke,unsigned int *old_keycode); int (* getkeycode) (struct input_dev *dev,struct input_keymap_entry *ke); struct ff_device * ff; unsigned int repeat_key; struct timer_list timer; int rep[REP_CNT]; struct input_mt * mt; struct input_absinfo * absinfo; unsigned long key[BITS_TO_LONGS(KEY_CNT)]; unsigned long led[BITS_TO_LONGS(LED_CNT)]; unsigned long snd[BITS_TO_LONGS(SND_CNT)]; unsigned long sw[BITS_TO_LONGS(SW_CNT)]; int (* open) (struct input_dev *dev); void (* close) (struct input_dev *dev); int (* flush) (struct input_dev *dev, struct file *file); int (* event) (struct input_dev *dev, unsigned int type, unsigned int code, int value); struct input_handle __rcu * grab; spinlock_t event_lock; struct mutex mutex; unsigned int users; bool going_away; struct device dev; struct list_head h_list; struct list_head node; unsigned int num_vals; unsigned int max_vals; struct input_value * vals; bool devres_managed; }; .fi .SH "MEMBERS" .PP name .RS 4 name of the device .RE .PP phys .RS 4 physical path to the device in the system hierarchy .RE .PP uniq .RS 4 unique identification code for the device (if device has it) .RE .PP id .RS 4 id of the device (struct input_id) .RE .PP propbit[BITS_TO_LONGS(INPUT_PROP_CNT)] .RS 4 bitmap of device properties and quirks .RE .PP evbit[BITS_TO_LONGS(EV_CNT)] .RS 4 bitmap of types of events supported by the device (EV_KEY, EV_REL, etc\&.) .RE .PP keybit[BITS_TO_LONGS(KEY_CNT)] .RS 4 bitmap of keys/buttons this device has .RE .PP relbit[BITS_TO_LONGS(REL_CNT)] .RS 4 bitmap of relative axes for the device .RE .PP absbit[BITS_TO_LONGS(ABS_CNT)] .RS 4 bitmap of absolute axes for the device .RE .PP mscbit[BITS_TO_LONGS(MSC_CNT)] .RS 4 bitmap of miscellaneous events supported by the device .RE .PP ledbit[BITS_TO_LONGS(LED_CNT)] .RS 4 bitmap of leds present on the device .RE .PP sndbit[BITS_TO_LONGS(SND_CNT)] .RS 4 bitmap of sound effects supported by the device .RE .PP ffbit[BITS_TO_LONGS(FF_CNT)] .RS 4 bitmap of force feedback effects supported by the device .RE .PP swbit[BITS_TO_LONGS(SW_CNT)] .RS 4 bitmap of switches present on the device .RE .PP hint_events_per_packet .RS 4 average number of events generated by the device in a packet (between EV_SYN/SYN_REPORT events)\&. Used by event handlers to estimate size of the buffer needed to hold events\&. .RE .PP keycodemax .RS 4 size of keycode table .RE .PP keycodesize .RS 4 size of elements in keycode table .RE .PP keycode .RS 4 map of scancodes to keycodes for this device .RE .PP setkeycode .RS 4 optional method to alter current keymap, used to implement sparse keymaps\&. If not supplied default mechanism will be used\&. The method is being called while holding event_lock and thus must not sleep .RE .PP getkeycode .RS 4 optional legacy method to retrieve current keymap\&. .RE .PP ff .RS 4 force feedback structure associated with the device if device supports force feedback effects .RE .PP repeat_key .RS 4 stores key code of the last key pressed; used to implement software autorepeat .RE .PP timer .RS 4 timer for software autorepeat .RE .PP rep[REP_CNT] .RS 4 current values for autorepeat parameters (delay, rate) .RE .PP mt .RS 4 pointer to multitouch state .RE .PP absinfo .RS 4 array of struct input_absinfo elements holding information about absolute axes (current value, min, max, flat, fuzz, resolution) .RE .PP key[BITS_TO_LONGS(KEY_CNT)] .RS 4 reflects current state of device\*(Aqs keys/buttons .RE .PP led[BITS_TO_LONGS(LED_CNT)] .RS 4 reflects current state of device\*(Aqs LEDs .RE .PP snd[BITS_TO_LONGS(SND_CNT)] .RS 4 reflects current state of sound effects .RE .PP sw[BITS_TO_LONGS(SW_CNT)] .RS 4 reflects current state of device\*(Aqs switches .RE .PP open .RS 4 this method is called when the very first user calls \fBinput_open_device\fR\&. The driver must prepare the device to start generating events (start polling thread, request an IRQ, submit URB, etc\&.) .RE .PP close .RS 4 this method is called when the very last user calls \fBinput_close_device\fR\&. .RE .PP flush .RS 4 purges the device\&. Most commonly used to get rid of force feedback effects loaded into the device when disconnecting from it .RE .PP event .RS 4 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 \fIevent_lock\fR and must not sleep .RE .PP grab .RS 4 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 .RE .PP event_lock .RS 4 this spinlock is taken when input core receives and processes a new event for the device (in \fBinput_event\fR)\&. 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\&. .RE .PP mutex .RS 4 serializes calls to \fBopen\fR, \fBclose\fR and \fBflush\fR methods .RE .PP users .RS 4 stores number of users (input handlers) that opened this device\&. It is used by \fBinput_open_device\fR and \fBinput_close_device\fR to make sure that dev\->\fBopen\fR is only called when the first user opens device and dev\->\fBclose\fR is called when the very last user closes the device .RE .PP going_away .RS 4 marks devices that are in a middle of unregistering and causes input_open_device*() fail with \-ENODEV\&. .RE .PP dev .RS 4 driver model\*(Aqs view of this device .RE .PP h_list .RS 4 list of input handles associated with the device\&. When accessing the list dev\->mutex must be held .RE .PP node .RS 4 used to place the device onto input_dev_list .RE .PP num_vals .RS 4 number of values queued in the current frame .RE .PP max_vals .RS 4 maximum number of values queued in a frame .RE .PP vals .RS 4 array of values queued in the current frame .RE .PP devres_managed .RS 4 indicates that devices is managed with devres framework and needs not be explicitly unregistered or freed\&. .RE .SH "COPYRIGHT" .br