• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2003-2010  Marcel Holtmann <marcel@holtmann.org>
6  *
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23 
24 #ifndef __UINPUT_H
25 #define __UINPUT_H
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include <stdint.h>
32 #include <sys/time.h>
33 #include <sys/ioctl.h>
34 
35 /* Events */
36 
37 #define EV_SYN			0x00
38 #define EV_KEY			0x01
39 #define EV_REL			0x02
40 #define EV_ABS			0x03
41 #define EV_MSC			0x04
42 #define EV_LED			0x11
43 #define EV_SND			0x12
44 #define EV_REP			0x14
45 #define EV_FF			0x15
46 #define EV_PWR			0x16
47 #define EV_FF_STATUS		0x17
48 #define EV_MAX			0x1f
49 
50 /* Synchronization events */
51 
52 #define SYN_REPORT		0
53 #define SYN_CONFIG		1
54 
55 /*
56  * Keys and buttons
57  *
58  * Most of the keys/buttons are modeled after USB HUT 1.12
59  * (see http://www.usb.org/developers/hidpage).
60  * Abbreviations in the comments:
61  * AC - Application Control
62  * AL - Application Launch Button
63  * SC - System Control
64  */
65 
66 #define KEY_RESERVED		0
67 #define KEY_ESC			1
68 #define KEY_1			2
69 #define KEY_2			3
70 #define KEY_3			4
71 #define KEY_4			5
72 #define KEY_5			6
73 #define KEY_6			7
74 #define KEY_7			8
75 #define KEY_8			9
76 #define KEY_9			10
77 #define KEY_0			11
78 #define KEY_MINUS		12
79 #define KEY_EQUAL		13
80 #define KEY_BACKSPACE		14
81 #define KEY_TAB			15
82 #define KEY_Q			16
83 #define KEY_W			17
84 #define KEY_E			18
85 #define KEY_R			19
86 #define KEY_T			20
87 #define KEY_Y			21
88 #define KEY_U			22
89 #define KEY_I			23
90 #define KEY_O			24
91 #define KEY_P			25
92 #define KEY_LEFTBRACE		26
93 #define KEY_RIGHTBRACE		27
94 #define KEY_ENTER		28
95 #define KEY_LEFTCTRL		29
96 #define KEY_A			30
97 #define KEY_S			31
98 #define KEY_D			32
99 #define KEY_F			33
100 #define KEY_G			34
101 #define KEY_H			35
102 #define KEY_J			36
103 #define KEY_K			37
104 #define KEY_L			38
105 #define KEY_SEMICOLON		39
106 #define KEY_APOSTROPHE		40
107 #define KEY_GRAVE		41
108 #define KEY_LEFTSHIFT		42
109 #define KEY_BACKSLASH		43
110 #define KEY_Z			44
111 #define KEY_X			45
112 #define KEY_C			46
113 #define KEY_V			47
114 #define KEY_B			48
115 #define KEY_N			49
116 #define KEY_M			50
117 #define KEY_COMMA		51
118 #define KEY_DOT			52
119 #define KEY_SLASH		53
120 #define KEY_RIGHTSHIFT		54
121 #define KEY_KPASTERISK		55
122 #define KEY_LEFTALT		56
123 #define KEY_SPACE		57
124 #define KEY_CAPSLOCK		58
125 #define KEY_F1			59
126 #define KEY_F2			60
127 #define KEY_F3			61
128 #define KEY_F4			62
129 #define KEY_F5			63
130 #define KEY_F6			64
131 #define KEY_F7			65
132 #define KEY_F8			66
133 #define KEY_F9			67
134 #define KEY_F10			68
135 #define KEY_NUMLOCK		69
136 #define KEY_SCROLLLOCK		70
137 #define KEY_KP7			71
138 #define KEY_KP8			72
139 #define KEY_KP9			73
140 #define KEY_KPMINUS		74
141 #define KEY_KP4			75
142 #define KEY_KP5			76
143 #define KEY_KP6			77
144 #define KEY_KPPLUS		78
145 #define KEY_KP1			79
146 #define KEY_KP2			80
147 #define KEY_KP3			81
148 #define KEY_KP0			82
149 #define KEY_KPDOT		83
150 
151 #define KEY_ZENKAKUHANKAKU	85
152 #define KEY_102ND		86
153 #define KEY_F11			87
154 #define KEY_F12			88
155 #define KEY_RO			89
156 #define KEY_KATAKANA		90
157 #define KEY_HIRAGANA		91
158 #define KEY_HENKAN		92
159 #define KEY_KATAKANAHIRAGANA	93
160 #define KEY_MUHENKAN		94
161 #define KEY_KPJPCOMMA		95
162 #define KEY_KPENTER		96
163 #define KEY_RIGHTCTRL		97
164 #define KEY_KPSLASH		98
165 #define KEY_SYSRQ		99
166 #define KEY_RIGHTALT		100
167 #define KEY_LINEFEED		101
168 #define KEY_HOME		102
169 #define KEY_UP			103
170 #define KEY_PAGEUP		104
171 #define KEY_LEFT		105
172 #define KEY_RIGHT		106
173 #define KEY_END			107
174 #define KEY_DOWN		108
175 #define KEY_PAGEDOWN		109
176 #define KEY_INSERT		110
177 #define KEY_DELETE		111
178 #define KEY_MACRO		112
179 #define KEY_MUTE		113
180 #define KEY_VOLUMEDOWN		114
181 #define KEY_VOLUMEUP		115
182 #define KEY_POWER		116	/* SC System Power Down */
183 #define KEY_KPEQUAL		117
184 #define KEY_KPPLUSMINUS		118
185 #define KEY_PAUSE		119
186 
187 #define KEY_KPCOMMA		121
188 #define KEY_HANGEUL		122
189 #define KEY_HANGUEL		KEY_HANGEUL
190 #define KEY_HANJA		123
191 #define KEY_YEN			124
192 #define KEY_LEFTMETA		125
193 #define KEY_RIGHTMETA		126
194 #define KEY_COMPOSE		127
195 
196 #define KEY_STOP		128	/* AC Stop */
197 #define KEY_AGAIN		129
198 #define KEY_PROPS		130	/* AC Properties */
199 #define KEY_UNDO		131	/* AC Undo */
200 #define KEY_FRONT		132
201 #define KEY_COPY		133	/* AC Copy */
202 #define KEY_OPEN		134	/* AC Open */
203 #define KEY_PASTE		135	/* AC Paste */
204 #define KEY_FIND		136	/* AC Search */
205 #define KEY_CUT			137	/* AC Cut */
206 #define KEY_HELP		138	/* AL Integrated Help Center */
207 #define KEY_MENU		139	/* Menu (show menu) */
208 #define KEY_CALC		140	/* AL Calculator */
209 #define KEY_SETUP		141
210 #define KEY_SLEEP		142	/* SC System Sleep */
211 #define KEY_WAKEUP		143	/* System Wake Up */
212 #define KEY_FILE		144	/* AL Local Machine Browser */
213 #define KEY_SENDFILE		145
214 #define KEY_DELETEFILE		146
215 #define KEY_XFER		147
216 #define KEY_PROG1		148
217 #define KEY_PROG2		149
218 #define KEY_WWW			150	/* AL Internet Browser */
219 #define KEY_MSDOS		151
220 #define KEY_COFFEE		152	/* AL Terminal Lock/Screensaver */
221 #define KEY_SCREENLOCK		KEY_COFFEE
222 #define KEY_DIRECTION		153
223 #define KEY_CYCLEWINDOWS	154
224 #define KEY_MAIL		155
225 #define KEY_BOOKMARKS		156	/* AC Bookmarks */
226 #define KEY_COMPUTER		157
227 #define KEY_BACK		158	/* AC Back */
228 #define KEY_FORWARD		159	/* AC Forward */
229 #define KEY_CLOSECD		160
230 #define KEY_EJECTCD		161
231 #define KEY_EJECTCLOSECD	162
232 #define KEY_NEXTSONG		163
233 #define KEY_PLAYPAUSE		164
234 #define KEY_PREVIOUSSONG	165
235 #define KEY_STOPCD		166
236 #define KEY_RECORD		167
237 #define KEY_REWIND		168
238 #define KEY_PHONE		169	/* Media Select Telephone */
239 #define KEY_ISO			170
240 #define KEY_CONFIG		171	/* AL Consumer Control Configuration */
241 #define KEY_HOMEPAGE		172	/* AC Home */
242 #define KEY_REFRESH		173	/* AC Refresh */
243 #define KEY_EXIT		174	/* AC Exit */
244 #define KEY_MOVE		175
245 #define KEY_EDIT		176
246 #define KEY_SCROLLUP		177
247 #define KEY_SCROLLDOWN		178
248 #define KEY_KPLEFTPAREN		179
249 #define KEY_KPRIGHTPAREN	180
250 #define KEY_NEW			181	/* AC New */
251 #define KEY_REDO		182	/* AC Redo/Repeat */
252 
253 #define KEY_F13			183
254 #define KEY_F14			184
255 #define KEY_F15			185
256 #define KEY_F16			186
257 #define KEY_F17			187
258 #define KEY_F18			188
259 #define KEY_F19			189
260 #define KEY_F20			190
261 #define KEY_F21			191
262 #define KEY_F22			192
263 #define KEY_F23			193
264 #define KEY_F24			194
265 
266 #define KEY_PLAYCD		200
267 #define KEY_PAUSECD		201
268 #define KEY_PROG3		202
269 #define KEY_PROG4		203
270 #define KEY_SUSPEND		205
271 #define KEY_CLOSE		206	/* AC Close */
272 #define KEY_PLAY		207
273 #define KEY_FASTFORWARD		208
274 #define KEY_BASSBOOST		209
275 #define KEY_PRINT		210	/* AC Print */
276 #define KEY_HP			211
277 #define KEY_CAMERA		212
278 #define KEY_SOUND		213
279 #define KEY_QUESTION		214
280 #define KEY_EMAIL		215
281 #define KEY_CHAT		216
282 #define KEY_SEARCH		217
283 #define KEY_CONNECT		218
284 #define KEY_FINANCE		219	/* AL Checkbook/Finance */
285 #define KEY_SPORT		220
286 #define KEY_SHOP		221
287 #define KEY_ALTERASE		222
288 #define KEY_CANCEL		223	/* AC Cancel */
289 #define KEY_BRIGHTNESSDOWN	224
290 #define KEY_BRIGHTNESSUP	225
291 #define KEY_MEDIA		226
292 
293 #define KEY_SWITCHVIDEOMODE	227	/* Cycle between available video
294 					   outputs (Monitor/LCD/TV-out/etc) */
295 #define KEY_KBDILLUMTOGGLE	228
296 #define KEY_KBDILLUMDOWN	229
297 #define KEY_KBDILLUMUP		230
298 
299 #define KEY_SEND		231	/* AC Send */
300 #define KEY_REPLY		232	/* AC Reply */
301 #define KEY_FORWARDMAIL		233	/* AC Forward Msg */
302 #define KEY_SAVE		234	/* AC Save */
303 #define KEY_DOCUMENTS		235
304 
305 #define KEY_BATTERY		236
306 
307 #define KEY_BLUETOOTH		237
308 #define KEY_WLAN		238
309 #define KEY_UWB			239
310 
311 #define KEY_UNKNOWN		240
312 
313 #define KEY_VIDEO_NEXT		241	/* drive next video source */
314 #define KEY_VIDEO_PREV		242	/* drive previous video source */
315 #define KEY_BRIGHTNESS_CYCLE	243	/* brightness up, after max is min */
316 #define KEY_BRIGHTNESS_ZERO	244	/* brightness off, use ambient */
317 #define KEY_DISPLAY_OFF		245	/* display device to off state */
318 
319 #define KEY_WIMAX		246
320 
321 /* Range 248 - 255 is reserved for special needs of AT keyboard driver */
322 
323 #define BTN_MISC		0x100
324 #define BTN_0			0x100
325 #define BTN_1			0x101
326 #define BTN_2			0x102
327 #define BTN_3			0x103
328 #define BTN_4			0x104
329 #define BTN_5			0x105
330 #define BTN_6			0x106
331 #define BTN_7			0x107
332 #define BTN_8			0x108
333 #define BTN_9			0x109
334 
335 #define BTN_MOUSE		0x110
336 #define BTN_LEFT		0x110
337 #define BTN_RIGHT		0x111
338 #define BTN_MIDDLE		0x112
339 #define BTN_SIDE		0x113
340 #define BTN_EXTRA		0x114
341 #define BTN_FORWARD		0x115
342 #define BTN_BACK		0x116
343 #define BTN_TASK		0x117
344 
345 #define BTN_JOYSTICK		0x120
346 #define BTN_TRIGGER		0x120
347 #define BTN_THUMB		0x121
348 #define BTN_THUMB2		0x122
349 #define BTN_TOP			0x123
350 #define BTN_TOP2		0x124
351 #define BTN_PINKIE		0x125
352 #define BTN_BASE		0x126
353 #define BTN_BASE2		0x127
354 #define BTN_BASE3		0x128
355 #define BTN_BASE4		0x129
356 #define BTN_BASE5		0x12a
357 #define BTN_BASE6		0x12b
358 #define BTN_DEAD		0x12f
359 
360 #define BTN_GAMEPAD		0x130
361 #define BTN_A			0x130
362 #define BTN_B			0x131
363 #define BTN_C			0x132
364 #define BTN_X			0x133
365 #define BTN_Y			0x134
366 #define BTN_Z			0x135
367 #define BTN_TL			0x136
368 #define BTN_TR			0x137
369 #define BTN_TL2			0x138
370 #define BTN_TR2			0x139
371 #define BTN_SELECT		0x13a
372 #define BTN_START		0x13b
373 #define BTN_MODE		0x13c
374 #define BTN_THUMBL		0x13d
375 #define BTN_THUMBR		0x13e
376 
377 #define BTN_DIGI		0x140
378 #define BTN_TOOL_PEN		0x140
379 #define BTN_TOOL_RUBBER		0x141
380 #define BTN_TOOL_BRUSH		0x142
381 #define BTN_TOOL_PENCIL		0x143
382 #define BTN_TOOL_AIRBRUSH	0x144
383 #define BTN_TOOL_FINGER		0x145
384 #define BTN_TOOL_MOUSE		0x146
385 #define BTN_TOOL_LENS		0x147
386 #define BTN_TOUCH		0x14a
387 #define BTN_STYLUS		0x14b
388 #define BTN_STYLUS2		0x14c
389 #define BTN_TOOL_DOUBLETAP	0x14d
390 #define BTN_TOOL_TRIPLETAP	0x14e
391 
392 #define BTN_WHEEL		0x150
393 #define BTN_GEAR_DOWN		0x150
394 #define BTN_GEAR_UP		0x151
395 
396 #define KEY_OK			0x160
397 #define KEY_SELECT		0x161
398 #define KEY_GOTO		0x162
399 #define KEY_CLEAR		0x163
400 #define KEY_POWER2		0x164
401 #define KEY_OPTION		0x165
402 #define KEY_INFO		0x166	/* AL OEM Features/Tips/Tutorial */
403 #define KEY_TIME		0x167
404 #define KEY_VENDOR		0x168
405 #define KEY_ARCHIVE		0x169
406 #define KEY_PROGRAM		0x16a	/* Media Select Program Guide */
407 #define KEY_CHANNEL		0x16b
408 #define KEY_FAVORITES		0x16c
409 #define KEY_EPG			0x16d
410 #define KEY_PVR			0x16e	/* Media Select Home */
411 #define KEY_MHP			0x16f
412 #define KEY_LANGUAGE		0x170
413 #define KEY_TITLE		0x171
414 #define KEY_SUBTITLE		0x172
415 #define KEY_ANGLE		0x173
416 #define KEY_ZOOM		0x174
417 #define KEY_MODE		0x175
418 #define KEY_KEYBOARD		0x176
419 #define KEY_SCREEN		0x177
420 #define KEY_PC			0x178	/* Media Select Computer */
421 #define KEY_TV			0x179	/* Media Select TV */
422 #define KEY_TV2			0x17a	/* Media Select Cable */
423 #define KEY_VCR			0x17b	/* Media Select VCR */
424 #define KEY_VCR2		0x17c	/* VCR Plus */
425 #define KEY_SAT			0x17d	/* Media Select Satellite */
426 #define KEY_SAT2		0x17e
427 #define KEY_CD			0x17f	/* Media Select CD */
428 #define KEY_TAPE		0x180	/* Media Select Tape */
429 #define KEY_RADIO		0x181
430 #define KEY_TUNER		0x182	/* Media Select Tuner */
431 #define KEY_PLAYER		0x183
432 #define KEY_TEXT		0x184
433 #define KEY_DVD			0x185	/* Media Select DVD */
434 #define KEY_AUX			0x186
435 #define KEY_MP3			0x187
436 #define KEY_AUDIO		0x188
437 #define KEY_VIDEO		0x189
438 #define KEY_DIRECTORY		0x18a
439 #define KEY_LIST		0x18b
440 #define KEY_MEMO		0x18c	/* Media Select Messages */
441 #define KEY_CALENDAR		0x18d
442 #define KEY_RED			0x18e
443 #define KEY_GREEN		0x18f
444 #define KEY_YELLOW		0x190
445 #define KEY_BLUE		0x191
446 #define KEY_CHANNELUP		0x192	/* Channel Increment */
447 #define KEY_CHANNELDOWN		0x193	/* Channel Decrement */
448 #define KEY_FIRST		0x194
449 #define KEY_LAST		0x195	/* Recall Last */
450 #define KEY_AB			0x196
451 #define KEY_NEXT		0x197
452 #define KEY_RESTART		0x198
453 #define KEY_SLOW		0x199
454 #define KEY_SHUFFLE		0x19a
455 #define KEY_BREAK		0x19b
456 #define KEY_PREVIOUS		0x19c
457 #define KEY_DIGITS		0x19d
458 #define KEY_TEEN		0x19e
459 #define KEY_TWEN		0x19f
460 #define KEY_VIDEOPHONE		0x1a0	/* Media Select Video Phone */
461 #define KEY_GAMES		0x1a1	/* Media Select Games */
462 #define KEY_ZOOMIN		0x1a2	/* AC Zoom In */
463 #define KEY_ZOOMOUT		0x1a3	/* AC Zoom Out */
464 #define KEY_ZOOMRESET		0x1a4	/* AC Zoom */
465 #define KEY_WORDPROCESSOR	0x1a5	/* AL Word Processor */
466 #define KEY_EDITOR		0x1a6	/* AL Text Editor */
467 #define KEY_SPREADSHEET		0x1a7	/* AL Spreadsheet */
468 #define KEY_GRAPHICSEDITOR	0x1a8	/* AL Graphics Editor */
469 #define KEY_PRESENTATION	0x1a9	/* AL Presentation App */
470 #define KEY_DATABASE		0x1aa	/* AL Database App */
471 #define KEY_NEWS		0x1ab	/* AL Newsreader */
472 #define KEY_VOICEMAIL		0x1ac	/* AL Voicemail */
473 #define KEY_ADDRESSBOOK		0x1ad	/* AL Contacts/Address Book */
474 #define KEY_MESSENGER		0x1ae	/* AL Instant Messaging */
475 #define KEY_DISPLAYTOGGLE	0x1af	/* Turn display (LCD) on and off */
476 #define KEY_SPELLCHECK		0x1b0   /* AL Spell Check */
477 #define KEY_LOGOFF		0x1b1   /* AL Logoff */
478 
479 #define KEY_DOLLAR		0x1b2
480 #define KEY_EURO		0x1b3
481 
482 #define KEY_FRAMEBACK		0x1b4	/* Consumer - transport controls */
483 #define KEY_FRAMEFORWARD	0x1b5
484 #define KEY_CONTEXT_MENU	0x1b6	/* GenDesc - system context menu */
485 #define KEY_MEDIA_REPEAT	0x1b7	/* Consumer - transport control */
486 
487 #define KEY_DEL_EOL		0x1c0
488 #define KEY_DEL_EOS		0x1c1
489 #define KEY_INS_LINE		0x1c2
490 #define KEY_DEL_LINE		0x1c3
491 
492 #define KEY_FN			0x1d0
493 #define KEY_FN_ESC		0x1d1
494 #define KEY_FN_F1		0x1d2
495 #define KEY_FN_F2		0x1d3
496 #define KEY_FN_F3		0x1d4
497 #define KEY_FN_F4		0x1d5
498 #define KEY_FN_F5		0x1d6
499 #define KEY_FN_F6		0x1d7
500 #define KEY_FN_F7		0x1d8
501 #define KEY_FN_F8		0x1d9
502 #define KEY_FN_F9		0x1da
503 #define KEY_FN_F10		0x1db
504 #define KEY_FN_F11		0x1dc
505 #define KEY_FN_F12		0x1dd
506 #define KEY_FN_1		0x1de
507 #define KEY_FN_2		0x1df
508 #define KEY_FN_D		0x1e0
509 #define KEY_FN_E		0x1e1
510 #define KEY_FN_F		0x1e2
511 #define KEY_FN_S		0x1e3
512 #define KEY_FN_B		0x1e4
513 
514 #define KEY_BRL_DOT1		0x1f1
515 #define KEY_BRL_DOT2		0x1f2
516 #define KEY_BRL_DOT3		0x1f3
517 #define KEY_BRL_DOT4		0x1f4
518 #define KEY_BRL_DOT5		0x1f5
519 #define KEY_BRL_DOT6		0x1f6
520 #define KEY_BRL_DOT7		0x1f7
521 #define KEY_BRL_DOT8		0x1f8
522 #define KEY_BRL_DOT9		0x1f9
523 #define KEY_BRL_DOT10		0x1fa
524 
525 /* We avoid low common keys in module aliases so they don't get huge. */
526 #define KEY_MIN_INTERESTING	KEY_MUTE
527 #define KEY_MAX			0x1ff
528 #define KEY_CNT			(KEY_MAX+1)
529 
530 /*
531  * Relative axes
532  */
533 
534 #define REL_X			0x00
535 #define REL_Y			0x01
536 #define REL_Z			0x02
537 #define REL_RX			0x03
538 #define REL_RY			0x04
539 #define REL_RZ			0x05
540 #define REL_HWHEEL		0x06
541 #define REL_DIAL		0x07
542 #define REL_WHEEL		0x08
543 #define REL_MISC		0x09
544 #define REL_MAX			0x0f
545 #define REL_CNT			(REL_MAX+1)
546 
547 /*
548  * Absolute axes
549  */
550 
551 #define ABS_X			0x00
552 #define ABS_Y			0x01
553 #define ABS_Z			0x02
554 #define ABS_RX			0x03
555 #define ABS_RY			0x04
556 #define ABS_RZ			0x05
557 #define ABS_THROTTLE		0x06
558 #define ABS_RUDDER		0x07
559 #define ABS_WHEEL		0x08
560 #define ABS_GAS			0x09
561 #define ABS_BRAKE		0x0a
562 #define ABS_HAT0X		0x10
563 #define ABS_HAT0Y		0x11
564 #define ABS_HAT1X		0x12
565 #define ABS_HAT1Y		0x13
566 #define ABS_HAT2X		0x14
567 #define ABS_HAT2Y		0x15
568 #define ABS_HAT3X		0x16
569 #define ABS_HAT3Y		0x17
570 #define ABS_PRESSURE		0x18
571 #define ABS_DISTANCE		0x19
572 #define ABS_TILT_X		0x1a
573 #define ABS_TILT_Y		0x1b
574 #define ABS_TOOL_WIDTH		0x1c
575 #define ABS_VOLUME		0x20
576 #define ABS_MISC		0x28
577 #define ABS_MAX			0x3f
578 #define ABS_CNT			(ABS_MAX+1)
579 
580 /*
581  * Switch events
582  */
583 
584 #define SW_LID			0x00  /* set = lid shut */
585 #define SW_TABLET_MODE		0x01  /* set = tablet mode */
586 #define SW_HEADPHONE_INSERT	0x02  /* set = inserted */
587 #define SW_RFKILL_ALL		0x03  /* rfkill master switch, type "any"
588 					 set = radio enabled */
589 #define SW_RADIO		SW_RFKILL_ALL	/* deprecated */
590 #define SW_MICROPHONE_INSERT	0x04  /* set = inserted */
591 #define SW_DOCK			0x05  /* set = plugged into dock */
592 #define SW_MAX			0x0f
593 #define SW_CNT			(SW_MAX+1)
594 
595 /*
596  * Misc events
597  */
598 
599 #define MSC_SERIAL		0x00
600 #define MSC_PULSELED		0x01
601 #define MSC_GESTURE		0x02
602 #define MSC_RAW			0x03
603 #define MSC_SCAN		0x04
604 #define MSC_MAX			0x07
605 #define MSC_CNT			(MSC_MAX+1)
606 
607 /*
608  * LEDs
609  */
610 
611 #define LED_NUML		0x00
612 #define LED_CAPSL		0x01
613 #define LED_SCROLLL		0x02
614 #define LED_COMPOSE		0x03
615 #define LED_KANA		0x04
616 #define LED_SLEEP		0x05
617 #define LED_SUSPEND		0x06
618 #define LED_MUTE		0x07
619 #define LED_MISC		0x08
620 #define LED_MAIL		0x09
621 #define LED_CHARGING		0x0a
622 #define LED_MAX			0x0f
623 #define LED_CNT			(LED_MAX+1)
624 
625 /*
626  * Autorepeat values
627  */
628 
629 #define REP_DELAY		0x00
630 #define REP_PERIOD		0x01
631 #define REP_MAX			0x01
632 
633 /*
634  * Sounds
635  */
636 
637 #define SND_CLICK		0x00
638 #define SND_BELL		0x01
639 #define SND_TONE		0x02
640 #define SND_MAX			0x07
641 #define SND_CNT			(SND_MAX+1)
642 
643 /*
644  * IDs.
645  */
646 
647 #define ID_BUS			0
648 #define ID_VENDOR		1
649 #define ID_PRODUCT		2
650 #define ID_VERSION		3
651 
652 #define BUS_PCI			0x01
653 #define BUS_ISAPNP		0x02
654 #define BUS_USB			0x03
655 #define BUS_HIL			0x04
656 #define BUS_BLUETOOTH		0x05
657 #define BUS_VIRTUAL		0x06
658 
659 #define BUS_ISA			0x10
660 #define BUS_I8042		0x11
661 #define BUS_XTKBD		0x12
662 #define BUS_RS232		0x13
663 #define BUS_GAMEPORT		0x14
664 #define BUS_PARPORT		0x15
665 #define BUS_AMIGA		0x16
666 #define BUS_ADB			0x17
667 #define BUS_I2C			0x18
668 #define BUS_HOST		0x19
669 #define BUS_GSC			0x1A
670 #define BUS_ATARI		0x1B
671 
672 /* User input interface */
673 
674 #define UINPUT_IOCTL_BASE	'U'
675 
676 #define UI_DEV_CREATE		_IO(UINPUT_IOCTL_BASE, 1)
677 #define UI_DEV_DESTROY		_IO(UINPUT_IOCTL_BASE, 2)
678 
679 #define UI_SET_EVBIT		_IOW(UINPUT_IOCTL_BASE, 100, int)
680 #define UI_SET_KEYBIT		_IOW(UINPUT_IOCTL_BASE, 101, int)
681 #define UI_SET_RELBIT		_IOW(UINPUT_IOCTL_BASE, 102, int)
682 #define UI_SET_ABSBIT		_IOW(UINPUT_IOCTL_BASE, 103, int)
683 #define UI_SET_MSCBIT		_IOW(UINPUT_IOCTL_BASE, 104, int)
684 #define UI_SET_LEDBIT		_IOW(UINPUT_IOCTL_BASE, 105, int)
685 #define UI_SET_SNDBIT		_IOW(UINPUT_IOCTL_BASE, 106, int)
686 #define UI_SET_FFBIT		_IOW(UINPUT_IOCTL_BASE, 107, int)
687 #define UI_SET_PHYS		_IOW(UINPUT_IOCTL_BASE, 108, char*)
688 #define UI_SET_SWBIT		_IOW(UINPUT_IOCTL_BASE, 109, int)
689 
690 #ifndef NBITS
691 #define NBITS(x) ((((x) - 1) / (sizeof(long) * 8)) + 1)
692 #endif
693 
694 #define UINPUT_MAX_NAME_SIZE	80
695 
696 struct uinput_id {
697 	uint16_t bustype;
698 	uint16_t vendor;
699 	uint16_t product;
700 	uint16_t version;
701 };
702 
703 struct uinput_dev {
704 	char name[UINPUT_MAX_NAME_SIZE];
705 	struct uinput_id id;
706 	int ff_effects_max;
707 	int absmax[ABS_MAX + 1];
708 	int absmin[ABS_MAX + 1];
709 	int absfuzz[ABS_MAX + 1];
710 	int absflat[ABS_MAX + 1];
711 };
712 
713 struct uinput_event {
714 	struct timeval time;
715 	uint16_t type;
716 	uint16_t code;
717 	int32_t value;
718 };
719 
720 #ifdef __cplusplus
721 }
722 #endif
723 
724 #endif /* __UINPUT_H */
725