Commit 50a88cb7eddb971077ae7dff76b116747c12c371

Authored by Jekyll Lai
Committed by Dmitry Torokhov
1 parent e1336bff92

Input: add SW_ROTATE_LOCK switch type

This switch is used to signal that user want to disable screen
transitions from portrait to landscape mode and back.

Signed-off-by: Jekyll Lai <jekyll_lai@wistron.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Showing 1 changed file with 1 additions and 0 deletions Inline Diff

include/linux/input.h
1 #ifndef _INPUT_H 1 #ifndef _INPUT_H
2 #define _INPUT_H 2 #define _INPUT_H
3 3
4 /* 4 /*
5 * Copyright (c) 1999-2002 Vojtech Pavlik 5 * Copyright (c) 1999-2002 Vojtech Pavlik
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by 8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11 11
12 #ifdef __KERNEL__ 12 #ifdef __KERNEL__
13 #include <linux/time.h> 13 #include <linux/time.h>
14 #include <linux/list.h> 14 #include <linux/list.h>
15 #else 15 #else
16 #include <sys/time.h> 16 #include <sys/time.h>
17 #include <sys/ioctl.h> 17 #include <sys/ioctl.h>
18 #include <sys/types.h> 18 #include <sys/types.h>
19 #include <linux/types.h> 19 #include <linux/types.h>
20 #endif 20 #endif
21 21
22 /* 22 /*
23 * The event structure itself 23 * The event structure itself
24 */ 24 */
25 25
26 struct input_event { 26 struct input_event {
27 struct timeval time; 27 struct timeval time;
28 __u16 type; 28 __u16 type;
29 __u16 code; 29 __u16 code;
30 __s32 value; 30 __s32 value;
31 }; 31 };
32 32
33 /* 33 /*
34 * Protocol version. 34 * Protocol version.
35 */ 35 */
36 36
37 #define EV_VERSION 0x010001 37 #define EV_VERSION 0x010001
38 38
39 /* 39 /*
40 * IOCTLs (0x00 - 0x7f) 40 * IOCTLs (0x00 - 0x7f)
41 */ 41 */
42 42
43 struct input_id { 43 struct input_id {
44 __u16 bustype; 44 __u16 bustype;
45 __u16 vendor; 45 __u16 vendor;
46 __u16 product; 46 __u16 product;
47 __u16 version; 47 __u16 version;
48 }; 48 };
49 49
50 struct input_absinfo { 50 struct input_absinfo {
51 __s32 value; 51 __s32 value;
52 __s32 minimum; 52 __s32 minimum;
53 __s32 maximum; 53 __s32 maximum;
54 __s32 fuzz; 54 __s32 fuzz;
55 __s32 flat; 55 __s32 flat;
56 __s32 resolution; 56 __s32 resolution;
57 }; 57 };
58 58
59 /** 59 /**
60 * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls 60 * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls
61 * @scancode: scancode represented in machine-endian form. 61 * @scancode: scancode represented in machine-endian form.
62 * @len: length of the scancode that resides in @scancode buffer. 62 * @len: length of the scancode that resides in @scancode buffer.
63 * @index: index in the keymap, may be used instead of scancode 63 * @index: index in the keymap, may be used instead of scancode
64 * @flags: allows to specify how kernel should handle the request. For 64 * @flags: allows to specify how kernel should handle the request. For
65 * example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel 65 * example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel
66 * should perform lookup in keymap by @index instead of @scancode 66 * should perform lookup in keymap by @index instead of @scancode
67 * @keycode: key code assigned to this scancode 67 * @keycode: key code assigned to this scancode
68 * 68 *
69 * The structure is used to retrieve and modify keymap data. Users have 69 * The structure is used to retrieve and modify keymap data. Users have
70 * option of performing lookup either by @scancode itself or by @index 70 * option of performing lookup either by @scancode itself or by @index
71 * in keymap entry. EVIOCGKEYCODE will also return scancode or index 71 * in keymap entry. EVIOCGKEYCODE will also return scancode or index
72 * (depending on which element was used to perform lookup). 72 * (depending on which element was used to perform lookup).
73 */ 73 */
74 struct input_keymap_entry { 74 struct input_keymap_entry {
75 #define INPUT_KEYMAP_BY_INDEX (1 << 0) 75 #define INPUT_KEYMAP_BY_INDEX (1 << 0)
76 __u8 flags; 76 __u8 flags;
77 __u8 len; 77 __u8 len;
78 __u16 index; 78 __u16 index;
79 __u32 keycode; 79 __u32 keycode;
80 __u8 scancode[32]; 80 __u8 scancode[32];
81 }; 81 };
82 82
83 #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ 83 #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
84 #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ 84 #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
85 #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ 85 #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
86 #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ 86 #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
87 87
88 #define EVIOCGKEYCODE _IOR('E', 0x04, struct input_keymap_entry) /* get keycode */ 88 #define EVIOCGKEYCODE _IOR('E', 0x04, struct input_keymap_entry) /* get keycode */
89 #define EVIOCSKEYCODE _IOW('E', 0x04, struct input_keymap_entry) /* set keycode */ 89 #define EVIOCSKEYCODE _IOW('E', 0x04, struct input_keymap_entry) /* set keycode */
90 90
91 #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ 91 #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
92 #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ 92 #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
93 #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ 93 #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
94 #define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ 94 #define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */
95 95
96 #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ 96 #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */
97 #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ 97 #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
98 #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ 98 #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
99 #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */ 99 #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
100 100
101 #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ 101 #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */
102 #define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */ 102 #define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */
103 #define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */ 103 #define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */
104 104
105 #define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */ 105 #define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */
106 #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ 106 #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */
107 #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ 107 #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */
108 108
109 #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 109 #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
110 110
111 /* 111 /*
112 * Device properties and quirks 112 * Device properties and quirks
113 */ 113 */
114 114
115 #define INPUT_PROP_POINTER 0x00 /* needs a pointer */ 115 #define INPUT_PROP_POINTER 0x00 /* needs a pointer */
116 #define INPUT_PROP_DIRECT 0x01 /* direct input devices */ 116 #define INPUT_PROP_DIRECT 0x01 /* direct input devices */
117 #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ 117 #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
118 #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ 118 #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
119 119
120 #define INPUT_PROP_MAX 0x1f 120 #define INPUT_PROP_MAX 0x1f
121 #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) 121 #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
122 122
123 /* 123 /*
124 * Event types 124 * Event types
125 */ 125 */
126 126
127 #define EV_SYN 0x00 127 #define EV_SYN 0x00
128 #define EV_KEY 0x01 128 #define EV_KEY 0x01
129 #define EV_REL 0x02 129 #define EV_REL 0x02
130 #define EV_ABS 0x03 130 #define EV_ABS 0x03
131 #define EV_MSC 0x04 131 #define EV_MSC 0x04
132 #define EV_SW 0x05 132 #define EV_SW 0x05
133 #define EV_LED 0x11 133 #define EV_LED 0x11
134 #define EV_SND 0x12 134 #define EV_SND 0x12
135 #define EV_REP 0x14 135 #define EV_REP 0x14
136 #define EV_FF 0x15 136 #define EV_FF 0x15
137 #define EV_PWR 0x16 137 #define EV_PWR 0x16
138 #define EV_FF_STATUS 0x17 138 #define EV_FF_STATUS 0x17
139 #define EV_MAX 0x1f 139 #define EV_MAX 0x1f
140 #define EV_CNT (EV_MAX+1) 140 #define EV_CNT (EV_MAX+1)
141 141
142 /* 142 /*
143 * Synchronization events. 143 * Synchronization events.
144 */ 144 */
145 145
146 #define SYN_REPORT 0 146 #define SYN_REPORT 0
147 #define SYN_CONFIG 1 147 #define SYN_CONFIG 1
148 #define SYN_MT_REPORT 2 148 #define SYN_MT_REPORT 2
149 149
150 /* 150 /*
151 * Keys and buttons 151 * Keys and buttons
152 * 152 *
153 * Most of the keys/buttons are modeled after USB HUT 1.12 153 * Most of the keys/buttons are modeled after USB HUT 1.12
154 * (see http://www.usb.org/developers/hidpage). 154 * (see http://www.usb.org/developers/hidpage).
155 * Abbreviations in the comments: 155 * Abbreviations in the comments:
156 * AC - Application Control 156 * AC - Application Control
157 * AL - Application Launch Button 157 * AL - Application Launch Button
158 * SC - System Control 158 * SC - System Control
159 */ 159 */
160 160
161 #define KEY_RESERVED 0 161 #define KEY_RESERVED 0
162 #define KEY_ESC 1 162 #define KEY_ESC 1
163 #define KEY_1 2 163 #define KEY_1 2
164 #define KEY_2 3 164 #define KEY_2 3
165 #define KEY_3 4 165 #define KEY_3 4
166 #define KEY_4 5 166 #define KEY_4 5
167 #define KEY_5 6 167 #define KEY_5 6
168 #define KEY_6 7 168 #define KEY_6 7
169 #define KEY_7 8 169 #define KEY_7 8
170 #define KEY_8 9 170 #define KEY_8 9
171 #define KEY_9 10 171 #define KEY_9 10
172 #define KEY_0 11 172 #define KEY_0 11
173 #define KEY_MINUS 12 173 #define KEY_MINUS 12
174 #define KEY_EQUAL 13 174 #define KEY_EQUAL 13
175 #define KEY_BACKSPACE 14 175 #define KEY_BACKSPACE 14
176 #define KEY_TAB 15 176 #define KEY_TAB 15
177 #define KEY_Q 16 177 #define KEY_Q 16
178 #define KEY_W 17 178 #define KEY_W 17
179 #define KEY_E 18 179 #define KEY_E 18
180 #define KEY_R 19 180 #define KEY_R 19
181 #define KEY_T 20 181 #define KEY_T 20
182 #define KEY_Y 21 182 #define KEY_Y 21
183 #define KEY_U 22 183 #define KEY_U 22
184 #define KEY_I 23 184 #define KEY_I 23
185 #define KEY_O 24 185 #define KEY_O 24
186 #define KEY_P 25 186 #define KEY_P 25
187 #define KEY_LEFTBRACE 26 187 #define KEY_LEFTBRACE 26
188 #define KEY_RIGHTBRACE 27 188 #define KEY_RIGHTBRACE 27
189 #define KEY_ENTER 28 189 #define KEY_ENTER 28
190 #define KEY_LEFTCTRL 29 190 #define KEY_LEFTCTRL 29
191 #define KEY_A 30 191 #define KEY_A 30
192 #define KEY_S 31 192 #define KEY_S 31
193 #define KEY_D 32 193 #define KEY_D 32
194 #define KEY_F 33 194 #define KEY_F 33
195 #define KEY_G 34 195 #define KEY_G 34
196 #define KEY_H 35 196 #define KEY_H 35
197 #define KEY_J 36 197 #define KEY_J 36
198 #define KEY_K 37 198 #define KEY_K 37
199 #define KEY_L 38 199 #define KEY_L 38
200 #define KEY_SEMICOLON 39 200 #define KEY_SEMICOLON 39
201 #define KEY_APOSTROPHE 40 201 #define KEY_APOSTROPHE 40
202 #define KEY_GRAVE 41 202 #define KEY_GRAVE 41
203 #define KEY_LEFTSHIFT 42 203 #define KEY_LEFTSHIFT 42
204 #define KEY_BACKSLASH 43 204 #define KEY_BACKSLASH 43
205 #define KEY_Z 44 205 #define KEY_Z 44
206 #define KEY_X 45 206 #define KEY_X 45
207 #define KEY_C 46 207 #define KEY_C 46
208 #define KEY_V 47 208 #define KEY_V 47
209 #define KEY_B 48 209 #define KEY_B 48
210 #define KEY_N 49 210 #define KEY_N 49
211 #define KEY_M 50 211 #define KEY_M 50
212 #define KEY_COMMA 51 212 #define KEY_COMMA 51
213 #define KEY_DOT 52 213 #define KEY_DOT 52
214 #define KEY_SLASH 53 214 #define KEY_SLASH 53
215 #define KEY_RIGHTSHIFT 54 215 #define KEY_RIGHTSHIFT 54
216 #define KEY_KPASTERISK 55 216 #define KEY_KPASTERISK 55
217 #define KEY_LEFTALT 56 217 #define KEY_LEFTALT 56
218 #define KEY_SPACE 57 218 #define KEY_SPACE 57
219 #define KEY_CAPSLOCK 58 219 #define KEY_CAPSLOCK 58
220 #define KEY_F1 59 220 #define KEY_F1 59
221 #define KEY_F2 60 221 #define KEY_F2 60
222 #define KEY_F3 61 222 #define KEY_F3 61
223 #define KEY_F4 62 223 #define KEY_F4 62
224 #define KEY_F5 63 224 #define KEY_F5 63
225 #define KEY_F6 64 225 #define KEY_F6 64
226 #define KEY_F7 65 226 #define KEY_F7 65
227 #define KEY_F8 66 227 #define KEY_F8 66
228 #define KEY_F9 67 228 #define KEY_F9 67
229 #define KEY_F10 68 229 #define KEY_F10 68
230 #define KEY_NUMLOCK 69 230 #define KEY_NUMLOCK 69
231 #define KEY_SCROLLLOCK 70 231 #define KEY_SCROLLLOCK 70
232 #define KEY_KP7 71 232 #define KEY_KP7 71
233 #define KEY_KP8 72 233 #define KEY_KP8 72
234 #define KEY_KP9 73 234 #define KEY_KP9 73
235 #define KEY_KPMINUS 74 235 #define KEY_KPMINUS 74
236 #define KEY_KP4 75 236 #define KEY_KP4 75
237 #define KEY_KP5 76 237 #define KEY_KP5 76
238 #define KEY_KP6 77 238 #define KEY_KP6 77
239 #define KEY_KPPLUS 78 239 #define KEY_KPPLUS 78
240 #define KEY_KP1 79 240 #define KEY_KP1 79
241 #define KEY_KP2 80 241 #define KEY_KP2 80
242 #define KEY_KP3 81 242 #define KEY_KP3 81
243 #define KEY_KP0 82 243 #define KEY_KP0 82
244 #define KEY_KPDOT 83 244 #define KEY_KPDOT 83
245 245
246 #define KEY_ZENKAKUHANKAKU 85 246 #define KEY_ZENKAKUHANKAKU 85
247 #define KEY_102ND 86 247 #define KEY_102ND 86
248 #define KEY_F11 87 248 #define KEY_F11 87
249 #define KEY_F12 88 249 #define KEY_F12 88
250 #define KEY_RO 89 250 #define KEY_RO 89
251 #define KEY_KATAKANA 90 251 #define KEY_KATAKANA 90
252 #define KEY_HIRAGANA 91 252 #define KEY_HIRAGANA 91
253 #define KEY_HENKAN 92 253 #define KEY_HENKAN 92
254 #define KEY_KATAKANAHIRAGANA 93 254 #define KEY_KATAKANAHIRAGANA 93
255 #define KEY_MUHENKAN 94 255 #define KEY_MUHENKAN 94
256 #define KEY_KPJPCOMMA 95 256 #define KEY_KPJPCOMMA 95
257 #define KEY_KPENTER 96 257 #define KEY_KPENTER 96
258 #define KEY_RIGHTCTRL 97 258 #define KEY_RIGHTCTRL 97
259 #define KEY_KPSLASH 98 259 #define KEY_KPSLASH 98
260 #define KEY_SYSRQ 99 260 #define KEY_SYSRQ 99
261 #define KEY_RIGHTALT 100 261 #define KEY_RIGHTALT 100
262 #define KEY_LINEFEED 101 262 #define KEY_LINEFEED 101
263 #define KEY_HOME 102 263 #define KEY_HOME 102
264 #define KEY_UP 103 264 #define KEY_UP 103
265 #define KEY_PAGEUP 104 265 #define KEY_PAGEUP 104
266 #define KEY_LEFT 105 266 #define KEY_LEFT 105
267 #define KEY_RIGHT 106 267 #define KEY_RIGHT 106
268 #define KEY_END 107 268 #define KEY_END 107
269 #define KEY_DOWN 108 269 #define KEY_DOWN 108
270 #define KEY_PAGEDOWN 109 270 #define KEY_PAGEDOWN 109
271 #define KEY_INSERT 110 271 #define KEY_INSERT 110
272 #define KEY_DELETE 111 272 #define KEY_DELETE 111
273 #define KEY_MACRO 112 273 #define KEY_MACRO 112
274 #define KEY_MUTE 113 274 #define KEY_MUTE 113
275 #define KEY_VOLUMEDOWN 114 275 #define KEY_VOLUMEDOWN 114
276 #define KEY_VOLUMEUP 115 276 #define KEY_VOLUMEUP 115
277 #define KEY_POWER 116 /* SC System Power Down */ 277 #define KEY_POWER 116 /* SC System Power Down */
278 #define KEY_KPEQUAL 117 278 #define KEY_KPEQUAL 117
279 #define KEY_KPPLUSMINUS 118 279 #define KEY_KPPLUSMINUS 118
280 #define KEY_PAUSE 119 280 #define KEY_PAUSE 119
281 #define KEY_SCALE 120 /* AL Compiz Scale (Expose) */ 281 #define KEY_SCALE 120 /* AL Compiz Scale (Expose) */
282 282
283 #define KEY_KPCOMMA 121 283 #define KEY_KPCOMMA 121
284 #define KEY_HANGEUL 122 284 #define KEY_HANGEUL 122
285 #define KEY_HANGUEL KEY_HANGEUL 285 #define KEY_HANGUEL KEY_HANGEUL
286 #define KEY_HANJA 123 286 #define KEY_HANJA 123
287 #define KEY_YEN 124 287 #define KEY_YEN 124
288 #define KEY_LEFTMETA 125 288 #define KEY_LEFTMETA 125
289 #define KEY_RIGHTMETA 126 289 #define KEY_RIGHTMETA 126
290 #define KEY_COMPOSE 127 290 #define KEY_COMPOSE 127
291 291
292 #define KEY_STOP 128 /* AC Stop */ 292 #define KEY_STOP 128 /* AC Stop */
293 #define KEY_AGAIN 129 293 #define KEY_AGAIN 129
294 #define KEY_PROPS 130 /* AC Properties */ 294 #define KEY_PROPS 130 /* AC Properties */
295 #define KEY_UNDO 131 /* AC Undo */ 295 #define KEY_UNDO 131 /* AC Undo */
296 #define KEY_FRONT 132 296 #define KEY_FRONT 132
297 #define KEY_COPY 133 /* AC Copy */ 297 #define KEY_COPY 133 /* AC Copy */
298 #define KEY_OPEN 134 /* AC Open */ 298 #define KEY_OPEN 134 /* AC Open */
299 #define KEY_PASTE 135 /* AC Paste */ 299 #define KEY_PASTE 135 /* AC Paste */
300 #define KEY_FIND 136 /* AC Search */ 300 #define KEY_FIND 136 /* AC Search */
301 #define KEY_CUT 137 /* AC Cut */ 301 #define KEY_CUT 137 /* AC Cut */
302 #define KEY_HELP 138 /* AL Integrated Help Center */ 302 #define KEY_HELP 138 /* AL Integrated Help Center */
303 #define KEY_MENU 139 /* Menu (show menu) */ 303 #define KEY_MENU 139 /* Menu (show menu) */
304 #define KEY_CALC 140 /* AL Calculator */ 304 #define KEY_CALC 140 /* AL Calculator */
305 #define KEY_SETUP 141 305 #define KEY_SETUP 141
306 #define KEY_SLEEP 142 /* SC System Sleep */ 306 #define KEY_SLEEP 142 /* SC System Sleep */
307 #define KEY_WAKEUP 143 /* System Wake Up */ 307 #define KEY_WAKEUP 143 /* System Wake Up */
308 #define KEY_FILE 144 /* AL Local Machine Browser */ 308 #define KEY_FILE 144 /* AL Local Machine Browser */
309 #define KEY_SENDFILE 145 309 #define KEY_SENDFILE 145
310 #define KEY_DELETEFILE 146 310 #define KEY_DELETEFILE 146
311 #define KEY_XFER 147 311 #define KEY_XFER 147
312 #define KEY_PROG1 148 312 #define KEY_PROG1 148
313 #define KEY_PROG2 149 313 #define KEY_PROG2 149
314 #define KEY_WWW 150 /* AL Internet Browser */ 314 #define KEY_WWW 150 /* AL Internet Browser */
315 #define KEY_MSDOS 151 315 #define KEY_MSDOS 151
316 #define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ 316 #define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
317 #define KEY_SCREENLOCK KEY_COFFEE 317 #define KEY_SCREENLOCK KEY_COFFEE
318 #define KEY_DIRECTION 153 318 #define KEY_DIRECTION 153
319 #define KEY_CYCLEWINDOWS 154 319 #define KEY_CYCLEWINDOWS 154
320 #define KEY_MAIL 155 320 #define KEY_MAIL 155
321 #define KEY_BOOKMARKS 156 /* AC Bookmarks */ 321 #define KEY_BOOKMARKS 156 /* AC Bookmarks */
322 #define KEY_COMPUTER 157 322 #define KEY_COMPUTER 157
323 #define KEY_BACK 158 /* AC Back */ 323 #define KEY_BACK 158 /* AC Back */
324 #define KEY_FORWARD 159 /* AC Forward */ 324 #define KEY_FORWARD 159 /* AC Forward */
325 #define KEY_CLOSECD 160 325 #define KEY_CLOSECD 160
326 #define KEY_EJECTCD 161 326 #define KEY_EJECTCD 161
327 #define KEY_EJECTCLOSECD 162 327 #define KEY_EJECTCLOSECD 162
328 #define KEY_NEXTSONG 163 328 #define KEY_NEXTSONG 163
329 #define KEY_PLAYPAUSE 164 329 #define KEY_PLAYPAUSE 164
330 #define KEY_PREVIOUSSONG 165 330 #define KEY_PREVIOUSSONG 165
331 #define KEY_STOPCD 166 331 #define KEY_STOPCD 166
332 #define KEY_RECORD 167 332 #define KEY_RECORD 167
333 #define KEY_REWIND 168 333 #define KEY_REWIND 168
334 #define KEY_PHONE 169 /* Media Select Telephone */ 334 #define KEY_PHONE 169 /* Media Select Telephone */
335 #define KEY_ISO 170 335 #define KEY_ISO 170
336 #define KEY_CONFIG 171 /* AL Consumer Control Configuration */ 336 #define KEY_CONFIG 171 /* AL Consumer Control Configuration */
337 #define KEY_HOMEPAGE 172 /* AC Home */ 337 #define KEY_HOMEPAGE 172 /* AC Home */
338 #define KEY_REFRESH 173 /* AC Refresh */ 338 #define KEY_REFRESH 173 /* AC Refresh */
339 #define KEY_EXIT 174 /* AC Exit */ 339 #define KEY_EXIT 174 /* AC Exit */
340 #define KEY_MOVE 175 340 #define KEY_MOVE 175
341 #define KEY_EDIT 176 341 #define KEY_EDIT 176
342 #define KEY_SCROLLUP 177 342 #define KEY_SCROLLUP 177
343 #define KEY_SCROLLDOWN 178 343 #define KEY_SCROLLDOWN 178
344 #define KEY_KPLEFTPAREN 179 344 #define KEY_KPLEFTPAREN 179
345 #define KEY_KPRIGHTPAREN 180 345 #define KEY_KPRIGHTPAREN 180
346 #define KEY_NEW 181 /* AC New */ 346 #define KEY_NEW 181 /* AC New */
347 #define KEY_REDO 182 /* AC Redo/Repeat */ 347 #define KEY_REDO 182 /* AC Redo/Repeat */
348 348
349 #define KEY_F13 183 349 #define KEY_F13 183
350 #define KEY_F14 184 350 #define KEY_F14 184
351 #define KEY_F15 185 351 #define KEY_F15 185
352 #define KEY_F16 186 352 #define KEY_F16 186
353 #define KEY_F17 187 353 #define KEY_F17 187
354 #define KEY_F18 188 354 #define KEY_F18 188
355 #define KEY_F19 189 355 #define KEY_F19 189
356 #define KEY_F20 190 356 #define KEY_F20 190
357 #define KEY_F21 191 357 #define KEY_F21 191
358 #define KEY_F22 192 358 #define KEY_F22 192
359 #define KEY_F23 193 359 #define KEY_F23 193
360 #define KEY_F24 194 360 #define KEY_F24 194
361 361
362 #define KEY_PLAYCD 200 362 #define KEY_PLAYCD 200
363 #define KEY_PAUSECD 201 363 #define KEY_PAUSECD 201
364 #define KEY_PROG3 202 364 #define KEY_PROG3 202
365 #define KEY_PROG4 203 365 #define KEY_PROG4 203
366 #define KEY_DASHBOARD 204 /* AL Dashboard */ 366 #define KEY_DASHBOARD 204 /* AL Dashboard */
367 #define KEY_SUSPEND 205 367 #define KEY_SUSPEND 205
368 #define KEY_CLOSE 206 /* AC Close */ 368 #define KEY_CLOSE 206 /* AC Close */
369 #define KEY_PLAY 207 369 #define KEY_PLAY 207
370 #define KEY_FASTFORWARD 208 370 #define KEY_FASTFORWARD 208
371 #define KEY_BASSBOOST 209 371 #define KEY_BASSBOOST 209
372 #define KEY_PRINT 210 /* AC Print */ 372 #define KEY_PRINT 210 /* AC Print */
373 #define KEY_HP 211 373 #define KEY_HP 211
374 #define KEY_CAMERA 212 374 #define KEY_CAMERA 212
375 #define KEY_SOUND 213 375 #define KEY_SOUND 213
376 #define KEY_QUESTION 214 376 #define KEY_QUESTION 214
377 #define KEY_EMAIL 215 377 #define KEY_EMAIL 215
378 #define KEY_CHAT 216 378 #define KEY_CHAT 216
379 #define KEY_SEARCH 217 379 #define KEY_SEARCH 217
380 #define KEY_CONNECT 218 380 #define KEY_CONNECT 218
381 #define KEY_FINANCE 219 /* AL Checkbook/Finance */ 381 #define KEY_FINANCE 219 /* AL Checkbook/Finance */
382 #define KEY_SPORT 220 382 #define KEY_SPORT 220
383 #define KEY_SHOP 221 383 #define KEY_SHOP 221
384 #define KEY_ALTERASE 222 384 #define KEY_ALTERASE 222
385 #define KEY_CANCEL 223 /* AC Cancel */ 385 #define KEY_CANCEL 223 /* AC Cancel */
386 #define KEY_BRIGHTNESSDOWN 224 386 #define KEY_BRIGHTNESSDOWN 224
387 #define KEY_BRIGHTNESSUP 225 387 #define KEY_BRIGHTNESSUP 225
388 #define KEY_MEDIA 226 388 #define KEY_MEDIA 226
389 389
390 #define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video 390 #define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
391 outputs (Monitor/LCD/TV-out/etc) */ 391 outputs (Monitor/LCD/TV-out/etc) */
392 #define KEY_KBDILLUMTOGGLE 228 392 #define KEY_KBDILLUMTOGGLE 228
393 #define KEY_KBDILLUMDOWN 229 393 #define KEY_KBDILLUMDOWN 229
394 #define KEY_KBDILLUMUP 230 394 #define KEY_KBDILLUMUP 230
395 395
396 #define KEY_SEND 231 /* AC Send */ 396 #define KEY_SEND 231 /* AC Send */
397 #define KEY_REPLY 232 /* AC Reply */ 397 #define KEY_REPLY 232 /* AC Reply */
398 #define KEY_FORWARDMAIL 233 /* AC Forward Msg */ 398 #define KEY_FORWARDMAIL 233 /* AC Forward Msg */
399 #define KEY_SAVE 234 /* AC Save */ 399 #define KEY_SAVE 234 /* AC Save */
400 #define KEY_DOCUMENTS 235 400 #define KEY_DOCUMENTS 235
401 401
402 #define KEY_BATTERY 236 402 #define KEY_BATTERY 236
403 403
404 #define KEY_BLUETOOTH 237 404 #define KEY_BLUETOOTH 237
405 #define KEY_WLAN 238 405 #define KEY_WLAN 238
406 #define KEY_UWB 239 406 #define KEY_UWB 239
407 407
408 #define KEY_UNKNOWN 240 408 #define KEY_UNKNOWN 240
409 409
410 #define KEY_VIDEO_NEXT 241 /* drive next video source */ 410 #define KEY_VIDEO_NEXT 241 /* drive next video source */
411 #define KEY_VIDEO_PREV 242 /* drive previous video source */ 411 #define KEY_VIDEO_PREV 242 /* drive previous video source */
412 #define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ 412 #define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
413 #define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */ 413 #define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
414 #define KEY_DISPLAY_OFF 245 /* display device to off state */ 414 #define KEY_DISPLAY_OFF 245 /* display device to off state */
415 415
416 #define KEY_WIMAX 246 416 #define KEY_WIMAX 246
417 #define KEY_RFKILL 247 /* Key that controls all radios */ 417 #define KEY_RFKILL 247 /* Key that controls all radios */
418 418
419 /* Code 255 is reserved for special needs of AT keyboard driver */ 419 /* Code 255 is reserved for special needs of AT keyboard driver */
420 420
421 #define BTN_MISC 0x100 421 #define BTN_MISC 0x100
422 #define BTN_0 0x100 422 #define BTN_0 0x100
423 #define BTN_1 0x101 423 #define BTN_1 0x101
424 #define BTN_2 0x102 424 #define BTN_2 0x102
425 #define BTN_3 0x103 425 #define BTN_3 0x103
426 #define BTN_4 0x104 426 #define BTN_4 0x104
427 #define BTN_5 0x105 427 #define BTN_5 0x105
428 #define BTN_6 0x106 428 #define BTN_6 0x106
429 #define BTN_7 0x107 429 #define BTN_7 0x107
430 #define BTN_8 0x108 430 #define BTN_8 0x108
431 #define BTN_9 0x109 431 #define BTN_9 0x109
432 432
433 #define BTN_MOUSE 0x110 433 #define BTN_MOUSE 0x110
434 #define BTN_LEFT 0x110 434 #define BTN_LEFT 0x110
435 #define BTN_RIGHT 0x111 435 #define BTN_RIGHT 0x111
436 #define BTN_MIDDLE 0x112 436 #define BTN_MIDDLE 0x112
437 #define BTN_SIDE 0x113 437 #define BTN_SIDE 0x113
438 #define BTN_EXTRA 0x114 438 #define BTN_EXTRA 0x114
439 #define BTN_FORWARD 0x115 439 #define BTN_FORWARD 0x115
440 #define BTN_BACK 0x116 440 #define BTN_BACK 0x116
441 #define BTN_TASK 0x117 441 #define BTN_TASK 0x117
442 442
443 #define BTN_JOYSTICK 0x120 443 #define BTN_JOYSTICK 0x120
444 #define BTN_TRIGGER 0x120 444 #define BTN_TRIGGER 0x120
445 #define BTN_THUMB 0x121 445 #define BTN_THUMB 0x121
446 #define BTN_THUMB2 0x122 446 #define BTN_THUMB2 0x122
447 #define BTN_TOP 0x123 447 #define BTN_TOP 0x123
448 #define BTN_TOP2 0x124 448 #define BTN_TOP2 0x124
449 #define BTN_PINKIE 0x125 449 #define BTN_PINKIE 0x125
450 #define BTN_BASE 0x126 450 #define BTN_BASE 0x126
451 #define BTN_BASE2 0x127 451 #define BTN_BASE2 0x127
452 #define BTN_BASE3 0x128 452 #define BTN_BASE3 0x128
453 #define BTN_BASE4 0x129 453 #define BTN_BASE4 0x129
454 #define BTN_BASE5 0x12a 454 #define BTN_BASE5 0x12a
455 #define BTN_BASE6 0x12b 455 #define BTN_BASE6 0x12b
456 #define BTN_DEAD 0x12f 456 #define BTN_DEAD 0x12f
457 457
458 #define BTN_GAMEPAD 0x130 458 #define BTN_GAMEPAD 0x130
459 #define BTN_A 0x130 459 #define BTN_A 0x130
460 #define BTN_B 0x131 460 #define BTN_B 0x131
461 #define BTN_C 0x132 461 #define BTN_C 0x132
462 #define BTN_X 0x133 462 #define BTN_X 0x133
463 #define BTN_Y 0x134 463 #define BTN_Y 0x134
464 #define BTN_Z 0x135 464 #define BTN_Z 0x135
465 #define BTN_TL 0x136 465 #define BTN_TL 0x136
466 #define BTN_TR 0x137 466 #define BTN_TR 0x137
467 #define BTN_TL2 0x138 467 #define BTN_TL2 0x138
468 #define BTN_TR2 0x139 468 #define BTN_TR2 0x139
469 #define BTN_SELECT 0x13a 469 #define BTN_SELECT 0x13a
470 #define BTN_START 0x13b 470 #define BTN_START 0x13b
471 #define BTN_MODE 0x13c 471 #define BTN_MODE 0x13c
472 #define BTN_THUMBL 0x13d 472 #define BTN_THUMBL 0x13d
473 #define BTN_THUMBR 0x13e 473 #define BTN_THUMBR 0x13e
474 474
475 #define BTN_DIGI 0x140 475 #define BTN_DIGI 0x140
476 #define BTN_TOOL_PEN 0x140 476 #define BTN_TOOL_PEN 0x140
477 #define BTN_TOOL_RUBBER 0x141 477 #define BTN_TOOL_RUBBER 0x141
478 #define BTN_TOOL_BRUSH 0x142 478 #define BTN_TOOL_BRUSH 0x142
479 #define BTN_TOOL_PENCIL 0x143 479 #define BTN_TOOL_PENCIL 0x143
480 #define BTN_TOOL_AIRBRUSH 0x144 480 #define BTN_TOOL_AIRBRUSH 0x144
481 #define BTN_TOOL_FINGER 0x145 481 #define BTN_TOOL_FINGER 0x145
482 #define BTN_TOOL_MOUSE 0x146 482 #define BTN_TOOL_MOUSE 0x146
483 #define BTN_TOOL_LENS 0x147 483 #define BTN_TOOL_LENS 0x147
484 #define BTN_TOUCH 0x14a 484 #define BTN_TOUCH 0x14a
485 #define BTN_STYLUS 0x14b 485 #define BTN_STYLUS 0x14b
486 #define BTN_STYLUS2 0x14c 486 #define BTN_STYLUS2 0x14c
487 #define BTN_TOOL_DOUBLETAP 0x14d 487 #define BTN_TOOL_DOUBLETAP 0x14d
488 #define BTN_TOOL_TRIPLETAP 0x14e 488 #define BTN_TOOL_TRIPLETAP 0x14e
489 #define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ 489 #define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
490 490
491 #define BTN_WHEEL 0x150 491 #define BTN_WHEEL 0x150
492 #define BTN_GEAR_DOWN 0x150 492 #define BTN_GEAR_DOWN 0x150
493 #define BTN_GEAR_UP 0x151 493 #define BTN_GEAR_UP 0x151
494 494
495 #define KEY_OK 0x160 495 #define KEY_OK 0x160
496 #define KEY_SELECT 0x161 496 #define KEY_SELECT 0x161
497 #define KEY_GOTO 0x162 497 #define KEY_GOTO 0x162
498 #define KEY_CLEAR 0x163 498 #define KEY_CLEAR 0x163
499 #define KEY_POWER2 0x164 499 #define KEY_POWER2 0x164
500 #define KEY_OPTION 0x165 500 #define KEY_OPTION 0x165
501 #define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */ 501 #define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */
502 #define KEY_TIME 0x167 502 #define KEY_TIME 0x167
503 #define KEY_VENDOR 0x168 503 #define KEY_VENDOR 0x168
504 #define KEY_ARCHIVE 0x169 504 #define KEY_ARCHIVE 0x169
505 #define KEY_PROGRAM 0x16a /* Media Select Program Guide */ 505 #define KEY_PROGRAM 0x16a /* Media Select Program Guide */
506 #define KEY_CHANNEL 0x16b 506 #define KEY_CHANNEL 0x16b
507 #define KEY_FAVORITES 0x16c 507 #define KEY_FAVORITES 0x16c
508 #define KEY_EPG 0x16d 508 #define KEY_EPG 0x16d
509 #define KEY_PVR 0x16e /* Media Select Home */ 509 #define KEY_PVR 0x16e /* Media Select Home */
510 #define KEY_MHP 0x16f 510 #define KEY_MHP 0x16f
511 #define KEY_LANGUAGE 0x170 511 #define KEY_LANGUAGE 0x170
512 #define KEY_TITLE 0x171 512 #define KEY_TITLE 0x171
513 #define KEY_SUBTITLE 0x172 513 #define KEY_SUBTITLE 0x172
514 #define KEY_ANGLE 0x173 514 #define KEY_ANGLE 0x173
515 #define KEY_ZOOM 0x174 515 #define KEY_ZOOM 0x174
516 #define KEY_MODE 0x175 516 #define KEY_MODE 0x175
517 #define KEY_KEYBOARD 0x176 517 #define KEY_KEYBOARD 0x176
518 #define KEY_SCREEN 0x177 518 #define KEY_SCREEN 0x177
519 #define KEY_PC 0x178 /* Media Select Computer */ 519 #define KEY_PC 0x178 /* Media Select Computer */
520 #define KEY_TV 0x179 /* Media Select TV */ 520 #define KEY_TV 0x179 /* Media Select TV */
521 #define KEY_TV2 0x17a /* Media Select Cable */ 521 #define KEY_TV2 0x17a /* Media Select Cable */
522 #define KEY_VCR 0x17b /* Media Select VCR */ 522 #define KEY_VCR 0x17b /* Media Select VCR */
523 #define KEY_VCR2 0x17c /* VCR Plus */ 523 #define KEY_VCR2 0x17c /* VCR Plus */
524 #define KEY_SAT 0x17d /* Media Select Satellite */ 524 #define KEY_SAT 0x17d /* Media Select Satellite */
525 #define KEY_SAT2 0x17e 525 #define KEY_SAT2 0x17e
526 #define KEY_CD 0x17f /* Media Select CD */ 526 #define KEY_CD 0x17f /* Media Select CD */
527 #define KEY_TAPE 0x180 /* Media Select Tape */ 527 #define KEY_TAPE 0x180 /* Media Select Tape */
528 #define KEY_RADIO 0x181 528 #define KEY_RADIO 0x181
529 #define KEY_TUNER 0x182 /* Media Select Tuner */ 529 #define KEY_TUNER 0x182 /* Media Select Tuner */
530 #define KEY_PLAYER 0x183 530 #define KEY_PLAYER 0x183
531 #define KEY_TEXT 0x184 531 #define KEY_TEXT 0x184
532 #define KEY_DVD 0x185 /* Media Select DVD */ 532 #define KEY_DVD 0x185 /* Media Select DVD */
533 #define KEY_AUX 0x186 533 #define KEY_AUX 0x186
534 #define KEY_MP3 0x187 534 #define KEY_MP3 0x187
535 #define KEY_AUDIO 0x188 535 #define KEY_AUDIO 0x188
536 #define KEY_VIDEO 0x189 536 #define KEY_VIDEO 0x189
537 #define KEY_DIRECTORY 0x18a 537 #define KEY_DIRECTORY 0x18a
538 #define KEY_LIST 0x18b 538 #define KEY_LIST 0x18b
539 #define KEY_MEMO 0x18c /* Media Select Messages */ 539 #define KEY_MEMO 0x18c /* Media Select Messages */
540 #define KEY_CALENDAR 0x18d 540 #define KEY_CALENDAR 0x18d
541 #define KEY_RED 0x18e 541 #define KEY_RED 0x18e
542 #define KEY_GREEN 0x18f 542 #define KEY_GREEN 0x18f
543 #define KEY_YELLOW 0x190 543 #define KEY_YELLOW 0x190
544 #define KEY_BLUE 0x191 544 #define KEY_BLUE 0x191
545 #define KEY_CHANNELUP 0x192 /* Channel Increment */ 545 #define KEY_CHANNELUP 0x192 /* Channel Increment */
546 #define KEY_CHANNELDOWN 0x193 /* Channel Decrement */ 546 #define KEY_CHANNELDOWN 0x193 /* Channel Decrement */
547 #define KEY_FIRST 0x194 547 #define KEY_FIRST 0x194
548 #define KEY_LAST 0x195 /* Recall Last */ 548 #define KEY_LAST 0x195 /* Recall Last */
549 #define KEY_AB 0x196 549 #define KEY_AB 0x196
550 #define KEY_NEXT 0x197 550 #define KEY_NEXT 0x197
551 #define KEY_RESTART 0x198 551 #define KEY_RESTART 0x198
552 #define KEY_SLOW 0x199 552 #define KEY_SLOW 0x199
553 #define KEY_SHUFFLE 0x19a 553 #define KEY_SHUFFLE 0x19a
554 #define KEY_BREAK 0x19b 554 #define KEY_BREAK 0x19b
555 #define KEY_PREVIOUS 0x19c 555 #define KEY_PREVIOUS 0x19c
556 #define KEY_DIGITS 0x19d 556 #define KEY_DIGITS 0x19d
557 #define KEY_TEEN 0x19e 557 #define KEY_TEEN 0x19e
558 #define KEY_TWEN 0x19f 558 #define KEY_TWEN 0x19f
559 #define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */ 559 #define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */
560 #define KEY_GAMES 0x1a1 /* Media Select Games */ 560 #define KEY_GAMES 0x1a1 /* Media Select Games */
561 #define KEY_ZOOMIN 0x1a2 /* AC Zoom In */ 561 #define KEY_ZOOMIN 0x1a2 /* AC Zoom In */
562 #define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */ 562 #define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */
563 #define KEY_ZOOMRESET 0x1a4 /* AC Zoom */ 563 #define KEY_ZOOMRESET 0x1a4 /* AC Zoom */
564 #define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */ 564 #define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */
565 #define KEY_EDITOR 0x1a6 /* AL Text Editor */ 565 #define KEY_EDITOR 0x1a6 /* AL Text Editor */
566 #define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */ 566 #define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */
567 #define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */ 567 #define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */
568 #define KEY_PRESENTATION 0x1a9 /* AL Presentation App */ 568 #define KEY_PRESENTATION 0x1a9 /* AL Presentation App */
569 #define KEY_DATABASE 0x1aa /* AL Database App */ 569 #define KEY_DATABASE 0x1aa /* AL Database App */
570 #define KEY_NEWS 0x1ab /* AL Newsreader */ 570 #define KEY_NEWS 0x1ab /* AL Newsreader */
571 #define KEY_VOICEMAIL 0x1ac /* AL Voicemail */ 571 #define KEY_VOICEMAIL 0x1ac /* AL Voicemail */
572 #define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ 572 #define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
573 #define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ 573 #define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
574 #define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ 574 #define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
575 #define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ 575 #define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
576 #define KEY_LOGOFF 0x1b1 /* AL Logoff */ 576 #define KEY_LOGOFF 0x1b1 /* AL Logoff */
577 577
578 #define KEY_DOLLAR 0x1b2 578 #define KEY_DOLLAR 0x1b2
579 #define KEY_EURO 0x1b3 579 #define KEY_EURO 0x1b3
580 580
581 #define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ 581 #define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
582 #define KEY_FRAMEFORWARD 0x1b5 582 #define KEY_FRAMEFORWARD 0x1b5
583 #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ 583 #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
584 #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ 584 #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
585 585
586 #define KEY_DEL_EOL 0x1c0 586 #define KEY_DEL_EOL 0x1c0
587 #define KEY_DEL_EOS 0x1c1 587 #define KEY_DEL_EOS 0x1c1
588 #define KEY_INS_LINE 0x1c2 588 #define KEY_INS_LINE 0x1c2
589 #define KEY_DEL_LINE 0x1c3 589 #define KEY_DEL_LINE 0x1c3
590 590
591 #define KEY_FN 0x1d0 591 #define KEY_FN 0x1d0
592 #define KEY_FN_ESC 0x1d1 592 #define KEY_FN_ESC 0x1d1
593 #define KEY_FN_F1 0x1d2 593 #define KEY_FN_F1 0x1d2
594 #define KEY_FN_F2 0x1d3 594 #define KEY_FN_F2 0x1d3
595 #define KEY_FN_F3 0x1d4 595 #define KEY_FN_F3 0x1d4
596 #define KEY_FN_F4 0x1d5 596 #define KEY_FN_F4 0x1d5
597 #define KEY_FN_F5 0x1d6 597 #define KEY_FN_F5 0x1d6
598 #define KEY_FN_F6 0x1d7 598 #define KEY_FN_F6 0x1d7
599 #define KEY_FN_F7 0x1d8 599 #define KEY_FN_F7 0x1d8
600 #define KEY_FN_F8 0x1d9 600 #define KEY_FN_F8 0x1d9
601 #define KEY_FN_F9 0x1da 601 #define KEY_FN_F9 0x1da
602 #define KEY_FN_F10 0x1db 602 #define KEY_FN_F10 0x1db
603 #define KEY_FN_F11 0x1dc 603 #define KEY_FN_F11 0x1dc
604 #define KEY_FN_F12 0x1dd 604 #define KEY_FN_F12 0x1dd
605 #define KEY_FN_1 0x1de 605 #define KEY_FN_1 0x1de
606 #define KEY_FN_2 0x1df 606 #define KEY_FN_2 0x1df
607 #define KEY_FN_D 0x1e0 607 #define KEY_FN_D 0x1e0
608 #define KEY_FN_E 0x1e1 608 #define KEY_FN_E 0x1e1
609 #define KEY_FN_F 0x1e2 609 #define KEY_FN_F 0x1e2
610 #define KEY_FN_S 0x1e3 610 #define KEY_FN_S 0x1e3
611 #define KEY_FN_B 0x1e4 611 #define KEY_FN_B 0x1e4
612 612
613 #define KEY_BRL_DOT1 0x1f1 613 #define KEY_BRL_DOT1 0x1f1
614 #define KEY_BRL_DOT2 0x1f2 614 #define KEY_BRL_DOT2 0x1f2
615 #define KEY_BRL_DOT3 0x1f3 615 #define KEY_BRL_DOT3 0x1f3
616 #define KEY_BRL_DOT4 0x1f4 616 #define KEY_BRL_DOT4 0x1f4
617 #define KEY_BRL_DOT5 0x1f5 617 #define KEY_BRL_DOT5 0x1f5
618 #define KEY_BRL_DOT6 0x1f6 618 #define KEY_BRL_DOT6 0x1f6
619 #define KEY_BRL_DOT7 0x1f7 619 #define KEY_BRL_DOT7 0x1f7
620 #define KEY_BRL_DOT8 0x1f8 620 #define KEY_BRL_DOT8 0x1f8
621 #define KEY_BRL_DOT9 0x1f9 621 #define KEY_BRL_DOT9 0x1f9
622 #define KEY_BRL_DOT10 0x1fa 622 #define KEY_BRL_DOT10 0x1fa
623 623
624 #define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */ 624 #define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
625 #define KEY_NUMERIC_1 0x201 /* and other keypads */ 625 #define KEY_NUMERIC_1 0x201 /* and other keypads */
626 #define KEY_NUMERIC_2 0x202 626 #define KEY_NUMERIC_2 0x202
627 #define KEY_NUMERIC_3 0x203 627 #define KEY_NUMERIC_3 0x203
628 #define KEY_NUMERIC_4 0x204 628 #define KEY_NUMERIC_4 0x204
629 #define KEY_NUMERIC_5 0x205 629 #define KEY_NUMERIC_5 0x205
630 #define KEY_NUMERIC_6 0x206 630 #define KEY_NUMERIC_6 0x206
631 #define KEY_NUMERIC_7 0x207 631 #define KEY_NUMERIC_7 0x207
632 #define KEY_NUMERIC_8 0x208 632 #define KEY_NUMERIC_8 0x208
633 #define KEY_NUMERIC_9 0x209 633 #define KEY_NUMERIC_9 0x209
634 #define KEY_NUMERIC_STAR 0x20a 634 #define KEY_NUMERIC_STAR 0x20a
635 #define KEY_NUMERIC_POUND 0x20b 635 #define KEY_NUMERIC_POUND 0x20b
636 636
637 #define KEY_CAMERA_FOCUS 0x210 637 #define KEY_CAMERA_FOCUS 0x210
638 #define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ 638 #define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
639 639
640 #define BTN_TRIGGER_HAPPY 0x2c0 640 #define BTN_TRIGGER_HAPPY 0x2c0
641 #define BTN_TRIGGER_HAPPY1 0x2c0 641 #define BTN_TRIGGER_HAPPY1 0x2c0
642 #define BTN_TRIGGER_HAPPY2 0x2c1 642 #define BTN_TRIGGER_HAPPY2 0x2c1
643 #define BTN_TRIGGER_HAPPY3 0x2c2 643 #define BTN_TRIGGER_HAPPY3 0x2c2
644 #define BTN_TRIGGER_HAPPY4 0x2c3 644 #define BTN_TRIGGER_HAPPY4 0x2c3
645 #define BTN_TRIGGER_HAPPY5 0x2c4 645 #define BTN_TRIGGER_HAPPY5 0x2c4
646 #define BTN_TRIGGER_HAPPY6 0x2c5 646 #define BTN_TRIGGER_HAPPY6 0x2c5
647 #define BTN_TRIGGER_HAPPY7 0x2c6 647 #define BTN_TRIGGER_HAPPY7 0x2c6
648 #define BTN_TRIGGER_HAPPY8 0x2c7 648 #define BTN_TRIGGER_HAPPY8 0x2c7
649 #define BTN_TRIGGER_HAPPY9 0x2c8 649 #define BTN_TRIGGER_HAPPY9 0x2c8
650 #define BTN_TRIGGER_HAPPY10 0x2c9 650 #define BTN_TRIGGER_HAPPY10 0x2c9
651 #define BTN_TRIGGER_HAPPY11 0x2ca 651 #define BTN_TRIGGER_HAPPY11 0x2ca
652 #define BTN_TRIGGER_HAPPY12 0x2cb 652 #define BTN_TRIGGER_HAPPY12 0x2cb
653 #define BTN_TRIGGER_HAPPY13 0x2cc 653 #define BTN_TRIGGER_HAPPY13 0x2cc
654 #define BTN_TRIGGER_HAPPY14 0x2cd 654 #define BTN_TRIGGER_HAPPY14 0x2cd
655 #define BTN_TRIGGER_HAPPY15 0x2ce 655 #define BTN_TRIGGER_HAPPY15 0x2ce
656 #define BTN_TRIGGER_HAPPY16 0x2cf 656 #define BTN_TRIGGER_HAPPY16 0x2cf
657 #define BTN_TRIGGER_HAPPY17 0x2d0 657 #define BTN_TRIGGER_HAPPY17 0x2d0
658 #define BTN_TRIGGER_HAPPY18 0x2d1 658 #define BTN_TRIGGER_HAPPY18 0x2d1
659 #define BTN_TRIGGER_HAPPY19 0x2d2 659 #define BTN_TRIGGER_HAPPY19 0x2d2
660 #define BTN_TRIGGER_HAPPY20 0x2d3 660 #define BTN_TRIGGER_HAPPY20 0x2d3
661 #define BTN_TRIGGER_HAPPY21 0x2d4 661 #define BTN_TRIGGER_HAPPY21 0x2d4
662 #define BTN_TRIGGER_HAPPY22 0x2d5 662 #define BTN_TRIGGER_HAPPY22 0x2d5
663 #define BTN_TRIGGER_HAPPY23 0x2d6 663 #define BTN_TRIGGER_HAPPY23 0x2d6
664 #define BTN_TRIGGER_HAPPY24 0x2d7 664 #define BTN_TRIGGER_HAPPY24 0x2d7
665 #define BTN_TRIGGER_HAPPY25 0x2d8 665 #define BTN_TRIGGER_HAPPY25 0x2d8
666 #define BTN_TRIGGER_HAPPY26 0x2d9 666 #define BTN_TRIGGER_HAPPY26 0x2d9
667 #define BTN_TRIGGER_HAPPY27 0x2da 667 #define BTN_TRIGGER_HAPPY27 0x2da
668 #define BTN_TRIGGER_HAPPY28 0x2db 668 #define BTN_TRIGGER_HAPPY28 0x2db
669 #define BTN_TRIGGER_HAPPY29 0x2dc 669 #define BTN_TRIGGER_HAPPY29 0x2dc
670 #define BTN_TRIGGER_HAPPY30 0x2dd 670 #define BTN_TRIGGER_HAPPY30 0x2dd
671 #define BTN_TRIGGER_HAPPY31 0x2de 671 #define BTN_TRIGGER_HAPPY31 0x2de
672 #define BTN_TRIGGER_HAPPY32 0x2df 672 #define BTN_TRIGGER_HAPPY32 0x2df
673 #define BTN_TRIGGER_HAPPY33 0x2e0 673 #define BTN_TRIGGER_HAPPY33 0x2e0
674 #define BTN_TRIGGER_HAPPY34 0x2e1 674 #define BTN_TRIGGER_HAPPY34 0x2e1
675 #define BTN_TRIGGER_HAPPY35 0x2e2 675 #define BTN_TRIGGER_HAPPY35 0x2e2
676 #define BTN_TRIGGER_HAPPY36 0x2e3 676 #define BTN_TRIGGER_HAPPY36 0x2e3
677 #define BTN_TRIGGER_HAPPY37 0x2e4 677 #define BTN_TRIGGER_HAPPY37 0x2e4
678 #define BTN_TRIGGER_HAPPY38 0x2e5 678 #define BTN_TRIGGER_HAPPY38 0x2e5
679 #define BTN_TRIGGER_HAPPY39 0x2e6 679 #define BTN_TRIGGER_HAPPY39 0x2e6
680 #define BTN_TRIGGER_HAPPY40 0x2e7 680 #define BTN_TRIGGER_HAPPY40 0x2e7
681 681
682 /* We avoid low common keys in module aliases so they don't get huge. */ 682 /* We avoid low common keys in module aliases so they don't get huge. */
683 #define KEY_MIN_INTERESTING KEY_MUTE 683 #define KEY_MIN_INTERESTING KEY_MUTE
684 #define KEY_MAX 0x2ff 684 #define KEY_MAX 0x2ff
685 #define KEY_CNT (KEY_MAX+1) 685 #define KEY_CNT (KEY_MAX+1)
686 686
687 /* 687 /*
688 * Relative axes 688 * Relative axes
689 */ 689 */
690 690
691 #define REL_X 0x00 691 #define REL_X 0x00
692 #define REL_Y 0x01 692 #define REL_Y 0x01
693 #define REL_Z 0x02 693 #define REL_Z 0x02
694 #define REL_RX 0x03 694 #define REL_RX 0x03
695 #define REL_RY 0x04 695 #define REL_RY 0x04
696 #define REL_RZ 0x05 696 #define REL_RZ 0x05
697 #define REL_HWHEEL 0x06 697 #define REL_HWHEEL 0x06
698 #define REL_DIAL 0x07 698 #define REL_DIAL 0x07
699 #define REL_WHEEL 0x08 699 #define REL_WHEEL 0x08
700 #define REL_MISC 0x09 700 #define REL_MISC 0x09
701 #define REL_MAX 0x0f 701 #define REL_MAX 0x0f
702 #define REL_CNT (REL_MAX+1) 702 #define REL_CNT (REL_MAX+1)
703 703
704 /* 704 /*
705 * Absolute axes 705 * Absolute axes
706 */ 706 */
707 707
708 #define ABS_X 0x00 708 #define ABS_X 0x00
709 #define ABS_Y 0x01 709 #define ABS_Y 0x01
710 #define ABS_Z 0x02 710 #define ABS_Z 0x02
711 #define ABS_RX 0x03 711 #define ABS_RX 0x03
712 #define ABS_RY 0x04 712 #define ABS_RY 0x04
713 #define ABS_RZ 0x05 713 #define ABS_RZ 0x05
714 #define ABS_THROTTLE 0x06 714 #define ABS_THROTTLE 0x06
715 #define ABS_RUDDER 0x07 715 #define ABS_RUDDER 0x07
716 #define ABS_WHEEL 0x08 716 #define ABS_WHEEL 0x08
717 #define ABS_GAS 0x09 717 #define ABS_GAS 0x09
718 #define ABS_BRAKE 0x0a 718 #define ABS_BRAKE 0x0a
719 #define ABS_HAT0X 0x10 719 #define ABS_HAT0X 0x10
720 #define ABS_HAT0Y 0x11 720 #define ABS_HAT0Y 0x11
721 #define ABS_HAT1X 0x12 721 #define ABS_HAT1X 0x12
722 #define ABS_HAT1Y 0x13 722 #define ABS_HAT1Y 0x13
723 #define ABS_HAT2X 0x14 723 #define ABS_HAT2X 0x14
724 #define ABS_HAT2Y 0x15 724 #define ABS_HAT2Y 0x15
725 #define ABS_HAT3X 0x16 725 #define ABS_HAT3X 0x16
726 #define ABS_HAT3Y 0x17 726 #define ABS_HAT3Y 0x17
727 #define ABS_PRESSURE 0x18 727 #define ABS_PRESSURE 0x18
728 #define ABS_DISTANCE 0x19 728 #define ABS_DISTANCE 0x19
729 #define ABS_TILT_X 0x1a 729 #define ABS_TILT_X 0x1a
730 #define ABS_TILT_Y 0x1b 730 #define ABS_TILT_Y 0x1b
731 #define ABS_TOOL_WIDTH 0x1c 731 #define ABS_TOOL_WIDTH 0x1c
732 732
733 #define ABS_VOLUME 0x20 733 #define ABS_VOLUME 0x20
734 734
735 #define ABS_MISC 0x28 735 #define ABS_MISC 0x28
736 736
737 #define ABS_MT_SLOT 0x2f /* MT slot being modified */ 737 #define ABS_MT_SLOT 0x2f /* MT slot being modified */
738 #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ 738 #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
739 #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ 739 #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
740 #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ 740 #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
741 #define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ 741 #define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
742 #define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ 742 #define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
743 #define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */ 743 #define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */
744 #define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */ 744 #define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */
745 #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ 745 #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
746 #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ 746 #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
747 #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ 747 #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
748 #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ 748 #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
749 #define ABS_MT_DISTANCE 0x3b /* Contact hover distance */ 749 #define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
750 750
751 #ifdef __KERNEL__ 751 #ifdef __KERNEL__
752 /* Implementation details, userspace should not care about these */ 752 /* Implementation details, userspace should not care about these */
753 #define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR 753 #define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR
754 #define ABS_MT_LAST ABS_MT_DISTANCE 754 #define ABS_MT_LAST ABS_MT_DISTANCE
755 #endif 755 #endif
756 756
757 #define ABS_MAX 0x3f 757 #define ABS_MAX 0x3f
758 #define ABS_CNT (ABS_MAX+1) 758 #define ABS_CNT (ABS_MAX+1)
759 759
760 /* 760 /*
761 * Switch events 761 * Switch events
762 */ 762 */
763 763
764 #define SW_LID 0x00 /* set = lid shut */ 764 #define SW_LID 0x00 /* set = lid shut */
765 #define SW_TABLET_MODE 0x01 /* set = tablet mode */ 765 #define SW_TABLET_MODE 0x01 /* set = tablet mode */
766 #define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ 766 #define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
767 #define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" 767 #define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
768 set = radio enabled */ 768 set = radio enabled */
769 #define SW_RADIO SW_RFKILL_ALL /* deprecated */ 769 #define SW_RADIO SW_RFKILL_ALL /* deprecated */
770 #define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ 770 #define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
771 #define SW_DOCK 0x05 /* set = plugged into dock */ 771 #define SW_DOCK 0x05 /* set = plugged into dock */
772 #define SW_LINEOUT_INSERT 0x06 /* set = inserted */ 772 #define SW_LINEOUT_INSERT 0x06 /* set = inserted */
773 #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ 773 #define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
774 #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ 774 #define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */
775 #define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ 775 #define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */
776 #define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ 776 #define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */
777 #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ 777 #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */
778 #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
778 #define SW_MAX 0x0f 779 #define SW_MAX 0x0f
779 #define SW_CNT (SW_MAX+1) 780 #define SW_CNT (SW_MAX+1)
780 781
781 /* 782 /*
782 * Misc events 783 * Misc events
783 */ 784 */
784 785
785 #define MSC_SERIAL 0x00 786 #define MSC_SERIAL 0x00
786 #define MSC_PULSELED 0x01 787 #define MSC_PULSELED 0x01
787 #define MSC_GESTURE 0x02 788 #define MSC_GESTURE 0x02
788 #define MSC_RAW 0x03 789 #define MSC_RAW 0x03
789 #define MSC_SCAN 0x04 790 #define MSC_SCAN 0x04
790 #define MSC_MAX 0x07 791 #define MSC_MAX 0x07
791 #define MSC_CNT (MSC_MAX+1) 792 #define MSC_CNT (MSC_MAX+1)
792 793
793 /* 794 /*
794 * LEDs 795 * LEDs
795 */ 796 */
796 797
797 #define LED_NUML 0x00 798 #define LED_NUML 0x00
798 #define LED_CAPSL 0x01 799 #define LED_CAPSL 0x01
799 #define LED_SCROLLL 0x02 800 #define LED_SCROLLL 0x02
800 #define LED_COMPOSE 0x03 801 #define LED_COMPOSE 0x03
801 #define LED_KANA 0x04 802 #define LED_KANA 0x04
802 #define LED_SLEEP 0x05 803 #define LED_SLEEP 0x05
803 #define LED_SUSPEND 0x06 804 #define LED_SUSPEND 0x06
804 #define LED_MUTE 0x07 805 #define LED_MUTE 0x07
805 #define LED_MISC 0x08 806 #define LED_MISC 0x08
806 #define LED_MAIL 0x09 807 #define LED_MAIL 0x09
807 #define LED_CHARGING 0x0a 808 #define LED_CHARGING 0x0a
808 #define LED_MAX 0x0f 809 #define LED_MAX 0x0f
809 #define LED_CNT (LED_MAX+1) 810 #define LED_CNT (LED_MAX+1)
810 811
811 /* 812 /*
812 * Autorepeat values 813 * Autorepeat values
813 */ 814 */
814 815
815 #define REP_DELAY 0x00 816 #define REP_DELAY 0x00
816 #define REP_PERIOD 0x01 817 #define REP_PERIOD 0x01
817 #define REP_MAX 0x01 818 #define REP_MAX 0x01
818 #define REP_CNT (REP_MAX+1) 819 #define REP_CNT (REP_MAX+1)
819 820
820 /* 821 /*
821 * Sounds 822 * Sounds
822 */ 823 */
823 824
824 #define SND_CLICK 0x00 825 #define SND_CLICK 0x00
825 #define SND_BELL 0x01 826 #define SND_BELL 0x01
826 #define SND_TONE 0x02 827 #define SND_TONE 0x02
827 #define SND_MAX 0x07 828 #define SND_MAX 0x07
828 #define SND_CNT (SND_MAX+1) 829 #define SND_CNT (SND_MAX+1)
829 830
830 /* 831 /*
831 * IDs. 832 * IDs.
832 */ 833 */
833 834
834 #define ID_BUS 0 835 #define ID_BUS 0
835 #define ID_VENDOR 1 836 #define ID_VENDOR 1
836 #define ID_PRODUCT 2 837 #define ID_PRODUCT 2
837 #define ID_VERSION 3 838 #define ID_VERSION 3
838 839
839 #define BUS_PCI 0x01 840 #define BUS_PCI 0x01
840 #define BUS_ISAPNP 0x02 841 #define BUS_ISAPNP 0x02
841 #define BUS_USB 0x03 842 #define BUS_USB 0x03
842 #define BUS_HIL 0x04 843 #define BUS_HIL 0x04
843 #define BUS_BLUETOOTH 0x05 844 #define BUS_BLUETOOTH 0x05
844 #define BUS_VIRTUAL 0x06 845 #define BUS_VIRTUAL 0x06
845 846
846 #define BUS_ISA 0x10 847 #define BUS_ISA 0x10
847 #define BUS_I8042 0x11 848 #define BUS_I8042 0x11
848 #define BUS_XTKBD 0x12 849 #define BUS_XTKBD 0x12
849 #define BUS_RS232 0x13 850 #define BUS_RS232 0x13
850 #define BUS_GAMEPORT 0x14 851 #define BUS_GAMEPORT 0x14
851 #define BUS_PARPORT 0x15 852 #define BUS_PARPORT 0x15
852 #define BUS_AMIGA 0x16 853 #define BUS_AMIGA 0x16
853 #define BUS_ADB 0x17 854 #define BUS_ADB 0x17
854 #define BUS_I2C 0x18 855 #define BUS_I2C 0x18
855 #define BUS_HOST 0x19 856 #define BUS_HOST 0x19
856 #define BUS_GSC 0x1A 857 #define BUS_GSC 0x1A
857 #define BUS_ATARI 0x1B 858 #define BUS_ATARI 0x1B
858 #define BUS_SPI 0x1C 859 #define BUS_SPI 0x1C
859 860
860 /* 861 /*
861 * MT_TOOL types 862 * MT_TOOL types
862 */ 863 */
863 #define MT_TOOL_FINGER 0 864 #define MT_TOOL_FINGER 0
864 #define MT_TOOL_PEN 1 865 #define MT_TOOL_PEN 1
865 #define MT_TOOL_MAX 1 866 #define MT_TOOL_MAX 1
866 867
867 /* 868 /*
868 * Values describing the status of a force-feedback effect 869 * Values describing the status of a force-feedback effect
869 */ 870 */
870 #define FF_STATUS_STOPPED 0x00 871 #define FF_STATUS_STOPPED 0x00
871 #define FF_STATUS_PLAYING 0x01 872 #define FF_STATUS_PLAYING 0x01
872 #define FF_STATUS_MAX 0x01 873 #define FF_STATUS_MAX 0x01
873 874
874 /* 875 /*
875 * Structures used in ioctls to upload effects to a device 876 * Structures used in ioctls to upload effects to a device
876 * They are pieces of a bigger structure (called ff_effect) 877 * They are pieces of a bigger structure (called ff_effect)
877 */ 878 */
878 879
879 /* 880 /*
880 * All duration values are expressed in ms. Values above 32767 ms (0x7fff) 881 * All duration values are expressed in ms. Values above 32767 ms (0x7fff)
881 * should not be used and have unspecified results. 882 * should not be used and have unspecified results.
882 */ 883 */
883 884
884 /** 885 /**
885 * struct ff_replay - defines scheduling of the force-feedback effect 886 * struct ff_replay - defines scheduling of the force-feedback effect
886 * @length: duration of the effect 887 * @length: duration of the effect
887 * @delay: delay before effect should start playing 888 * @delay: delay before effect should start playing
888 */ 889 */
889 struct ff_replay { 890 struct ff_replay {
890 __u16 length; 891 __u16 length;
891 __u16 delay; 892 __u16 delay;
892 }; 893 };
893 894
894 /** 895 /**
895 * struct ff_trigger - defines what triggers the force-feedback effect 896 * struct ff_trigger - defines what triggers the force-feedback effect
896 * @button: number of the button triggering the effect 897 * @button: number of the button triggering the effect
897 * @interval: controls how soon the effect can be re-triggered 898 * @interval: controls how soon the effect can be re-triggered
898 */ 899 */
899 struct ff_trigger { 900 struct ff_trigger {
900 __u16 button; 901 __u16 button;
901 __u16 interval; 902 __u16 interval;
902 }; 903 };
903 904
904 /** 905 /**
905 * struct ff_envelope - generic force-feedback effect envelope 906 * struct ff_envelope - generic force-feedback effect envelope
906 * @attack_length: duration of the attack (ms) 907 * @attack_length: duration of the attack (ms)
907 * @attack_level: level at the beginning of the attack 908 * @attack_level: level at the beginning of the attack
908 * @fade_length: duration of fade (ms) 909 * @fade_length: duration of fade (ms)
909 * @fade_level: level at the end of fade 910 * @fade_level: level at the end of fade
910 * 911 *
911 * The @attack_level and @fade_level are absolute values; when applying 912 * The @attack_level and @fade_level are absolute values; when applying
912 * envelope force-feedback core will convert to positive/negative 913 * envelope force-feedback core will convert to positive/negative
913 * value based on polarity of the default level of the effect. 914 * value based on polarity of the default level of the effect.
914 * Valid range for the attack and fade levels is 0x0000 - 0x7fff 915 * Valid range for the attack and fade levels is 0x0000 - 0x7fff
915 */ 916 */
916 struct ff_envelope { 917 struct ff_envelope {
917 __u16 attack_length; 918 __u16 attack_length;
918 __u16 attack_level; 919 __u16 attack_level;
919 __u16 fade_length; 920 __u16 fade_length;
920 __u16 fade_level; 921 __u16 fade_level;
921 }; 922 };
922 923
923 /** 924 /**
924 * struct ff_constant_effect - defines parameters of a constant force-feedback effect 925 * struct ff_constant_effect - defines parameters of a constant force-feedback effect
925 * @level: strength of the effect; may be negative 926 * @level: strength of the effect; may be negative
926 * @envelope: envelope data 927 * @envelope: envelope data
927 */ 928 */
928 struct ff_constant_effect { 929 struct ff_constant_effect {
929 __s16 level; 930 __s16 level;
930 struct ff_envelope envelope; 931 struct ff_envelope envelope;
931 }; 932 };
932 933
933 /** 934 /**
934 * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect 935 * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect
935 * @start_level: beginning strength of the effect; may be negative 936 * @start_level: beginning strength of the effect; may be negative
936 * @end_level: final strength of the effect; may be negative 937 * @end_level: final strength of the effect; may be negative
937 * @envelope: envelope data 938 * @envelope: envelope data
938 */ 939 */
939 struct ff_ramp_effect { 940 struct ff_ramp_effect {
940 __s16 start_level; 941 __s16 start_level;
941 __s16 end_level; 942 __s16 end_level;
942 struct ff_envelope envelope; 943 struct ff_envelope envelope;
943 }; 944 };
944 945
945 /** 946 /**
946 * struct ff_condition_effect - defines a spring or friction force-feedback effect 947 * struct ff_condition_effect - defines a spring or friction force-feedback effect
947 * @right_saturation: maximum level when joystick moved all way to the right 948 * @right_saturation: maximum level when joystick moved all way to the right
948 * @left_saturation: same for the left side 949 * @left_saturation: same for the left side
949 * @right_coeff: controls how fast the force grows when the joystick moves 950 * @right_coeff: controls how fast the force grows when the joystick moves
950 * to the right 951 * to the right
951 * @left_coeff: same for the left side 952 * @left_coeff: same for the left side
952 * @deadband: size of the dead zone, where no force is produced 953 * @deadband: size of the dead zone, where no force is produced
953 * @center: position of the dead zone 954 * @center: position of the dead zone
954 */ 955 */
955 struct ff_condition_effect { 956 struct ff_condition_effect {
956 __u16 right_saturation; 957 __u16 right_saturation;
957 __u16 left_saturation; 958 __u16 left_saturation;
958 959
959 __s16 right_coeff; 960 __s16 right_coeff;
960 __s16 left_coeff; 961 __s16 left_coeff;
961 962
962 __u16 deadband; 963 __u16 deadband;
963 __s16 center; 964 __s16 center;
964 }; 965 };
965 966
966 /** 967 /**
967 * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect 968 * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect
968 * @waveform: kind of the effect (wave) 969 * @waveform: kind of the effect (wave)
969 * @period: period of the wave (ms) 970 * @period: period of the wave (ms)
970 * @magnitude: peak value 971 * @magnitude: peak value
971 * @offset: mean value of the wave (roughly) 972 * @offset: mean value of the wave (roughly)
972 * @phase: 'horizontal' shift 973 * @phase: 'horizontal' shift
973 * @envelope: envelope data 974 * @envelope: envelope data
974 * @custom_len: number of samples (FF_CUSTOM only) 975 * @custom_len: number of samples (FF_CUSTOM only)
975 * @custom_data: buffer of samples (FF_CUSTOM only) 976 * @custom_data: buffer of samples (FF_CUSTOM only)
976 * 977 *
977 * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP, 978 * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP,
978 * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined 979 * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined
979 * for the time being as no driver supports it yet. 980 * for the time being as no driver supports it yet.
980 * 981 *
981 * Note: the data pointed by custom_data is copied by the driver. 982 * Note: the data pointed by custom_data is copied by the driver.
982 * You can therefore dispose of the memory after the upload/update. 983 * You can therefore dispose of the memory after the upload/update.
983 */ 984 */
984 struct ff_periodic_effect { 985 struct ff_periodic_effect {
985 __u16 waveform; 986 __u16 waveform;
986 __u16 period; 987 __u16 period;
987 __s16 magnitude; 988 __s16 magnitude;
988 __s16 offset; 989 __s16 offset;
989 __u16 phase; 990 __u16 phase;
990 991
991 struct ff_envelope envelope; 992 struct ff_envelope envelope;
992 993
993 __u32 custom_len; 994 __u32 custom_len;
994 __s16 __user *custom_data; 995 __s16 __user *custom_data;
995 }; 996 };
996 997
997 /** 998 /**
998 * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect 999 * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect
999 * @strong_magnitude: magnitude of the heavy motor 1000 * @strong_magnitude: magnitude of the heavy motor
1000 * @weak_magnitude: magnitude of the light one 1001 * @weak_magnitude: magnitude of the light one
1001 * 1002 *
1002 * Some rumble pads have two motors of different weight. Strong_magnitude 1003 * Some rumble pads have two motors of different weight. Strong_magnitude
1003 * represents the magnitude of the vibration generated by the heavy one. 1004 * represents the magnitude of the vibration generated by the heavy one.
1004 */ 1005 */
1005 struct ff_rumble_effect { 1006 struct ff_rumble_effect {
1006 __u16 strong_magnitude; 1007 __u16 strong_magnitude;
1007 __u16 weak_magnitude; 1008 __u16 weak_magnitude;
1008 }; 1009 };
1009 1010
1010 /** 1011 /**
1011 * struct ff_effect - defines force feedback effect 1012 * struct ff_effect - defines force feedback effect
1012 * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING, 1013 * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
1013 * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM) 1014 * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM)
1014 * @id: an unique id assigned to an effect 1015 * @id: an unique id assigned to an effect
1015 * @direction: direction of the effect 1016 * @direction: direction of the effect
1016 * @trigger: trigger conditions (struct ff_trigger) 1017 * @trigger: trigger conditions (struct ff_trigger)
1017 * @replay: scheduling of the effect (struct ff_replay) 1018 * @replay: scheduling of the effect (struct ff_replay)
1018 * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect, 1019 * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect,
1019 * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further 1020 * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further
1020 * defining effect parameters 1021 * defining effect parameters
1021 * 1022 *
1022 * This structure is sent through ioctl from the application to the driver. 1023 * This structure is sent through ioctl from the application to the driver.
1023 * To create a new effect application should set its @id to -1; the kernel 1024 * To create a new effect application should set its @id to -1; the kernel
1024 * will return assigned @id which can later be used to update or delete 1025 * will return assigned @id which can later be used to update or delete
1025 * this effect. 1026 * this effect.
1026 * 1027 *
1027 * Direction of the effect is encoded as follows: 1028 * Direction of the effect is encoded as follows:
1028 * 0 deg -> 0x0000 (down) 1029 * 0 deg -> 0x0000 (down)
1029 * 90 deg -> 0x4000 (left) 1030 * 90 deg -> 0x4000 (left)
1030 * 180 deg -> 0x8000 (up) 1031 * 180 deg -> 0x8000 (up)
1031 * 270 deg -> 0xC000 (right) 1032 * 270 deg -> 0xC000 (right)
1032 */ 1033 */
1033 struct ff_effect { 1034 struct ff_effect {
1034 __u16 type; 1035 __u16 type;
1035 __s16 id; 1036 __s16 id;
1036 __u16 direction; 1037 __u16 direction;
1037 struct ff_trigger trigger; 1038 struct ff_trigger trigger;
1038 struct ff_replay replay; 1039 struct ff_replay replay;
1039 1040
1040 union { 1041 union {
1041 struct ff_constant_effect constant; 1042 struct ff_constant_effect constant;
1042 struct ff_ramp_effect ramp; 1043 struct ff_ramp_effect ramp;
1043 struct ff_periodic_effect periodic; 1044 struct ff_periodic_effect periodic;
1044 struct ff_condition_effect condition[2]; /* One for each axis */ 1045 struct ff_condition_effect condition[2]; /* One for each axis */
1045 struct ff_rumble_effect rumble; 1046 struct ff_rumble_effect rumble;
1046 } u; 1047 } u;
1047 }; 1048 };
1048 1049
1049 /* 1050 /*
1050 * Force feedback effect types 1051 * Force feedback effect types
1051 */ 1052 */
1052 1053
1053 #define FF_RUMBLE 0x50 1054 #define FF_RUMBLE 0x50
1054 #define FF_PERIODIC 0x51 1055 #define FF_PERIODIC 0x51
1055 #define FF_CONSTANT 0x52 1056 #define FF_CONSTANT 0x52
1056 #define FF_SPRING 0x53 1057 #define FF_SPRING 0x53
1057 #define FF_FRICTION 0x54 1058 #define FF_FRICTION 0x54
1058 #define FF_DAMPER 0x55 1059 #define FF_DAMPER 0x55
1059 #define FF_INERTIA 0x56 1060 #define FF_INERTIA 0x56
1060 #define FF_RAMP 0x57 1061 #define FF_RAMP 0x57
1061 1062
1062 #define FF_EFFECT_MIN FF_RUMBLE 1063 #define FF_EFFECT_MIN FF_RUMBLE
1063 #define FF_EFFECT_MAX FF_RAMP 1064 #define FF_EFFECT_MAX FF_RAMP
1064 1065
1065 /* 1066 /*
1066 * Force feedback periodic effect types 1067 * Force feedback periodic effect types
1067 */ 1068 */
1068 1069
1069 #define FF_SQUARE 0x58 1070 #define FF_SQUARE 0x58
1070 #define FF_TRIANGLE 0x59 1071 #define FF_TRIANGLE 0x59
1071 #define FF_SINE 0x5a 1072 #define FF_SINE 0x5a
1072 #define FF_SAW_UP 0x5b 1073 #define FF_SAW_UP 0x5b
1073 #define FF_SAW_DOWN 0x5c 1074 #define FF_SAW_DOWN 0x5c
1074 #define FF_CUSTOM 0x5d 1075 #define FF_CUSTOM 0x5d
1075 1076
1076 #define FF_WAVEFORM_MIN FF_SQUARE 1077 #define FF_WAVEFORM_MIN FF_SQUARE
1077 #define FF_WAVEFORM_MAX FF_CUSTOM 1078 #define FF_WAVEFORM_MAX FF_CUSTOM
1078 1079
1079 /* 1080 /*
1080 * Set ff device properties 1081 * Set ff device properties
1081 */ 1082 */
1082 1083
1083 #define FF_GAIN 0x60 1084 #define FF_GAIN 0x60
1084 #define FF_AUTOCENTER 0x61 1085 #define FF_AUTOCENTER 0x61
1085 1086
1086 #define FF_MAX 0x7f 1087 #define FF_MAX 0x7f
1087 #define FF_CNT (FF_MAX+1) 1088 #define FF_CNT (FF_MAX+1)
1088 1089
1089 #ifdef __KERNEL__ 1090 #ifdef __KERNEL__
1090 1091
1091 /* 1092 /*
1092 * In-kernel definitions. 1093 * In-kernel definitions.
1093 */ 1094 */
1094 1095
1095 #include <linux/device.h> 1096 #include <linux/device.h>
1096 #include <linux/fs.h> 1097 #include <linux/fs.h>
1097 #include <linux/timer.h> 1098 #include <linux/timer.h>
1098 #include <linux/mod_devicetable.h> 1099 #include <linux/mod_devicetable.h>
1099 1100
1100 /** 1101 /**
1101 * struct input_dev - represents an input device 1102 * struct input_dev - represents an input device
1102 * @name: name of the device 1103 * @name: name of the device
1103 * @phys: physical path to the device in the system hierarchy 1104 * @phys: physical path to the device in the system hierarchy
1104 * @uniq: unique identification code for the device (if device has it) 1105 * @uniq: unique identification code for the device (if device has it)
1105 * @id: id of the device (struct input_id) 1106 * @id: id of the device (struct input_id)
1106 * @propbit: bitmap of device properties and quirks 1107 * @propbit: bitmap of device properties and quirks
1107 * @evbit: bitmap of types of events supported by the device (EV_KEY, 1108 * @evbit: bitmap of types of events supported by the device (EV_KEY,
1108 * EV_REL, etc.) 1109 * EV_REL, etc.)
1109 * @keybit: bitmap of keys/buttons this device has 1110 * @keybit: bitmap of keys/buttons this device has
1110 * @relbit: bitmap of relative axes for the device 1111 * @relbit: bitmap of relative axes for the device
1111 * @absbit: bitmap of absolute axes for the device 1112 * @absbit: bitmap of absolute axes for the device
1112 * @mscbit: bitmap of miscellaneous events supported by the device 1113 * @mscbit: bitmap of miscellaneous events supported by the device
1113 * @ledbit: bitmap of leds present on the device 1114 * @ledbit: bitmap of leds present on the device
1114 * @sndbit: bitmap of sound effects supported by the device 1115 * @sndbit: bitmap of sound effects supported by the device
1115 * @ffbit: bitmap of force feedback effects supported by the device 1116 * @ffbit: bitmap of force feedback effects supported by the device
1116 * @swbit: bitmap of switches present on the device 1117 * @swbit: bitmap of switches present on the device
1117 * @hint_events_per_packet: average number of events generated by the 1118 * @hint_events_per_packet: average number of events generated by the
1118 * device in a packet (between EV_SYN/SYN_REPORT events). Used by 1119 * device in a packet (between EV_SYN/SYN_REPORT events). Used by
1119 * event handlers to estimate size of the buffer needed to hold 1120 * event handlers to estimate size of the buffer needed to hold
1120 * events. 1121 * events.
1121 * @keycodemax: size of keycode table 1122 * @keycodemax: size of keycode table
1122 * @keycodesize: size of elements in keycode table 1123 * @keycodesize: size of elements in keycode table
1123 * @keycode: map of scancodes to keycodes for this device 1124 * @keycode: map of scancodes to keycodes for this device
1124 * @getkeycode: optional legacy method to retrieve current keymap. 1125 * @getkeycode: optional legacy method to retrieve current keymap.
1125 * @setkeycode: optional method to alter current keymap, used to implement 1126 * @setkeycode: optional method to alter current keymap, used to implement
1126 * sparse keymaps. If not supplied default mechanism will be used. 1127 * sparse keymaps. If not supplied default mechanism will be used.
1127 * The method is being called while holding event_lock and thus must 1128 * The method is being called while holding event_lock and thus must
1128 * not sleep 1129 * not sleep
1129 * @getkeycode_new: transition method 1130 * @getkeycode_new: transition method
1130 * @setkeycode_new: transition method 1131 * @setkeycode_new: transition method
1131 * @ff: force feedback structure associated with the device if device 1132 * @ff: force feedback structure associated with the device if device
1132 * supports force feedback effects 1133 * supports force feedback effects
1133 * @repeat_key: stores key code of the last key pressed; used to implement 1134 * @repeat_key: stores key code of the last key pressed; used to implement
1134 * software autorepeat 1135 * software autorepeat
1135 * @timer: timer for software autorepeat 1136 * @timer: timer for software autorepeat
1136 * @rep: current values for autorepeat parameters (delay, rate) 1137 * @rep: current values for autorepeat parameters (delay, rate)
1137 * @mt: pointer to array of struct input_mt_slot holding current values 1138 * @mt: pointer to array of struct input_mt_slot holding current values
1138 * of tracked contacts 1139 * of tracked contacts
1139 * @mtsize: number of MT slots the device uses 1140 * @mtsize: number of MT slots the device uses
1140 * @slot: MT slot currently being transmitted 1141 * @slot: MT slot currently being transmitted
1141 * @trkid: stores MT tracking ID for the current contact 1142 * @trkid: stores MT tracking ID for the current contact
1142 * @absinfo: array of &struct absinfo elements holding information 1143 * @absinfo: array of &struct absinfo elements holding information
1143 * about absolute axes (current value, min, max, flat, fuzz, 1144 * about absolute axes (current value, min, max, flat, fuzz,
1144 * resolution) 1145 * resolution)
1145 * @key: reflects current state of device's keys/buttons 1146 * @key: reflects current state of device's keys/buttons
1146 * @led: reflects current state of device's LEDs 1147 * @led: reflects current state of device's LEDs
1147 * @snd: reflects current state of sound effects 1148 * @snd: reflects current state of sound effects
1148 * @sw: reflects current state of device's switches 1149 * @sw: reflects current state of device's switches
1149 * @open: this method is called when the very first user calls 1150 * @open: this method is called when the very first user calls
1150 * input_open_device(). The driver must prepare the device 1151 * input_open_device(). The driver must prepare the device
1151 * to start generating events (start polling thread, 1152 * to start generating events (start polling thread,
1152 * request an IRQ, submit URB, etc.) 1153 * request an IRQ, submit URB, etc.)
1153 * @close: this method is called when the very last user calls 1154 * @close: this method is called when the very last user calls
1154 * input_close_device(). 1155 * input_close_device().
1155 * @flush: purges the device. Most commonly used to get rid of force 1156 * @flush: purges the device. Most commonly used to get rid of force
1156 * feedback effects loaded into the device when disconnecting 1157 * feedback effects loaded into the device when disconnecting
1157 * from it 1158 * from it
1158 * @event: event handler for events sent _to_ the device, like EV_LED 1159 * @event: event handler for events sent _to_ the device, like EV_LED
1159 * or EV_SND. The device is expected to carry out the requested 1160 * or EV_SND. The device is expected to carry out the requested
1160 * action (turn on a LED, play sound, etc.) The call is protected 1161 * action (turn on a LED, play sound, etc.) The call is protected
1161 * by @event_lock and must not sleep 1162 * by @event_lock and must not sleep
1162 * @grab: input handle that currently has the device grabbed (via 1163 * @grab: input handle that currently has the device grabbed (via
1163 * EVIOCGRAB ioctl). When a handle grabs a device it becomes sole 1164 * EVIOCGRAB ioctl). When a handle grabs a device it becomes sole
1164 * recipient for all input events coming from the device 1165 * recipient for all input events coming from the device
1165 * @event_lock: this spinlock is is taken when input core receives 1166 * @event_lock: this spinlock is is taken when input core receives
1166 * and processes a new event for the device (in input_event()). 1167 * and processes a new event for the device (in input_event()).
1167 * Code that accesses and/or modifies parameters of a device 1168 * Code that accesses and/or modifies parameters of a device
1168 * (such as keymap or absmin, absmax, absfuzz, etc.) after device 1169 * (such as keymap or absmin, absmax, absfuzz, etc.) after device
1169 * has been registered with input core must take this lock. 1170 * has been registered with input core must take this lock.
1170 * @mutex: serializes calls to open(), close() and flush() methods 1171 * @mutex: serializes calls to open(), close() and flush() methods
1171 * @users: stores number of users (input handlers) that opened this 1172 * @users: stores number of users (input handlers) that opened this
1172 * device. It is used by input_open_device() and input_close_device() 1173 * device. It is used by input_open_device() and input_close_device()
1173 * to make sure that dev->open() is only called when the first 1174 * to make sure that dev->open() is only called when the first
1174 * user opens device and dev->close() is called when the very 1175 * user opens device and dev->close() is called when the very
1175 * last user closes the device 1176 * last user closes the device
1176 * @going_away: marks devices that are in a middle of unregistering and 1177 * @going_away: marks devices that are in a middle of unregistering and
1177 * causes input_open_device*() fail with -ENODEV. 1178 * causes input_open_device*() fail with -ENODEV.
1178 * @sync: set to %true when there were no new events since last EV_SYN 1179 * @sync: set to %true when there were no new events since last EV_SYN
1179 * @dev: driver model's view of this device 1180 * @dev: driver model's view of this device
1180 * @h_list: list of input handles associated with the device. When 1181 * @h_list: list of input handles associated with the device. When
1181 * accessing the list dev->mutex must be held 1182 * accessing the list dev->mutex must be held
1182 * @node: used to place the device onto input_dev_list 1183 * @node: used to place the device onto input_dev_list
1183 */ 1184 */
1184 struct input_dev { 1185 struct input_dev {
1185 const char *name; 1186 const char *name;
1186 const char *phys; 1187 const char *phys;
1187 const char *uniq; 1188 const char *uniq;
1188 struct input_id id; 1189 struct input_id id;
1189 1190
1190 unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)]; 1191 unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)];
1191 1192
1192 unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; 1193 unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
1193 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; 1194 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
1194 unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; 1195 unsigned long relbit[BITS_TO_LONGS(REL_CNT)];
1195 unsigned long absbit[BITS_TO_LONGS(ABS_CNT)]; 1196 unsigned long absbit[BITS_TO_LONGS(ABS_CNT)];
1196 unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)]; 1197 unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)];
1197 unsigned long ledbit[BITS_TO_LONGS(LED_CNT)]; 1198 unsigned long ledbit[BITS_TO_LONGS(LED_CNT)];
1198 unsigned long sndbit[BITS_TO_LONGS(SND_CNT)]; 1199 unsigned long sndbit[BITS_TO_LONGS(SND_CNT)];
1199 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; 1200 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
1200 unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; 1201 unsigned long swbit[BITS_TO_LONGS(SW_CNT)];
1201 1202
1202 unsigned int hint_events_per_packet; 1203 unsigned int hint_events_per_packet;
1203 1204
1204 unsigned int keycodemax; 1205 unsigned int keycodemax;
1205 unsigned int keycodesize; 1206 unsigned int keycodesize;
1206 void *keycode; 1207 void *keycode;
1207 1208
1208 int (*setkeycode)(struct input_dev *dev, 1209 int (*setkeycode)(struct input_dev *dev,
1209 unsigned int scancode, unsigned int keycode); 1210 unsigned int scancode, unsigned int keycode);
1210 int (*getkeycode)(struct input_dev *dev, 1211 int (*getkeycode)(struct input_dev *dev,
1211 unsigned int scancode, unsigned int *keycode); 1212 unsigned int scancode, unsigned int *keycode);
1212 int (*setkeycode_new)(struct input_dev *dev, 1213 int (*setkeycode_new)(struct input_dev *dev,
1213 const struct input_keymap_entry *ke, 1214 const struct input_keymap_entry *ke,
1214 unsigned int *old_keycode); 1215 unsigned int *old_keycode);
1215 int (*getkeycode_new)(struct input_dev *dev, 1216 int (*getkeycode_new)(struct input_dev *dev,
1216 struct input_keymap_entry *ke); 1217 struct input_keymap_entry *ke);
1217 1218
1218 struct ff_device *ff; 1219 struct ff_device *ff;
1219 1220
1220 unsigned int repeat_key; 1221 unsigned int repeat_key;
1221 struct timer_list timer; 1222 struct timer_list timer;
1222 1223
1223 int rep[REP_CNT]; 1224 int rep[REP_CNT];
1224 1225
1225 struct input_mt_slot *mt; 1226 struct input_mt_slot *mt;
1226 int mtsize; 1227 int mtsize;
1227 int slot; 1228 int slot;
1228 int trkid; 1229 int trkid;
1229 1230
1230 struct input_absinfo *absinfo; 1231 struct input_absinfo *absinfo;
1231 1232
1232 unsigned long key[BITS_TO_LONGS(KEY_CNT)]; 1233 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
1233 unsigned long led[BITS_TO_LONGS(LED_CNT)]; 1234 unsigned long led[BITS_TO_LONGS(LED_CNT)];
1234 unsigned long snd[BITS_TO_LONGS(SND_CNT)]; 1235 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
1235 unsigned long sw[BITS_TO_LONGS(SW_CNT)]; 1236 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
1236 1237
1237 int (*open)(struct input_dev *dev); 1238 int (*open)(struct input_dev *dev);
1238 void (*close)(struct input_dev *dev); 1239 void (*close)(struct input_dev *dev);
1239 int (*flush)(struct input_dev *dev, struct file *file); 1240 int (*flush)(struct input_dev *dev, struct file *file);
1240 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); 1241 int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
1241 1242
1242 struct input_handle __rcu *grab; 1243 struct input_handle __rcu *grab;
1243 1244
1244 spinlock_t event_lock; 1245 spinlock_t event_lock;
1245 struct mutex mutex; 1246 struct mutex mutex;
1246 1247
1247 unsigned int users; 1248 unsigned int users;
1248 bool going_away; 1249 bool going_away;
1249 1250
1250 bool sync; 1251 bool sync;
1251 1252
1252 struct device dev; 1253 struct device dev;
1253 1254
1254 struct list_head h_list; 1255 struct list_head h_list;
1255 struct list_head node; 1256 struct list_head node;
1256 }; 1257 };
1257 #define to_input_dev(d) container_of(d, struct input_dev, dev) 1258 #define to_input_dev(d) container_of(d, struct input_dev, dev)
1258 1259
1259 /* 1260 /*
1260 * Verify that we are in sync with input_device_id mod_devicetable.h #defines 1261 * Verify that we are in sync with input_device_id mod_devicetable.h #defines
1261 */ 1262 */
1262 1263
1263 #if EV_MAX != INPUT_DEVICE_ID_EV_MAX 1264 #if EV_MAX != INPUT_DEVICE_ID_EV_MAX
1264 #error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match" 1265 #error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match"
1265 #endif 1266 #endif
1266 1267
1267 #if KEY_MIN_INTERESTING != INPUT_DEVICE_ID_KEY_MIN_INTERESTING 1268 #if KEY_MIN_INTERESTING != INPUT_DEVICE_ID_KEY_MIN_INTERESTING
1268 #error "KEY_MIN_INTERESTING and INPUT_DEVICE_ID_KEY_MIN_INTERESTING do not match" 1269 #error "KEY_MIN_INTERESTING and INPUT_DEVICE_ID_KEY_MIN_INTERESTING do not match"
1269 #endif 1270 #endif
1270 1271
1271 #if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX 1272 #if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX
1272 #error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match" 1273 #error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match"
1273 #endif 1274 #endif
1274 1275
1275 #if REL_MAX != INPUT_DEVICE_ID_REL_MAX 1276 #if REL_MAX != INPUT_DEVICE_ID_REL_MAX
1276 #error "REL_MAX and INPUT_DEVICE_ID_REL_MAX do not match" 1277 #error "REL_MAX and INPUT_DEVICE_ID_REL_MAX do not match"
1277 #endif 1278 #endif
1278 1279
1279 #if ABS_MAX != INPUT_DEVICE_ID_ABS_MAX 1280 #if ABS_MAX != INPUT_DEVICE_ID_ABS_MAX
1280 #error "ABS_MAX and INPUT_DEVICE_ID_ABS_MAX do not match" 1281 #error "ABS_MAX and INPUT_DEVICE_ID_ABS_MAX do not match"
1281 #endif 1282 #endif
1282 1283
1283 #if MSC_MAX != INPUT_DEVICE_ID_MSC_MAX 1284 #if MSC_MAX != INPUT_DEVICE_ID_MSC_MAX
1284 #error "MSC_MAX and INPUT_DEVICE_ID_MSC_MAX do not match" 1285 #error "MSC_MAX and INPUT_DEVICE_ID_MSC_MAX do not match"
1285 #endif 1286 #endif
1286 1287
1287 #if LED_MAX != INPUT_DEVICE_ID_LED_MAX 1288 #if LED_MAX != INPUT_DEVICE_ID_LED_MAX
1288 #error "LED_MAX and INPUT_DEVICE_ID_LED_MAX do not match" 1289 #error "LED_MAX and INPUT_DEVICE_ID_LED_MAX do not match"
1289 #endif 1290 #endif
1290 1291
1291 #if SND_MAX != INPUT_DEVICE_ID_SND_MAX 1292 #if SND_MAX != INPUT_DEVICE_ID_SND_MAX
1292 #error "SND_MAX and INPUT_DEVICE_ID_SND_MAX do not match" 1293 #error "SND_MAX and INPUT_DEVICE_ID_SND_MAX do not match"
1293 #endif 1294 #endif
1294 1295
1295 #if FF_MAX != INPUT_DEVICE_ID_FF_MAX 1296 #if FF_MAX != INPUT_DEVICE_ID_FF_MAX
1296 #error "FF_MAX and INPUT_DEVICE_ID_FF_MAX do not match" 1297 #error "FF_MAX and INPUT_DEVICE_ID_FF_MAX do not match"
1297 #endif 1298 #endif
1298 1299
1299 #if SW_MAX != INPUT_DEVICE_ID_SW_MAX 1300 #if SW_MAX != INPUT_DEVICE_ID_SW_MAX
1300 #error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match" 1301 #error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"
1301 #endif 1302 #endif
1302 1303
1303 #define INPUT_DEVICE_ID_MATCH_DEVICE \ 1304 #define INPUT_DEVICE_ID_MATCH_DEVICE \
1304 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) 1305 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
1305 #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \ 1306 #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
1306 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) 1307 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
1307 1308
1308 struct input_handle; 1309 struct input_handle;
1309 1310
1310 /** 1311 /**
1311 * struct input_handler - implements one of interfaces for input devices 1312 * struct input_handler - implements one of interfaces for input devices
1312 * @private: driver-specific data 1313 * @private: driver-specific data
1313 * @event: event handler. This method is being called by input core with 1314 * @event: event handler. This method is being called by input core with
1314 * interrupts disabled and dev->event_lock spinlock held and so 1315 * interrupts disabled and dev->event_lock spinlock held and so
1315 * it may not sleep 1316 * it may not sleep
1316 * @filter: similar to @event; separates normal event handlers from 1317 * @filter: similar to @event; separates normal event handlers from
1317 * "filters". 1318 * "filters".
1318 * @match: called after comparing device's id with handler's id_table 1319 * @match: called after comparing device's id with handler's id_table
1319 * to perform fine-grained matching between device and handler 1320 * to perform fine-grained matching between device and handler
1320 * @connect: called when attaching a handler to an input device 1321 * @connect: called when attaching a handler to an input device
1321 * @disconnect: disconnects a handler from input device 1322 * @disconnect: disconnects a handler from input device
1322 * @start: starts handler for given handle. This function is called by 1323 * @start: starts handler for given handle. This function is called by
1323 * input core right after connect() method and also when a process 1324 * input core right after connect() method and also when a process
1324 * that "grabbed" a device releases it 1325 * that "grabbed" a device releases it
1325 * @fops: file operations this driver implements 1326 * @fops: file operations this driver implements
1326 * @minor: beginning of range of 32 minors for devices this driver 1327 * @minor: beginning of range of 32 minors for devices this driver
1327 * can provide 1328 * can provide
1328 * @name: name of the handler, to be shown in /proc/bus/input/handlers 1329 * @name: name of the handler, to be shown in /proc/bus/input/handlers
1329 * @id_table: pointer to a table of input_device_ids this driver can 1330 * @id_table: pointer to a table of input_device_ids this driver can
1330 * handle 1331 * handle
1331 * @h_list: list of input handles associated with the handler 1332 * @h_list: list of input handles associated with the handler
1332 * @node: for placing the driver onto input_handler_list 1333 * @node: for placing the driver onto input_handler_list
1333 * 1334 *
1334 * Input handlers attach to input devices and create input handles. There 1335 * Input handlers attach to input devices and create input handles. There
1335 * are likely several handlers attached to any given input device at the 1336 * are likely several handlers attached to any given input device at the
1336 * same time. All of them will get their copy of input event generated by 1337 * same time. All of them will get their copy of input event generated by
1337 * the device. 1338 * the device.
1338 * 1339 *
1339 * The very same structure is used to implement input filters. Input core 1340 * The very same structure is used to implement input filters. Input core
1340 * allows filters to run first and will not pass event to regular handlers 1341 * allows filters to run first and will not pass event to regular handlers
1341 * if any of the filters indicate that the event should be filtered (by 1342 * if any of the filters indicate that the event should be filtered (by
1342 * returning %true from their filter() method). 1343 * returning %true from their filter() method).
1343 * 1344 *
1344 * Note that input core serializes calls to connect() and disconnect() 1345 * Note that input core serializes calls to connect() and disconnect()
1345 * methods. 1346 * methods.
1346 */ 1347 */
1347 struct input_handler { 1348 struct input_handler {
1348 1349
1349 void *private; 1350 void *private;
1350 1351
1351 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1352 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1352 bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1353 bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1353 bool (*match)(struct input_handler *handler, struct input_dev *dev); 1354 bool (*match)(struct input_handler *handler, struct input_dev *dev);
1354 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); 1355 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
1355 void (*disconnect)(struct input_handle *handle); 1356 void (*disconnect)(struct input_handle *handle);
1356 void (*start)(struct input_handle *handle); 1357 void (*start)(struct input_handle *handle);
1357 1358
1358 const struct file_operations *fops; 1359 const struct file_operations *fops;
1359 int minor; 1360 int minor;
1360 const char *name; 1361 const char *name;
1361 1362
1362 const struct input_device_id *id_table; 1363 const struct input_device_id *id_table;
1363 1364
1364 struct list_head h_list; 1365 struct list_head h_list;
1365 struct list_head node; 1366 struct list_head node;
1366 }; 1367 };
1367 1368
1368 /** 1369 /**
1369 * struct input_handle - links input device with an input handler 1370 * struct input_handle - links input device with an input handler
1370 * @private: handler-specific data 1371 * @private: handler-specific data
1371 * @open: counter showing whether the handle is 'open', i.e. should deliver 1372 * @open: counter showing whether the handle is 'open', i.e. should deliver
1372 * events from its device 1373 * events from its device
1373 * @name: name given to the handle by handler that created it 1374 * @name: name given to the handle by handler that created it
1374 * @dev: input device the handle is attached to 1375 * @dev: input device the handle is attached to
1375 * @handler: handler that works with the device through this handle 1376 * @handler: handler that works with the device through this handle
1376 * @d_node: used to put the handle on device's list of attached handles 1377 * @d_node: used to put the handle on device's list of attached handles
1377 * @h_node: used to put the handle on handler's list of handles from which 1378 * @h_node: used to put the handle on handler's list of handles from which
1378 * it gets events 1379 * it gets events
1379 */ 1380 */
1380 struct input_handle { 1381 struct input_handle {
1381 1382
1382 void *private; 1383 void *private;
1383 1384
1384 int open; 1385 int open;
1385 const char *name; 1386 const char *name;
1386 1387
1387 struct input_dev *dev; 1388 struct input_dev *dev;
1388 struct input_handler *handler; 1389 struct input_handler *handler;
1389 1390
1390 struct list_head d_node; 1391 struct list_head d_node;
1391 struct list_head h_node; 1392 struct list_head h_node;
1392 }; 1393 };
1393 1394
1394 struct input_dev *input_allocate_device(void); 1395 struct input_dev *input_allocate_device(void);
1395 void input_free_device(struct input_dev *dev); 1396 void input_free_device(struct input_dev *dev);
1396 1397
1397 static inline struct input_dev *input_get_device(struct input_dev *dev) 1398 static inline struct input_dev *input_get_device(struct input_dev *dev)
1398 { 1399 {
1399 return dev ? to_input_dev(get_device(&dev->dev)) : NULL; 1400 return dev ? to_input_dev(get_device(&dev->dev)) : NULL;
1400 } 1401 }
1401 1402
1402 static inline void input_put_device(struct input_dev *dev) 1403 static inline void input_put_device(struct input_dev *dev)
1403 { 1404 {
1404 if (dev) 1405 if (dev)
1405 put_device(&dev->dev); 1406 put_device(&dev->dev);
1406 } 1407 }
1407 1408
1408 static inline void *input_get_drvdata(struct input_dev *dev) 1409 static inline void *input_get_drvdata(struct input_dev *dev)
1409 { 1410 {
1410 return dev_get_drvdata(&dev->dev); 1411 return dev_get_drvdata(&dev->dev);
1411 } 1412 }
1412 1413
1413 static inline void input_set_drvdata(struct input_dev *dev, void *data) 1414 static inline void input_set_drvdata(struct input_dev *dev, void *data)
1414 { 1415 {
1415 dev_set_drvdata(&dev->dev, data); 1416 dev_set_drvdata(&dev->dev, data);
1416 } 1417 }
1417 1418
1418 int __must_check input_register_device(struct input_dev *); 1419 int __must_check input_register_device(struct input_dev *);
1419 void input_unregister_device(struct input_dev *); 1420 void input_unregister_device(struct input_dev *);
1420 1421
1421 void input_reset_device(struct input_dev *); 1422 void input_reset_device(struct input_dev *);
1422 1423
1423 int __must_check input_register_handler(struct input_handler *); 1424 int __must_check input_register_handler(struct input_handler *);
1424 void input_unregister_handler(struct input_handler *); 1425 void input_unregister_handler(struct input_handler *);
1425 1426
1426 int input_handler_for_each_handle(struct input_handler *, void *data, 1427 int input_handler_for_each_handle(struct input_handler *, void *data,
1427 int (*fn)(struct input_handle *, void *)); 1428 int (*fn)(struct input_handle *, void *));
1428 1429
1429 int input_register_handle(struct input_handle *); 1430 int input_register_handle(struct input_handle *);
1430 void input_unregister_handle(struct input_handle *); 1431 void input_unregister_handle(struct input_handle *);
1431 1432
1432 int input_grab_device(struct input_handle *); 1433 int input_grab_device(struct input_handle *);
1433 void input_release_device(struct input_handle *); 1434 void input_release_device(struct input_handle *);
1434 1435
1435 int input_open_device(struct input_handle *); 1436 int input_open_device(struct input_handle *);
1436 void input_close_device(struct input_handle *); 1437 void input_close_device(struct input_handle *);
1437 1438
1438 int input_flush_device(struct input_handle *handle, struct file *file); 1439 int input_flush_device(struct input_handle *handle, struct file *file);
1439 1440
1440 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); 1441 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
1441 void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1442 void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1442 1443
1443 static inline void input_report_key(struct input_dev *dev, unsigned int code, int value) 1444 static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
1444 { 1445 {
1445 input_event(dev, EV_KEY, code, !!value); 1446 input_event(dev, EV_KEY, code, !!value);
1446 } 1447 }
1447 1448
1448 static inline void input_report_rel(struct input_dev *dev, unsigned int code, int value) 1449 static inline void input_report_rel(struct input_dev *dev, unsigned int code, int value)
1449 { 1450 {
1450 input_event(dev, EV_REL, code, value); 1451 input_event(dev, EV_REL, code, value);
1451 } 1452 }
1452 1453
1453 static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value) 1454 static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value)
1454 { 1455 {
1455 input_event(dev, EV_ABS, code, value); 1456 input_event(dev, EV_ABS, code, value);
1456 } 1457 }
1457 1458
1458 static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value) 1459 static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value)
1459 { 1460 {
1460 input_event(dev, EV_FF_STATUS, code, value); 1461 input_event(dev, EV_FF_STATUS, code, value);
1461 } 1462 }
1462 1463
1463 static inline void input_report_switch(struct input_dev *dev, unsigned int code, int value) 1464 static inline void input_report_switch(struct input_dev *dev, unsigned int code, int value)
1464 { 1465 {
1465 input_event(dev, EV_SW, code, !!value); 1466 input_event(dev, EV_SW, code, !!value);
1466 } 1467 }
1467 1468
1468 static inline void input_sync(struct input_dev *dev) 1469 static inline void input_sync(struct input_dev *dev)
1469 { 1470 {
1470 input_event(dev, EV_SYN, SYN_REPORT, 0); 1471 input_event(dev, EV_SYN, SYN_REPORT, 0);
1471 } 1472 }
1472 1473
1473 static inline void input_mt_sync(struct input_dev *dev) 1474 static inline void input_mt_sync(struct input_dev *dev)
1474 { 1475 {
1475 input_event(dev, EV_SYN, SYN_MT_REPORT, 0); 1476 input_event(dev, EV_SYN, SYN_MT_REPORT, 0);
1476 } 1477 }
1477 1478
1478 void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); 1479 void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1479 1480
1480 /** 1481 /**
1481 * input_set_events_per_packet - tell handlers about the driver event rate 1482 * input_set_events_per_packet - tell handlers about the driver event rate
1482 * @dev: the input device used by the driver 1483 * @dev: the input device used by the driver
1483 * @n_events: the average number of events between calls to input_sync() 1484 * @n_events: the average number of events between calls to input_sync()
1484 * 1485 *
1485 * If the event rate sent from a device is unusually large, use this 1486 * If the event rate sent from a device is unusually large, use this
1486 * function to set the expected event rate. This will allow handlers 1487 * function to set the expected event rate. This will allow handlers
1487 * to set up an appropriate buffer size for the event stream, in order 1488 * to set up an appropriate buffer size for the event stream, in order
1488 * to minimize information loss. 1489 * to minimize information loss.
1489 */ 1490 */
1490 static inline void input_set_events_per_packet(struct input_dev *dev, int n_events) 1491 static inline void input_set_events_per_packet(struct input_dev *dev, int n_events)
1491 { 1492 {
1492 dev->hint_events_per_packet = n_events; 1493 dev->hint_events_per_packet = n_events;
1493 } 1494 }
1494 1495
1495 void input_alloc_absinfo(struct input_dev *dev); 1496 void input_alloc_absinfo(struct input_dev *dev);
1496 void input_set_abs_params(struct input_dev *dev, unsigned int axis, 1497 void input_set_abs_params(struct input_dev *dev, unsigned int axis,
1497 int min, int max, int fuzz, int flat); 1498 int min, int max, int fuzz, int flat);
1498 1499
1499 #define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \ 1500 #define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \
1500 static inline int input_abs_get_##_suffix(struct input_dev *dev, \ 1501 static inline int input_abs_get_##_suffix(struct input_dev *dev, \
1501 unsigned int axis) \ 1502 unsigned int axis) \
1502 { \ 1503 { \
1503 return dev->absinfo ? dev->absinfo[axis]._item : 0; \ 1504 return dev->absinfo ? dev->absinfo[axis]._item : 0; \
1504 } \ 1505 } \
1505 \ 1506 \
1506 static inline void input_abs_set_##_suffix(struct input_dev *dev, \ 1507 static inline void input_abs_set_##_suffix(struct input_dev *dev, \
1507 unsigned int axis, int val) \ 1508 unsigned int axis, int val) \
1508 { \ 1509 { \
1509 input_alloc_absinfo(dev); \ 1510 input_alloc_absinfo(dev); \
1510 if (dev->absinfo) \ 1511 if (dev->absinfo) \
1511 dev->absinfo[axis]._item = val; \ 1512 dev->absinfo[axis]._item = val; \
1512 } 1513 }
1513 1514
1514 INPUT_GENERATE_ABS_ACCESSORS(val, value) 1515 INPUT_GENERATE_ABS_ACCESSORS(val, value)
1515 INPUT_GENERATE_ABS_ACCESSORS(min, minimum) 1516 INPUT_GENERATE_ABS_ACCESSORS(min, minimum)
1516 INPUT_GENERATE_ABS_ACCESSORS(max, maximum) 1517 INPUT_GENERATE_ABS_ACCESSORS(max, maximum)
1517 INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz) 1518 INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz)
1518 INPUT_GENERATE_ABS_ACCESSORS(flat, flat) 1519 INPUT_GENERATE_ABS_ACCESSORS(flat, flat)
1519 INPUT_GENERATE_ABS_ACCESSORS(res, resolution) 1520 INPUT_GENERATE_ABS_ACCESSORS(res, resolution)
1520 1521
1521 int input_scancode_to_scalar(const struct input_keymap_entry *ke, 1522 int input_scancode_to_scalar(const struct input_keymap_entry *ke,
1522 unsigned int *scancode); 1523 unsigned int *scancode);
1523 1524
1524 int input_get_keycode(struct input_dev *dev, struct input_keymap_entry *ke); 1525 int input_get_keycode(struct input_dev *dev, struct input_keymap_entry *ke);
1525 int input_set_keycode(struct input_dev *dev, 1526 int input_set_keycode(struct input_dev *dev,
1526 const struct input_keymap_entry *ke); 1527 const struct input_keymap_entry *ke);
1527 1528
1528 extern struct class input_class; 1529 extern struct class input_class;
1529 1530
1530 /** 1531 /**
1531 * struct ff_device - force-feedback part of an input device 1532 * struct ff_device - force-feedback part of an input device
1532 * @upload: Called to upload an new effect into device 1533 * @upload: Called to upload an new effect into device
1533 * @erase: Called to erase an effect from device 1534 * @erase: Called to erase an effect from device
1534 * @playback: Called to request device to start playing specified effect 1535 * @playback: Called to request device to start playing specified effect
1535 * @set_gain: Called to set specified gain 1536 * @set_gain: Called to set specified gain
1536 * @set_autocenter: Called to auto-center device 1537 * @set_autocenter: Called to auto-center device
1537 * @destroy: called by input core when parent input device is being 1538 * @destroy: called by input core when parent input device is being
1538 * destroyed 1539 * destroyed
1539 * @private: driver-specific data, will be freed automatically 1540 * @private: driver-specific data, will be freed automatically
1540 * @ffbit: bitmap of force feedback capabilities truly supported by 1541 * @ffbit: bitmap of force feedback capabilities truly supported by
1541 * device (not emulated like ones in input_dev->ffbit) 1542 * device (not emulated like ones in input_dev->ffbit)
1542 * @mutex: mutex for serializing access to the device 1543 * @mutex: mutex for serializing access to the device
1543 * @max_effects: maximum number of effects supported by device 1544 * @max_effects: maximum number of effects supported by device
1544 * @effects: pointer to an array of effects currently loaded into device 1545 * @effects: pointer to an array of effects currently loaded into device
1545 * @effect_owners: array of effect owners; when file handle owning 1546 * @effect_owners: array of effect owners; when file handle owning
1546 * an effect gets closed the effect is automatically erased 1547 * an effect gets closed the effect is automatically erased
1547 * 1548 *
1548 * Every force-feedback device must implement upload() and playback() 1549 * Every force-feedback device must implement upload() and playback()
1549 * methods; erase() is optional. set_gain() and set_autocenter() need 1550 * methods; erase() is optional. set_gain() and set_autocenter() need
1550 * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER 1551 * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
1551 * bits. 1552 * bits.
1552 * 1553 *
1553 * Note that playback(), set_gain() and set_autocenter() are called with 1554 * Note that playback(), set_gain() and set_autocenter() are called with
1554 * dev->event_lock spinlock held and interrupts off and thus may not 1555 * dev->event_lock spinlock held and interrupts off and thus may not
1555 * sleep. 1556 * sleep.
1556 */ 1557 */
1557 struct ff_device { 1558 struct ff_device {
1558 int (*upload)(struct input_dev *dev, struct ff_effect *effect, 1559 int (*upload)(struct input_dev *dev, struct ff_effect *effect,
1559 struct ff_effect *old); 1560 struct ff_effect *old);
1560 int (*erase)(struct input_dev *dev, int effect_id); 1561 int (*erase)(struct input_dev *dev, int effect_id);
1561 1562
1562 int (*playback)(struct input_dev *dev, int effect_id, int value); 1563 int (*playback)(struct input_dev *dev, int effect_id, int value);
1563 void (*set_gain)(struct input_dev *dev, u16 gain); 1564 void (*set_gain)(struct input_dev *dev, u16 gain);
1564 void (*set_autocenter)(struct input_dev *dev, u16 magnitude); 1565 void (*set_autocenter)(struct input_dev *dev, u16 magnitude);
1565 1566
1566 void (*destroy)(struct ff_device *); 1567 void (*destroy)(struct ff_device *);
1567 1568
1568 void *private; 1569 void *private;
1569 1570
1570 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; 1571 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
1571 1572
1572 struct mutex mutex; 1573 struct mutex mutex;
1573 1574
1574 int max_effects; 1575 int max_effects;
1575 struct ff_effect *effects; 1576 struct ff_effect *effects;
1576 struct file *effect_owners[]; 1577 struct file *effect_owners[];
1577 }; 1578 };
1578 1579
1579 int input_ff_create(struct input_dev *dev, int max_effects); 1580 int input_ff_create(struct input_dev *dev, int max_effects);
1580 void input_ff_destroy(struct input_dev *dev); 1581 void input_ff_destroy(struct input_dev *dev);
1581 1582
1582 int input_ff_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); 1583 int input_ff_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
1583 1584
1584 int input_ff_upload(struct input_dev *dev, struct ff_effect *effect, struct file *file); 1585 int input_ff_upload(struct input_dev *dev, struct ff_effect *effect, struct file *file);
1585 int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file); 1586 int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
1586 1587
1587 int input_ff_create_memless(struct input_dev *dev, void *data, 1588 int input_ff_create_memless(struct input_dev *dev, void *data,
1588 int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); 1589 int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
1589 1590
1590 #endif 1591 #endif
1591 #endif 1592 #endif
1592 1593