1STRUCT INPUT_DEV(9) Input Subsystem STRUCT INPUT_DEV(9)
2
3
4
6 struct_input_dev - represents an input device
7
9 struct input_dev {
10 const char * name;
11 const char * phys;
12 const char * uniq;
13 struct input_id id;
14 unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
15 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
16 unsigned long relbit[BITS_TO_LONGS(REL_CNT)];
17 unsigned long absbit[BITS_TO_LONGS(ABS_CNT)];
18 unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)];
19 unsigned long ledbit[BITS_TO_LONGS(LED_CNT)];
20 unsigned long sndbit[BITS_TO_LONGS(SND_CNT)];
21 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
22 unsigned long swbit[BITS_TO_LONGS(SW_CNT)];
23 unsigned int keycodemax;
24 unsigned int keycodesize;
25 void * keycode;
26 int (* setkeycode) (struct input_dev *dev, int scancode, int keycode);
27 int (* getkeycode) (struct input_dev *dev, int scancode, int *keycode);
28 struct ff_device * ff;
29 unsigned int repeat_key;
30 struct timer_list timer;
31 int sync;
32 int abs[ABS_MAX + 1];
33 int rep[REP_MAX + 1];
34 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
35 unsigned long led[BITS_TO_LONGS(LED_CNT)];
36 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
37 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
38 int absmax[ABS_MAX + 1];
39 int absmin[ABS_MAX + 1];
40 int absfuzz[ABS_MAX + 1];
41 int absflat[ABS_MAX + 1];
42 int (* open) (struct input_dev *dev);
43 void (* close) (struct input_dev *dev);
44 int (* flush) (struct input_dev *dev, struct file *file);
45 int (* event) (struct input_dev *dev, unsigned int type, unsigned int code, int value);
46 struct input_handle * grab;
47 spinlock_t event_lock;
48 struct mutex mutex;
49 unsigned int users;
50 bool going_away;
51 struct device dev;
52 struct list_head h_list;
53 struct list_head node;
54 #ifndef __GENKSYMS__
55 unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)];
56 unsigned int hint_events_per_packet;
57 struct input_mt * mt;
58 #endif
59 };
60
62 name
63 name of the device
64
65 phys
66 physical path to the device in the system hierarchy
67
68 uniq
69 unique identification code for the device (if device has it)
70
71 id
72 id of the device (struct input_id)
73
74 evbit[BITS_TO_LONGS(EV_CNT)]
75 bitmap of types of events supported by the device (EV_KEY, EV_REL,
76 etc.)
77
78 keybit[BITS_TO_LONGS(KEY_CNT)]
79 bitmap of keys/buttons this device has
80
81 relbit[BITS_TO_LONGS(REL_CNT)]
82 bitmap of relative axes for the device
83
84 absbit[BITS_TO_LONGS(ABS_CNT)]
85 bitmap of absolute axes for the device
86
87 mscbit[BITS_TO_LONGS(MSC_CNT)]
88 bitmap of miscellaneous events supported by the device
89
90 ledbit[BITS_TO_LONGS(LED_CNT)]
91 bitmap of leds present on the device
92
93 sndbit[BITS_TO_LONGS(SND_CNT)]
94 bitmap of sound effects supported by the device
95
96 ffbit[BITS_TO_LONGS(FF_CNT)]
97 bitmap of force feedback effects supported by the device
98
99 swbit[BITS_TO_LONGS(SW_CNT)]
100 bitmap of switches present on the device
101
102 keycodemax
103 size of keycode table
104
105 keycodesize
106 size of elements in keycode table
107
108 keycode
109 map of scancodes to keycodes for this device
110
111 setkeycode
112 optional method to alter current keymap, used to implement sparse
113 keymaps. If not supplied default mechanism will be used
114
115 getkeycode
116 optional method to retrieve current keymap. If not supplied default
117 mechanism will be used
118
119 ff
120 force feedback structure associated with the device if device
121 supports force feedback effects
122
123 repeat_key
124 stores key code of the last key pressed; used to implement software
125 autorepeat
126
127 timer
128 timer for software autorepeat
129
130 sync
131 set to 1 when there were no new events since last EV_SYNC
132
133 abs[ABS_MAX + 1]
134 current values for reports from absolute axes
135
136 rep[REP_MAX + 1]
137 current values for autorepeat parameters (delay, rate)
138
139 key[BITS_TO_LONGS(KEY_CNT)]
140 reflects current state of device´s keys/buttons
141
142 led[BITS_TO_LONGS(LED_CNT)]
143 reflects current state of device´s LEDs
144
145 snd[BITS_TO_LONGS(SND_CNT)]
146 reflects current state of sound effects
147
148 sw[BITS_TO_LONGS(SW_CNT)]
149 reflects current state of device´s switches
150
151 absmax[ABS_MAX + 1]
152 maximum values for events coming from absolute axes
153
154 absmin[ABS_MAX + 1]
155 minimum values for events coming from absolute axes
156
157 absfuzz[ABS_MAX + 1]
158 describes noisiness for axes
159
160 absflat[ABS_MAX + 1]
161 size of the center flat position (used by joydev)
162
163 open
164 this method is called when the very first user calls
165 input_open_device. The driver must prepare the device to start
166 generating events (start polling thread, request an IRQ, submit
167 URB, etc.)
168
169 close
170 this method is called when the very last user calls
171 input_close_device.
172
173 flush
174 purges the device. Most commonly used to get rid of force feedback
175 effects loaded into the device when disconnecting from it
176
177 event
178 event handler for events sent _to_ the device, like EV_LED or
179 EV_SND. The device is expected to carry out the requested action
180 (turn on a LED, play sound, etc.) The call is protected by
181 event_lock and must not sleep
182
183 grab
184 input handle that currently has the device grabbed (via EVIOCGRAB
185 ioctl). When a handle grabs a device it becomes sole recipient for
186 all input events coming from the device
187
188 event_lock
189 this spinlock is is taken when input core receives and processes a
190 new event for the device (in input_event). Code that accesses
191 and/or modifies parameters of a device (such as keymap or absmin,
192 absmax, absfuzz, etc.) after device has been registered with input
193 core must take this lock.
194
195 mutex
196 serializes calls to open, close and flush methods
197
198 users
199 stores number of users (input handlers) that opened this device. It
200 is used by input_open_device and input_close_device to make sure
201 that dev->open is only called when the first user opens device and
202 dev->close is called when the very last user closes the device
203
204 going_away
205 marks devices that are in a middle of unregistering and causes
206 input_open_device*() fail with -ENODEV.
207
208 dev
209 driver model´s view of this device
210
211 h_list
212 list of input handles associated with the device. When accessing
213 the list dev->mutex must be held
214
215 node
216 used to place the device onto input_dev_list
217
218 propbit[BITS_TO_LONGS(INPUT_PROP_CNT)]
219 bitmap of device properties and quirks
220
221 hint_events_per_packet
222 average number of events generated by the device in a packet
223 (between EV_SYN/SYN_REPORT events). Used by event handlers to
224 estimate size of the buffer needed to hold events.
225
226 mt
227 pointer to multitouch state
228
230Kernel Hackers Manual 2.6. June 2019 STRUCT INPUT_DEV(9)