• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Lint as: python2, python3
2# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6# Description:
7#
8# Python version of include/linux/input.h
9#  as of kernel v2.6.39
10
11from __future__ import division
12from __future__ import print_function
13from six.moves import range
14
15# Try to import from the autotest_lib structure. If it fails try the default.
16# If this script was run outside of autotest the "except" would be the flow.
17# If run within, the "try" is the flow.
18try:
19    from autotest_lib.client.bin.input.linux_ioctl import *
20except ImportError:
21    from linux_ioctl import *
22
23# The event structure itself
24#   struct input_event {
25#       struct timeval time;
26#       __u16 type;
27#       __u16 code;
28#       __s32 value;
29#   };
30#
31#   struct timeval {
32#       __kernel_time_t         tv_sec;         /* seconds */
33#       __kernel_suseconds_t    tv_usec;        /* microseconds */
34#   };
35input_event_t = 'LLHHi'
36
37
38# Protocol version.
39EV_VERSION = 0x010001
40
41# IOCTLs (0x00 - 0x7f)
42
43#   struct input_id {
44#       __u16 bustype;
45#       __u16 vendor;
46#       __u16 product;
47#       __u16 version;
48#   };
49input_id_t = 'HHHH'
50
51# struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
52# @value: latest reported value for the axis.
53# @minimum: specifies minimum value for the axis.
54# @maximum: specifies maximum value for the axis.
55# @fuzz: specifies fuzz value used to filter noise from the event stream.
56# @flat: values within this value are reported as 0.
57# @resolution: specifies resolution for the values reported for the axis.
58#
59# Note that input core does not clamp reported values to the
60# [minimum, maximum] limits, such task is left to userspace.
61#
62# Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in
63# units per millimeter (units/mm), resolution for rotational axes
64# (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
65#
66#   struct input_absinfo {
67#       __s32 value;
68#       __s32 minimum;
69#       __s32 maximum;
70#       __s32 fuzz;
71#       __s32 flat;
72#       __s32 resolution;
73#   };
74input_absinfo_t = 'iiiiii'
75
76# struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls
77# @scancode: scancode represented in machine-endian form.
78# @len: length of the scancode that resides in @scancode buffer.
79# @index: index in the keymap, may be used instead of scancode
80# @flags: allows to specify how kernel should handle the request. For
81# example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel
82# should perform lookup in keymap by @index instead of @scancode
83# @keycode: key code assigned to this scancode
84#
85# The structure is used to retrieve and modify keymap data. Users have
86# option of performing lookup either by @scancode itself or by @index
87# in keymap entry. EVIOCGKEYCODE will also return scancode or index
88# (depending on which element was used to perform lookup).
89#
90#   struct input_keymap_entry {
91#       __u8  flags;
92#       __u8  len;
93#       __u16 index;
94#       __u32 keycode;
95#       __u8  scancode[32];
96#   };
97input_keymap_entry_t = 'BBHI32B'
98
99EVIOCGVERSION           = IOR('E', 0x01, 'i')           # get driver version
100EVIOCGID                = IOR('E', 0x02, input_id_t)    # get device ID
101EVIOCGREP               = IOR('E', 0x03, '2I')          # get repeat settings
102EVIOCSREP               = IOW('E', 0x03, '2I')          # set repeat settings
103
104EVIOCGKEYCODE           = IOR('E', 0x04, '2I')          # get keycode
105EVIOCGKEYCODE_V2        = IOR('E', 0x04, input_keymap_entry_t)
106EVIOCSKEYCODE           = IOW('E', 0x04, '2I')          # set keycode
107EVIOCSKEYCODE_V2        = IOW('E', 0x04, input_keymap_entry_t)
108
109def EVIOCGNAME(length):
110    return IOC(IOC_READ, 'E', 0x06, length)  # get device name
111
112def EVIOCGPHYS(length):
113    return IOC(IOC_READ, 'E', 0x07, length)  # get physical location
114
115def EVIOCGUNIQ(length):
116    return IOC(IOC_READ, 'E', 0x08, length)  # get unique identifier
117
118def EVIOCGPROP(length):
119    return IOC(IOC_READ, 'E', 0x09, length)  # get device properties
120
121def EVIOCGMTSLOTS(length):
122    return IOC(IOC_READ, 'E', 0x0a, length)  # get mt slot values
123
124def EVIOCGKEY(length):
125    return IOC(IOC_READ, 'E', 0x18, length)  # get global key state
126
127def EVIOCGLED(length):
128    return IOC(IOC_READ, 'E', 0x19, length)  # get all LEDs
129
130def EVIOCGSND(length):
131    return IOC(IOC_READ, 'E', 0x1a, length)  # get all sounds status
132
133def EVIOCGSW(length):
134    return IOC(IOC_READ, 'E', 0x1b, length)  # get all switch states
135
136def EVIOCGBIT(ev,length):
137    return IOC(IOC_READ, 'E', 0x20 + ev, length)  # get event bits
138
139def EVIOCGABS(axis):
140    return IOR('E', 0x40 + axis, input_absinfo_t)  # get abs value/limits
141
142def EVIOCSABS(axis):
143    return IOW('E', 0xc0 + axis, input_absinfo_t)  # set abs value/limits
144
145# send a force effect to a force feedback device
146"""  TODO: Support force feedback. """
147
148
149#EVIOCSFF                = IOW('E', 0x80, ff_effect_t)
150# Erase a force effect
151EVIOCRMFF               = IOW('E', 0x81, 'i')
152# Report number of effects playable at the same time
153EVIOCGEFFECTS           = IOR('E', 0x84, 'i')
154# Grab/Release device
155EVIOCGRAB               = IOW('E', 0x90, 'i')
156
157# Device properties and quirks
158INPUT_PROP_POINTER   = 0x00 # needs a pointer
159INPUT_PROP_DIRECT    = 0x01 # direct input devices
160INPUT_PROP_BUTTONPAD = 0x02 # has button(s) under pad
161INPUT_PROP_SEMI_MT   = 0x03 # touch rectangle only
162
163INPUT_PROP_MAX       = 0x1f
164INPUT_PROP_CNT       = (INPUT_PROP_MAX + 1)
165
166# Event types
167EV_SYN          = 0x00
168EV_KEY          = 0x01
169EV_REL          = 0x02
170EV_ABS          = 0x03
171EV_MSC          = 0x04
172EV_SW           = 0x05
173EV_LED          = 0x11
174EV_SND          = 0x12
175EV_REP          = 0x14
176EV_FF           = 0x15
177EV_PWR          = 0x16
178EV_FF_STATUS    = 0x17
179EV_MAX          = 0x1f
180EV_CNT          = (EV_MAX + 1)
181
182# Synchronization events.
183
184SYN_REPORT      = 0
185SYN_CONFIG      = 1
186SYN_MT_REPORT   = 2
187SYN_DROPPED     = 3
188
189"""
190 * Keys and buttons
191 *
192 * Most of the keys/buttons are modeled after USB HUT 1.12
193 * (see http://www.usb.org/developers/hidpage).
194 * Abbreviations in the comments:
195 * AC - Application Control
196 * AL - Application Launch Button
197 * SC - System Control
198"""
199
200KEY_RESERVED    =  0
201KEY_ESC         =  1
202KEY_1           =  2
203KEY_2           =  3
204KEY_3           =  4
205KEY_4           =  5
206KEY_5           =  6
207KEY_6           =  7
208KEY_7           =  8
209KEY_8           =  9
210KEY_9           = 10
211KEY_0           = 11
212KEY_MINUS       = 12
213KEY_EQUAL       = 13
214KEY_BACKSPACE   = 14
215KEY_TAB         = 15
216KEY_Q           = 16
217KEY_W           = 17
218KEY_E           = 18
219KEY_R           = 19
220KEY_T           = 20
221KEY_Y           = 21
222KEY_U           = 22
223KEY_I           = 23
224KEY_O           = 24
225KEY_P           = 25
226KEY_LEFTBRACE   = 26
227KEY_RIGHTBRACE  = 27
228KEY_ENTER       = 28
229KEY_LEFTCTRL    = 29
230KEY_A           = 30
231KEY_S           = 31
232KEY_D           = 32
233KEY_F           = 33
234KEY_G           = 34
235KEY_H           = 35
236KEY_J           = 36
237KEY_K           = 37
238KEY_L           = 38
239KEY_SEMICOLON   = 39
240KEY_APOSTROPHE  = 40
241KEY_GRAVE       = 41
242KEY_LEFTSHIFT   = 42
243KEY_BACKSLASH   = 43
244KEY_Z           = 44
245KEY_X           = 45
246KEY_C           = 46
247KEY_V           = 47
248KEY_B           = 48
249KEY_N           = 49
250KEY_M           = 50
251KEY_COMMA       = 51
252KEY_DOT         = 52
253KEY_SLASH       = 53
254KEY_RIGHTSHIFT  = 54
255KEY_KPASTERISK  = 55
256KEY_LEFTALT     = 56
257KEY_SPACE       = 57
258KEY_CAPSLOCK    = 58
259KEY_F1          = 59
260KEY_F2          = 60
261KEY_F3          = 61
262KEY_F4          = 62
263KEY_F5          = 63
264KEY_F6          = 64
265KEY_F7          = 65
266KEY_F8          = 66
267KEY_F9          = 67
268KEY_F10         = 68
269KEY_NUMLOCK     = 69
270KEY_SCROLLLOCK  = 70
271KEY_KP7         = 71
272KEY_KP8         = 72
273KEY_KP9         = 73
274KEY_KPMINUS     = 74
275KEY_KP4         = 75
276KEY_KP5         = 76
277KEY_KP6         = 77
278KEY_KPPLUS      = 78
279KEY_KP1         = 79
280KEY_KP2         = 80
281KEY_KP3         = 81
282KEY_KP0         = 82
283KEY_KPDOT       = 83
284
285KEY_ZENKAKUHANKAKU = 85
286KEY_102ND       = 86
287KEY_F11         = 87
288KEY_F12         = 88
289KEY_RO          = 89
290KEY_KATAKANA    = 90
291KEY_HIRAGANA    = 91
292KEY_HENKAN      = 92
293KEY_KATAKANAHIRAGANA = 93
294KEY_MUHENKAN    = 94
295KEY_KPJPCOMMA   = 95
296KEY_KPENTER     = 96
297KEY_RIGHTCTRL   = 97
298KEY_KPSLASH     = 98
299KEY_SYSRQ       = 99
300KEY_RIGHTALT    = 100
301KEY_LINEFEED    = 101
302KEY_HOME        = 102
303KEY_UP          = 103
304KEY_PAGEUP      = 104
305KEY_LEFT        = 105
306KEY_RIGHT       = 106
307KEY_END         = 107
308KEY_DOWN        = 108
309KEY_PAGEDOWN    = 109
310KEY_INSERT      = 110
311KEY_DELETE      = 111
312KEY_MACRO       = 112
313KEY_MUTE        = 113
314KEY_VOLUMEDOWN  = 114
315KEY_VOLUMEUP    = 115
316KEY_POWER       = 116     # SC System Power Down
317KEY_KPEQUAL     = 117
318KEY_KPPLUSMINUS = 118
319KEY_PAUSE       = 119
320KEY_SCALE       = 120     # AL Compiz Scale (Expose)
321
322KEY_KPCOMMA     = 121
323KEY_HANGEUL     = 122
324KEY_HANGUEL     = KEY_HANGEUL
325KEY_HANJA       = 123
326KEY_YEN         = 124
327KEY_LEFTMETA    = 125
328KEY_RIGHTMETA   = 126
329KEY_COMPOSE     = 127
330
331KEY_STOP        = 128   # AC Stop
332KEY_AGAIN       = 129
333KEY_PROPS       = 130   # AC Properties
334KEY_UNDO        = 131   # AC Undo
335KEY_FRONT       = 132
336KEY_COPY        = 133   # AC Copy
337KEY_OPEN        = 134   # AC Open
338KEY_PASTE       = 135   # AC Paste
339KEY_FIND        = 136   # AC Search
340KEY_CUT         = 137   # AC Cut
341KEY_HELP        = 138   # AL Integrated Help Center
342KEY_MENU        = 139   # Menu (show menu)
343KEY_CALC        = 140   # AL Calculator
344KEY_SETUP       = 141
345KEY_SLEEP       = 142   # SC System Sleep
346KEY_WAKEUP      = 143   # System Wake Up
347KEY_FILE        = 144   # AL Local Machine Browser
348KEY_SENDFILE    = 145
349KEY_DELETEFILE  = 146
350KEY_XFER        = 147
351KEY_PROG1       = 148
352KEY_PROG2       = 149
353KEY_WWW         = 150   # AL Internet Browser
354KEY_MSDOS       = 151
355KEY_COFFEE      = 152   # AL Terminal Lock/Screensaver
356KEY_SCREENLOCK  = KEY_COFFEE
357KEY_DIRECTION   = 153
358KEY_CYCLEWINDOWS = 154
359KEY_MAIL        = 155
360KEY_BOOKMARKS   = 156   # AC Bookmarks
361KEY_COMPUTER    = 157
362KEY_BACK        = 158   # AC Back
363KEY_FORWARD     = 159   # AC Forward
364KEY_CLOSECD     = 160
365KEY_EJECTCD     = 161
366KEY_EJECTCLOSECD = 162
367KEY_NEXTSONG    = 163
368KEY_PLAYPAUSE   = 164
369KEY_PREVIOUSSONG = 165
370KEY_STOPCD      = 166
371KEY_RECORD      = 167
372KEY_REWIND      = 168
373KEY_PHONE       = 169   # Media Select Telephone
374KEY_ISO         = 170
375KEY_CONFIG      = 171   # AL Consumer Control Configuration
376KEY_HOMEPAGE    = 172   # AC Home
377KEY_REFRESH     = 173   # AC Refresh
378KEY_EXIT        = 174   # AC Exit
379KEY_MOVE        = 175
380KEY_EDIT        = 176
381KEY_SCROLLUP    = 177
382KEY_SCROLLDOWN  = 178
383KEY_KPLEFTPAREN = 179
384KEY_KPRIGHTPAREN = 180
385KEY_NEW         = 181   # AC New
386KEY_REDO        = 182   # AC Redo/Repeat
387
388KEY_F13         = 183
389KEY_F14         = 184
390KEY_F15         = 185
391KEY_F16         = 186
392KEY_F17         = 187
393KEY_F18         = 188
394KEY_F19         = 189
395KEY_F20         = 190
396KEY_F21         = 191
397KEY_F22         = 192
398KEY_F23         = 193
399KEY_F24         = 194
400
401KEY_PLAYCD      = 200
402KEY_PAUSECD     = 201
403KEY_PROG3       = 202
404KEY_PROG4       = 203
405KEY_DASHBOARD   = 204   # AL Dashboard
406KEY_SUSPEND     = 205
407KEY_CLOSE       = 206   # AC Close
408KEY_PLAY        = 207
409KEY_FASTFORWARD = 208
410KEY_BASSBOOST   = 209
411KEY_PRINT       = 210   # AC Print
412KEY_HP          = 211
413KEY_CAMERA      = 212
414KEY_SOUND       = 213
415KEY_QUESTION    = 214
416KEY_EMAIL       = 215
417KEY_CHAT        = 216
418KEY_SEARCH      = 217
419KEY_CONNECT     = 218
420KEY_FINANCE     = 219   #AL Checkbook/Finance
421KEY_SPORT       = 220
422KEY_SHOP        = 221
423KEY_ALTERASE    = 222
424KEY_CANCEL      = 223   # AC Cancel
425KEY_BRIGHTNESSDOWN = 224
426KEY_BRIGHTNESSUP = 225
427KEY_MEDIA       = 226
428
429KEY_SWITCHVIDEOMODE = 227   # Cycle between available video
430                            # outputs (Monitor/LCD/TV-out/etc)
431KEY_KBDILLUMTOGGLE  = 228
432KEY_KBDILLUMDOWN    = 229
433KEY_KBDILLUMUP      = 230
434
435KEY_SEND            = 231   # AC Send
436KEY_REPLY           = 232   # AC Reply
437KEY_FORWARDMAIL     = 233   # AC Forward Msg
438KEY_SAVE            = 234   # AC Save
439KEY_DOCUMENTS       = 235
440
441KEY_BATTERY         = 236
442
443KEY_BLUETOOTH       = 237
444KEY_WLAN            = 238
445KEY_UWB             = 239
446
447KEY_UNKNOWN         = 240
448
449KEY_VIDEO_NEXT      = 241   # drive next video source
450KEY_VIDEO_PREV      = 242   # drive previous video source
451KEY_BRIGHTNESS_CYCLE = 243  # brightness up, after max is min
452KEY_BRIGHTNESS_ZERO = 244   # brightness off, use ambient
453KEY_DISPLAY_OFF     = 245   # display device to off state
454
455KEY_WIMAX           = 246
456KEY_RFKILL          = 247   # Key that controls all radios
457
458# Code 255 is reserved for special needs of AT keyboard driver
459
460BTN_MISC        = 0x100
461BTN_0           = 0x100
462BTN_1           = 0x101
463BTN_2           = 0x102
464BTN_3           = 0x103
465BTN_4           = 0x104
466BTN_5           = 0x105
467BTN_6           = 0x106
468BTN_7           = 0x107
469BTN_8           = 0x108
470BTN_9           = 0x109
471
472BTN_MOUSE       = 0x110
473BTN_LEFT        = 0x110
474BTN_RIGHT       = 0x111
475BTN_MIDDLE      = 0x112
476BTN_SIDE        = 0x113
477BTN_EXTRA       = 0x114
478BTN_FORWARD     = 0x115
479BTN_BACK        = 0x116
480BTN_TASK        = 0x117
481
482BTN_JOYSTICK    = 0x120
483BTN_TRIGGER     = 0x120
484BTN_THUMB       = 0x121
485BTN_THUMB2      = 0x122
486BTN_TOP         = 0x123
487BTN_TOP2        = 0x124
488BTN_PINKIE      = 0x125
489BTN_BASE        = 0x126
490BTN_BASE2       = 0x127
491BTN_BASE3       = 0x128
492BTN_BASE4       = 0x129
493BTN_BASE5       = 0x12a
494BTN_BASE6       = 0x12b
495BTN_DEAD        = 0x12f
496
497BTN_GAMEPAD     = 0x130
498BTN_A           = 0x130
499BTN_B           = 0x131
500BTN_C           = 0x132
501BTN_X           = 0x133
502BTN_Y           = 0x134
503BTN_Z           = 0x135
504BTN_TL          = 0x136
505BTN_TR          = 0x137
506BTN_TL2         = 0x138
507BTN_TR2         = 0x139
508BTN_SELECT      = 0x13a
509BTN_START       = 0x13b
510BTN_MODE        = 0x13c
511BTN_THUMBL      = 0x13d
512BTN_THUMBR      = 0x13e
513
514BTN_DIGI        = 0x140
515BTN_TOOL_PEN    = 0x140
516BTN_TOOL_RUBBER = 0x141
517BTN_TOOL_BRUSH  = 0x142
518BTN_TOOL_PENCIL = 0x143
519BTN_TOOL_AIRBRUSH = 0x144
520BTN_TOOL_FINGER = 0x145
521BTN_TOOL_MOUSE  = 0x146
522BTN_TOOL_LENS   = 0x147
523BTN_TOOL_QUINTTAP = 0x148  # Five fingers on trackpad
524BTN_TOUCH       = 0x14a
525BTN_STYLUS      = 0x14b
526BTN_STYLUS2     = 0x14c
527BTN_TOOL_DOUBLETAP = 0x14d
528BTN_TOOL_TRIPLETAP = 0x14e
529BTN_TOOL_QUADTAP = 0x14f   # Four fingers on trackpad
530
531BTN_WHEEL       = 0x150
532BTN_GEAR_DOWN   = 0x150
533BTN_GEAR_UP     = 0x151
534
535
536KEY_OK          = 0x160
537KEY_SELECT      = 0x161
538KEY_GOTO        = 0x162
539KEY_CLEAR       = 0x163
540KEY_POWER2      = 0x164
541KEY_OPTION      = 0x165
542KEY_INFO        = 0x166   #AL OEM Features/Tips/Tutorial
543KEY_TIME        = 0x167
544KEY_VENDOR      = 0x168
545KEY_ARCHIVE     = 0x169
546KEY_PROGRAM     = 0x16a   # Media Select Program Guide
547KEY_CHANNEL     = 0x16b
548KEY_FAVORITES   = 0x16c
549KEY_EPG         = 0x16d
550KEY_PVR         = 0x16e   # Media Select Home
551KEY_MHP         = 0x16f
552KEY_LANGUAGE    = 0x170
553KEY_TITLE       = 0x171
554KEY_SUBTITLE    = 0x172
555KEY_ANGLE       = 0x173
556KEY_ZOOM        = 0x174
557KEY_MODE        = 0x175
558KEY_KEYBOARD    = 0x176
559KEY_SCREEN      = 0x177
560KEY_PC          = 0x178   # Media Select Computer
561KEY_TV          = 0x179   # Media Select TV
562KEY_TV2         = 0x17a   # Media Select Cable
563KEY_VCR         = 0x17b   # Media Select VCR
564KEY_VCR2        = 0x17c   # VCR Plus
565KEY_SAT         = 0x17d   # Media Select Satellite
566KEY_SAT2        = 0x17e
567KEY_CD          = 0x17f   # Media Select CD
568KEY_TAPE        = 0x180   # Select Tape
569KEY_RADIO       = 0x181
570KEY_TUNER       = 0x182   # Media Select Tuner
571KEY_PLAYER      = 0x183
572KEY_TEXT        = 0x184
573KEY_DVD         = 0x185   # Media Select DVD
574KEY_AUX         = 0x186
575KEY_MP3         = 0x187
576KEY_AUDIO       = 0x188   # AL Audio Browser
577KEY_VIDEO       = 0x189   # AL Movie Browser
578KEY_DIRECTORY   = 0x18a
579KEY_LIST        = 0x18b
580KEY_MEMO        = 0x18   # Media Select Messages
581KEY_CALENDAR    = 0x18d
582KEY_RED         = 0x18e
583KEY_GREEN       = 0x18f
584KEY_YELLOW      = 0x190
585KEY_BLUE        = 0x191
586KEY_CHANNELUP   = 0x192   # Channel Increment
587KEY_CHANNELDOWN = 0x193   # Channel Decrement
588KEY_FIRST       = 0x194
589KEY_LAST        = 0x195   # Recall Last
590KEY_AB          = 0x196
591KEY_NEXT        = 0x197
592KEY_RESTART     = 0x198
593KEY_SLOW        = 0x199
594KEY_SHUFFLE     = 0x19a
595KEY_BREAK       = 0x19b
596KEY_PREVIOUS    = 0x19c
597KEY_DIGITS      = 0x19d
598KEY_TEEN        = 0x19e
599KEY_TWEN        = 0x19f
600KEY_VIDEOPHONE  = 0x1a0   # Media Select Video Phone
601KEY_GAMES       = 0x1a1   # Media Select Games
602KEY_ZOOMIN      = 0x1a2   # AC Zoom In
603KEY_ZOOMOUT     = 0x1a3   # AC Zoom Out
604KEY_ZOOMRESET   = 0x1a4   # AC Zoom
605KEY_WORDPROCESSOR = 0x1a5   # AL Word Processor
606KEY_EDITOR      = 0x1a6   # AL Text Editor
607KEY_SPREADSHEET = 0x1a7   # AL Spreadsheet
608KEY_GRAPHICSEDITOR = 0x1a8   # AL Graphics Editor
609KEY_PRESENTATION = 0x1a9   # AL Presentation App
610KEY_DATABASE    = 0x1aa   # AL Database App
611KEY_NEWS        = 0x1ab   # AL Newsreader
612KEY_VOICEMAIL   = 0x1ac   # AL Voicemail
613KEY_ADDRESSBOOK = 0x1ad   # AL Contacts/Address Book
614KEY_MESSENGER   = 0x1ae   # AL Instant Messaging
615KEY_DISPLAYTOGGLE = 0x1af   # Turn display (LCD) on and off
616KEY_SPELLCHECK  = 0x1b0   # AL Spell Check
617KEY_LOGOFF      = 0x1b1   #* AL Logoff
618
619KEY_DOLLAR      = 0x1b2
620KEY_EURO        = 0x1b3
621
622KEY_FRAMEBACK   = 0x1b4   # Consumer - transport controls
623KEY_FRAMEFORWARD = 0x1b5
624KEY_CONTEXT_MENU = 0x1b6   # GenDesc - system context menu
625KEY_MEDIA_REPEAT = 0x1b7   # Consumer - transport control
626KEY_10CHANNELSUP = 0x1b8   # 10 channels up (10+)
627KEY_10CHANNELSDOWN = 0x1b9   # 10 channels down (10-)
628KEY_IMAGES       = 0x1ba   # AL Image Browser
629
630KEY_DEL_EOL      = 0x1c0
631KEY_DEL_EOS      = 0x1c1
632KEY_INS_LINE     = 0x1c2
633KEY_DEL_LINE     = 0x1c3
634
635KEY_FN           = 0x1d0
636KEY_FN_ESC       = 0x1d1
637KEY_FN_F1        = 0x1d2
638KEY_FN_F2        = 0x1d3
639KEY_FN_F3        = 0x1d4
640KEY_FN_F4        = 0x1d5
641KEY_FN_F5        = 0x1d6
642KEY_FN_F6        = 0x1d7
643KEY_FN_F7        = 0x1d8
644KEY_FN_F8        = 0x1d9
645KEY_FN_F9        = 0x1da
646KEY_FN_F10       = 0x1db
647KEY_FN_F11       = 0x1dc
648KEY_FN_F12       = 0x1dd
649KEY_FN_1         = 0x1de
650KEY_FN_2         = 0x1df
651KEY_FN_D         = 0x1e0
652KEY_FN_E         = 0x1e1
653KEY_FN_F         = 0x1e2
654KEY_FN_S         = 0x1e3
655KEY_FN_B         = 0x1e4
656
657KEY_BRL_DOT1     = 0x1f1
658KEY_BRL_DOT2     = 0x1f2
659KEY_BRL_DOT3     = 0x1f3
660KEY_BRL_DOT4     = 0x1f4
661KEY_BRL_DOT5     = 0x1f5
662KEY_BRL_DOT6     = 0x1f6
663KEY_BRL_DOT7     = 0x1f7
664KEY_BRL_DOT8     = 0x1f8
665KEY_BRL_DOT9     = 0x1f9
666KEY_BRL_DOT10    = 0x1fa
667
668KEY_NUMERIC_0    = 0x200   # used by phones, remote controls,
669KEY_NUMERIC_1    = 0x201   # and other keypads
670KEY_NUMERIC_2    = 0x202
671KEY_NUMERIC_3    = 0x203
672KEY_NUMERIC_4    = 0x204
673KEY_NUMERIC_5    = 0x205
674KEY_NUMERIC_6    = 0x206
675KEY_NUMERIC_7    = 0x207
676KEY_NUMERIC_8    = 0x208
677KEY_NUMERIC_9    = 0x209
678KEY_NUMERIC_STAR = 0x20a
679KEY_NUMERIC_POUND = 0x20b
680
681KEY_CAMERA_FOCUS = 0x210
682KEY_WPS_BUTTON   = 0x211   # WiFi Protected Setup key
683
684KEY_TOUCHPAD_TOGGLE = 0x212   # Request switch touchpad on or off
685KEY_TOUCHPAD_ON  = 0x213
686KEY_TOUCHPAD_OFF = 0x214
687
688KEY_CAMERA_ZOOMIN = 0x215
689KEY_CAMERA_ZOOMOUT = 0x216
690KEY_CAMERA_UP    = 0x217
691KEY_CAMERA_DOWN  = 0x218
692KEY_CAMERA_LEFT  = 0x219
693KEY_CAMERA_RIGHT = 0x21a
694
695BTN_TRIGGER_HAPPY  = 0x2c0
696BTN_TRIGGER_HAPPY1 = 0x2c0
697BTN_TRIGGER_HAPPY2 = 0x2c1
698BTN_TRIGGER_HAPPY3 = 0x2c2
699BTN_TRIGGER_HAPPY4 = 0x2c3
700BTN_TRIGGER_HAPPY5 = 0x2c4
701BTN_TRIGGER_HAPPY6 = 0x2c5
702BTN_TRIGGER_HAPPY7 = 0x2c6
703BTN_TRIGGER_HAPPY8 = 0x2c7
704BTN_TRIGGER_HAPPY9 = 0x2c8
705BTN_TRIGGER_HAPPY10 = 0x2c9
706BTN_TRIGGER_HAPPY11 = 0x2ca
707BTN_TRIGGER_HAPPY12 = 0x2cb
708BTN_TRIGGER_HAPPY13 = 0x2cc
709BTN_TRIGGER_HAPPY14 = 0x2cd
710BTN_TRIGGER_HAPPY15 = 0x2ce
711BTN_TRIGGER_HAPPY16 = 0x2cf
712BTN_TRIGGER_HAPPY17 = 0x2d0
713BTN_TRIGGER_HAPPY18 = 0x2d1
714BTN_TRIGGER_HAPPY19 = 0x2d2
715BTN_TRIGGER_HAPPY20 = 0x2d3
716BTN_TRIGGER_HAPPY21 = 0x2d4
717BTN_TRIGGER_HAPPY22 = 0x2d5
718BTN_TRIGGER_HAPPY23 = 0x2d6
719BTN_TRIGGER_HAPPY24 = 0x2d7
720BTN_TRIGGER_HAPPY25 = 0x2d8
721BTN_TRIGGER_HAPPY26 = 0x2d9
722BTN_TRIGGER_HAPPY27 = 0x2da
723BTN_TRIGGER_HAPPY28 = 0x2db
724BTN_TRIGGER_HAPPY29 = 0x2dc
725BTN_TRIGGER_HAPPY30 = 0x2dd
726BTN_TRIGGER_HAPPY31 = 0x2de
727BTN_TRIGGER_HAPPY32 = 0x2df
728BTN_TRIGGER_HAPPY33 = 0x2e0
729BTN_TRIGGER_HAPPY34 = 0x2e1
730BTN_TRIGGER_HAPPY35 = 0x2e2
731BTN_TRIGGER_HAPPY36 = 0x2e3
732BTN_TRIGGER_HAPPY37 = 0x2e4
733BTN_TRIGGER_HAPPY38 = 0x2e5
734BTN_TRIGGER_HAPPY39 = 0x2e6
735BTN_TRIGGER_HAPPY40 = 0x2e7
736
737
738# We avoid low common keys in module aliases so they don't get huge
739#KEY_MIN_INTERESTING = KEY_MUTE
740KEY_MAX             = 0x2ff
741KEY_CNT             = (KEY_MAX + 1)
742
743# Relative axes
744REL_X               = 0x00
745REL_Y               = 0x01
746REL_Z               = 0x02
747REL_RX              = 0x03
748REL_RY              = 0x04
749REL_RZ              = 0x05
750REL_HWHEEL          = 0x06
751REL_DIAL            = 0x07
752REL_WHEEL           = 0x08
753REL_MISC            = 0x09
754REL_RESERVED        = 0x0a
755REL_WHEEL_HI_RES    = 0x0b
756REL_HWHEEL_HI_RES   = 0x0c
757REL_MAX             = 0x0f
758REL_CNT             = (REL_MAX + 1)
759
760# Absolute axes
761ABS_X               = 0x00
762ABS_Y               = 0x01
763ABS_Z               = 0x02
764ABS_RX              = 0x03
765ABS_RY              = 0x04
766ABS_RZ              = 0x05
767ABS_THROTTLE        = 0x06
768ABS_RUDDER          = 0x07
769ABS_WHEEL           = 0x08
770ABS_GAS             = 0x09
771ABS_BRAKE           = 0x0a
772ABS_HAT0X           = 0x10
773ABS_HAT0Y           = 0x11
774ABS_HAT1X           = 0x12
775ABS_HAT1Y           = 0x13
776ABS_HAT2X           = 0x14
777ABS_HAT2Y           = 0x15
778ABS_HAT3X           = 0x16
779ABS_HAT3Y           = 0x17
780ABS_PRESSURE        = 0x18
781ABS_DISTANCE        = 0x19
782ABS_TILT_X          = 0x1a
783ABS_TILT_Y          = 0x1b
784ABS_TOOL_WIDTH      = 0x1c
785
786ABS_VOLUME          = 0x20
787
788ABS_MISC            = 0x28
789
790ABS_MT_SLOT         = 0x2f  # MT slot being modified
791ABS_MT_TOUCH_MAJOR  = 0x30  # Major axis of touching ellipse
792ABS_MT_TOUCH_MINOR  = 0x31  # Minor axis (omit if circular)
793ABS_MT_WIDTH_MAJOR  = 0x32  # Major axis of approaching ellipse
794ABS_MT_WIDTH_MINOR  = 0x33  # Minor axis (omit if circular)
795ABS_MT_ORIENTATION  = 0x34  # Ellipse orientation
796ABS_MT_POSITION_X   = 0x35  # Center X ellipse position
797ABS_MT_POSITION_Y   = 0x36  # Center Y ellipse position
798ABS_MT_TOOL_TYPE    = 0x37  # Type of touching device
799ABS_MT_BLOB_ID      = 0x38  # Group a set of packets as a blob
800ABS_MT_TRACKING_ID  = 0x39  # Unique ID of initiated contact
801ABS_MT_PRESSURE     = 0x3a  # Pressure on contact area
802ABS_MT_DISTANCE     = 0x3b  # Contact hover distance
803
804ABS_MT_FIRST        = ABS_MT_TOUCH_MAJOR
805ABS_MT_LAST         = ABS_MT_DISTANCE
806ABS_MT_RANGE        = list(range(ABS_MT_FIRST, ABS_MT_LAST+1))
807
808ABS_MAX             = 0x3f
809ABS_CNT             = (ABS_MAX + 1)
810
811# Switch events
812SW_LID                  = 0x00  # set = lid shut
813SW_TABLET_MODE          = 0x01  # set = tablet mode
814SW_HEADPHONE_INSERT     = 0x02  # set = inserted
815SW_RFKILL_ALL           = 0x03  # rfkill main switch, type "any"
816                                # set = radio enabled
817SW_RADIO = SW_RFKILL_ALL        # deprecated
818SW_MICROPHONE_INSERT    = 0x04  # set = inserted
819SW_DOCK                 = 0x05  # set = plugged into dock
820SW_LINEOUT_INSERT       = 0x06  # set = inserted
821SW_JACK_PHYSICAL_INSERT = 0x07  # set = mechanical switch set
822SW_VIDEOOUT_INSERT      = 0x08  # set = inserted
823SW_CAMERA_LENS_COVER    = 0x09  # set = lens covered
824SW_KEYPAD_SLIDE         = 0x0a  # set = keypad slide out
825SW_FRONT_PROXIMITY      = 0x0b  # set = front proximity sensor active
826SW_ROTATE_LOCK          = 0x0c  # set = rotate locked/disabled
827SW_MAX                  = 0x0f
828SW_CNT                  = (SW_MAX + 1)
829
830# Misc events
831MSC_SERIAL      = 0x00
832MSC_PULSELED    = 0x01
833MSC_GESTURE     = 0x02
834MSC_RAW         = 0x03
835MSC_SCAN        = 0x04
836MSC_MAX         = 0x07
837MSC_CNT         = (MSC_MAX + 1)
838
839# LEDs
840LED_NUML        = 0x00
841LED_CAPSL       = 0x01
842LED_SCROLLL     = 0x02
843LED_COMPOSE     = 0x03
844LED_KANA        = 0x04
845LED_SLEEP       = 0x05
846LED_SUSPEND     = 0x06
847LED_MUTE        = 0x07
848LED_MISC        = 0x08
849LED_MAIL        = 0x09
850LED_CHARGING    = 0x0a
851LED_MAX         = 0x0f
852LED_CNT         = (LED_MAX + 1)
853
854# Autorepeat values
855REP_DELAY       = 0x00
856REP_PERIOD      = 0x01
857REP_MAX         = 0x01
858REP_CNT         = (REP_MAX + 1)
859
860# Sounds
861SND_CLICK       = 0x00
862SND_BELL        = 0x01
863SND_TONE        = 0x02
864SND_MAX         = 0x07
865SND_CNT         = (SND_MAX + 1)
866
867# IDs.
868ID_BUS          = 0
869ID_VENDOR       = 1
870ID_PRODUCT      = 2
871ID_VERSION      = 3
872
873BUS_PCI         = 0x01
874BUS_ISAPNP      = 0x02
875BUS_USB         = 0x03
876BUS_HIL         = 0x04
877BUS_BLUETOOTH   = 0x05
878BUS_VIRTUAL     = 0x06
879
880BUS_ISA         = 0x10
881BUS_I8042       = 0x11
882BUS_XTKBD       = 0x12
883BUS_RS232       = 0x13
884BUS_GAMEPORT    = 0x14
885BUS_PARPORT     = 0x15
886BUS_AMIGA       = 0x16
887BUS_ADB         = 0x17
888BUS_I2C         = 0x18
889BUS_HOST        = 0x19
890BUS_GSC         = 0x1A
891BUS_ATARI       = 0x1B
892BUS_SPI         = 0x1C
893
894# MT_TOOL types
895MT_TOOL_FINGER  = 0
896MT_TOOL_PEN     = 1
897MT_TOOL_MAX     = 1
898
899# Values describing the status of a force-feedback effect
900FF_STATUS_STOPPED   = 0x00
901FF_STATUS_PLAYING   = 0x01
902FF_STATUS_MAX       = 0x01
903FF_STATUS_CNT       = (FF_STATUS_MAX + 1)
904
905# Structures used in ioctls to upload effects to a device
906# They are pieces of a bigger structure (called ff_effect)
907
908# All duration values are expressed in ms. Values above 32767 ms (0x7fff)
909# should not be used and have unspecified results.
910
911"""
912 * struct ff_replay - defines scheduling of the force-feedback effect
913 * @length: duration of the effect
914 * @delay: delay before effect should start playing
915struct ff_replay {
916  __u16 length;
917  __u16 delay;
918};
919"""
920
921"""
922 * struct ff_trigger - defines what triggers the force-feedback effect
923 * @button: number of the button triggering the effect
924 * @interval: controls how soon the effect can be re-triggered
925struct ff_trigger {
926  __u16 button;
927  __u16 interval;
928};
929"""
930
931"""
932 * struct ff_envelope - generic force-feedback effect envelope
933 * @attack_length: duration of the attack (ms)
934 * @attack_level: level at the beginning of the attack
935 * @fade_length: duration of fade (ms)
936 * @fade_level: level at the end of fade
937 *
938 * The @attack_level and @fade_level are absolute values; when applying
939 * envelope force-feedback core will convert to positive/negative
940 * value based on polarity of the default level of the effect.
941 * Valid range for the attack and fade levels is 0x0000 - 0x7fff
942struct ff_envelope {
943  __u16 attack_length;
944  __u16 attack_level;
945  __u16 fade_length;
946  __u16 fade_level;
947};
948"""
949
950"""
951 * struct ff_constant_effect - params of a constant force-feedback effect
952 * @level: strength of the effect; may be negative
953 * @envelope: envelope data
954struct ff_constant_effect {
955  __s16 level;
956  struct ff_envelope envelope;
957};
958"""
959
960"""
961 * struct ff_ramp_effect - params of a ramp force-feedback effect
962 * @start_level: beginning strength of the effect; may be negative
963 * @end_level: final strength of the effect; may be negative
964 * @envelope: envelope data
965struct ff_ramp_effect {
966  __s16 start_level;
967  __s16 end_level;
968  struct ff_envelope envelope;
969};
970"""
971
972"""
973 * struct ff_condition_effect - spring or friction force-feedback effect
974 * @right_saturation: maximum level when joystick moved all way to the right
975 * @left_saturation: same for the left side
976 * @right_coeff: controls how fast the force grows when the joystick moves
977 *  to the right
978 * @left_coeff: same for the left side
979 * @deadband: size of the dead zone, where no force is produced
980 * @center: position of the dead zone
981struct ff_condition_effect {
982  __u16 right_saturation;
983  __u16 left_saturation;
984
985  __s16 right_coeff;
986  __s16 left_coeff;
987
988  __u16 deadband;
989  __s16 center;
990};
991"""
992
993
994"""
995 * struct ff_periodic_effect - params of a periodic force-feedback effect
996 * @waveform: kind of the effect (wave)
997 * @period: period of the wave (ms)
998 * @magnitude: peak value
999 * @offset: mean value of the wave (roughly)
1000 * @phase: 'horizontal' shift
1001 * @envelope: envelope data
1002 * @custom_len: number of samples (FF_CUSTOM only)
1003 * @custom_data: buffer of samples (FF_CUSTOM only)
1004 *
1005 * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP,
1006 * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined
1007 * for the time being as no driver supports it yet.
1008 *
1009 * Note: the data pointed by custom_data is copied by the driver.
1010 * You can therefore dispose of the memory after the upload/update.
1011struct ff_periodic_effect {
1012  __u16 waveform;
1013  __u16 period;
1014  __s16 magnitude;
1015  __s16 offset;
1016  __u16 phase;
1017
1018  struct ff_envelope envelope;
1019
1020  __u32 custom_len;
1021  __s16 __user *custom_data;
1022};
1023"""
1024
1025"""
1026 * struct ff_rumble_effect - params of a periodic force-feedback effect
1027 * @strong_magnitude: magnitude of the heavy motor
1028 * @weak_magnitude: magnitude of the light one
1029 *
1030 * Some rumble pads have two motors of different weight. Strong_magnitude
1031 * represents the magnitude of the vibration generated by the heavy one.
1032struct ff_rumble_effect {
1033  __u16 strong_magnitude;
1034  __u16 weak_magnitude;
1035};
1036"""
1037
1038"""
1039 * struct ff_effect - defines force feedback effect
1040 * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
1041 *  FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM)
1042 * @id: an unique id assigned to an effect
1043 * @direction: direction of the effect
1044 * @trigger: trigger conditions (struct ff_trigger)
1045 * @replay: scheduling of the effect (struct ff_replay)
1046 * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect,
1047 *  ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further
1048 *  defining effect parameters
1049 *
1050 * This structure is sent through ioctl from the application to the driver.
1051 * To create a new effect application should set its @id to -1; the kernel
1052 * will return assigned @id which can later be used to update or delete
1053 * this effect.
1054 *
1055 * Direction of the effect is encoded as follows:
1056 *  0 deg -> 0x0000 (down)
1057 *  90 deg -> 0x4000 (left)
1058 *  180 deg -> 0x8000 (up)
1059 *  270 deg -> 0xC000 (right)
1060struct ff_effect {
1061  __u16 type;
1062  __s16 id;
1063  __u16 direction;
1064  struct ff_trigger trigger;
1065  struct ff_replay replay;
1066
1067  union {
1068    struct ff_constant_effect constant;
1069    struct ff_ramp_effect ramp;
1070    struct ff_periodic_effect periodic;
1071    struct ff_condition_effect condition[2]; /* One for each axis */
1072    struct ff_rumble_effect rumble;
1073  } u;
1074};
1075"""
1076
1077# Force feedback effect types
1078FF_RUMBLE       = 0x50
1079FF_PERIODIC     = 0x51
1080FF_CONSTANT     = 0x52
1081FF_SPRING       = 0x53
1082FF_FRICTION     = 0x54
1083FF_DAMPER       = 0x55
1084FF_INERTIA      = 0x56
1085FF_RAMP         = 0x57
1086
1087FF_EFFECT_MIN   = FF_RUMBLE
1088FF_EFFECT_MAX   = FF_RAMP
1089
1090# Force feedback periodic effect types
1091FF_SQUARE       = 0x58
1092FF_TRIANGLE     = 0x59
1093FF_SINE         = 0x5a
1094FF_SAW_UP       = 0x5b
1095FF_SAW_DOWN     = 0x5c
1096FF_CUSTOM       = 0x5d
1097
1098FF_WAVEFORM_MIN = FF_SQUARE
1099FF_WAVEFORM_MAX = FF_CUSTOM
1100
1101# Set ff device properties
1102FF_GAIN         = 0x60
1103FF_AUTOCENTER   = 0x61
1104
1105FF_MAX          = 0x7f
1106FF_CNT          = (FF_MAX + 1)
1107
1108
1109"""
1110The following constants, functions and dicts are not part of the original linux
1111input header file.  They are included here to make it easier to use the linux
1112input subsystem from python scripts.
1113"""
1114
1115BITS_PER_WORD = 8
1116
1117def NBITS(x):
1118    return ((x - 1) // BITS_PER_WORD) + 1
1119
1120def OFFSET(x):
1121    return (x % BITS_PER_WORD)
1122
1123def BIT(x):
1124    return (1 << OFFSET(x))
1125
1126def INDEX(x):
1127    return (x // BITS_PER_WORD)
1128
1129def test_bit(b, a):
1130    return ((a[INDEX(b)] >> OFFSET(b)) & 1)
1131
1132EV_TYPES = {
1133    EV_SYN : 'EV_SYN',
1134    EV_KEY : 'EV_KEY',
1135    EV_REL : 'EV_REL',
1136    EV_ABS : 'EV_ABS',
1137    EV_MSC : 'EV_MSC',
1138    EV_SW  : 'EV_SW',
1139    EV_LED : 'EV_LED',
1140    EV_SND : 'EV_SND',
1141    EV_REP : 'EV_REP',
1142    EV_FF  : 'EV_FF',
1143    EV_PWR : 'EV_PWR',
1144    EV_FF_STATUS : 'EV_FF_STATUS'
1145}
1146
1147EV_SIZES = {
1148    EV_KEY : KEY_CNT,
1149    EV_REL : REL_CNT,
1150    EV_ABS : ABS_CNT,
1151    EV_MSC : MSC_CNT,
1152    EV_SW  : SW_CNT,
1153    EV_LED : LED_CNT,
1154    EV_SND : SND_CNT,
1155    EV_REP : REP_CNT,
1156    EV_FF  : FF_CNT,
1157    EV_FF_STATUS : FF_STATUS_CNT
1158}
1159
1160EV_STRINGS = {
1161    # Keys (only buttons, for now)
1162    EV_KEY: {
1163        BTN_0           : '0',
1164        BTN_1           : '1',
1165        BTN_2           : '0',
1166        BTN_3           : '3',
1167        BTN_4           : '4',
1168        BTN_5           : '5',
1169        BTN_6           : '6',
1170        BTN_7           : '7',
1171        BTN_8           : '8',
1172        BTN_9           : '9',
1173        BTN_LEFT        : 'LEFT',
1174        BTN_RIGHT       : 'RIGHT',
1175        BTN_MIDDLE      : 'MIDDLE',
1176        BTN_SIDE        : 'SIDE',
1177        BTN_EXTRA       : 'EXTRA',
1178        BTN_FORWARD     : 'FORWARD',
1179        BTN_BACK        : 'BACK',
1180        BTN_TASK        : 'TASK',
1181        BTN_TRIGGER     : 'TRIGGER',
1182        BTN_THUMB       : 'THUMB',
1183        BTN_THUMB2      : 'THUMB2',
1184        BTN_TOP         : 'TOP',
1185        BTN_TOP2        : 'TOP2',
1186        BTN_PINKIE      : 'PINKIE',
1187        BTN_BASE        : 'BASE',
1188        BTN_BASE2       : 'BASE2',
1189        BTN_BASE3       : 'BASE3',
1190        BTN_BASE4       : 'BASE4',
1191        BTN_BASE5       : 'BASE5',
1192        BTN_BASE6       : 'BASE6',
1193        BTN_DEAD        : 'DEAD',
1194        BTN_A           : 'A',
1195        BTN_B           : 'B',
1196        BTN_C           : 'C',
1197        BTN_X           : 'X',
1198        BTN_Y           : 'Y',
1199        BTN_Z           : 'Z',
1200        BTN_TL          : 'TL',
1201        BTN_TR          : 'TR',
1202        BTN_TL2         : 'TL2',
1203        BTN_TR2         : 'TR2',
1204        BTN_SELECT      : 'SELECT',
1205        BTN_START       : 'START',
1206        BTN_MODE        : 'MODE',
1207        BTN_THUMBL      : 'THUMBL',
1208        BTN_THUMBR      : 'THUMBR',
1209        BTN_TOOL_PEN    : 'TOOL_PEN',
1210        BTN_TOOL_RUBBER : 'TOOL_RUBBER',
1211        BTN_TOOL_BRUSH  : 'TOOL_BRUSH',
1212        BTN_TOOL_PENCIL : 'TOOL_PENCIL',
1213        BTN_TOOL_AIRBRUSH : 'TOOL_AIRBRUSH',
1214        BTN_TOOL_FINGER : 'TOOL_FINGER',
1215        BTN_TOOL_MOUSE  : 'TOOL_MOUSE',
1216        BTN_TOOL_LENS   : 'TOOL_LENS',
1217        BTN_TOOL_QUINTTAP : 'TOOL_QUINTTAP',
1218        BTN_TOUCH       : 'TOUCH',
1219        BTN_STYLUS      : 'STYLUS',
1220        BTN_STYLUS2     : 'STYLUS2',
1221        BTN_TOOL_DOUBLETAP : 'TOOL_DOUBLETAP',
1222        BTN_TOOL_TRIPLETAP : 'TOOL_TRIPLETAP',
1223        BTN_TOOL_QUADTAP : 'TOOL_QUADTAP',
1224        BTN_GEAR_DOWN   : 'TOOL_GEAR_DOWN',
1225        BTN_GEAR_UP     : 'TOOL_GEAR_UP',
1226    },
1227
1228    # Relative axes
1229    EV_REL: {
1230        REL_X           : 'X',
1231        REL_Y           : 'Y',
1232        REL_Z           : 'Z',
1233        REL_RX          : 'RX',
1234        REL_RY          : 'RY',
1235        REL_RZ          : 'RZ',
1236        REL_HWHEEL      : 'HWHEEL',
1237        REL_DIAL        : 'DIAL',
1238        REL_WHEEL       : 'WHEEL',
1239        REL_MISC        : 'MISC',
1240    },
1241
1242    # Absolute axes
1243    EV_ABS: {
1244        ABS_X               : 'X',
1245        ABS_Y               : 'Y',
1246        ABS_Z               : 'Z',
1247        ABS_RX              : 'RX',
1248        ABS_RY              : 'RY',
1249        ABS_RZ              : 'RZ',
1250        ABS_THROTTLE        : 'THROTTLE',
1251        ABS_RUDDER          : 'RUDDER',
1252        ABS_WHEEL           : 'WHEEL',
1253        ABS_GAS             : 'GAS',
1254        ABS_BRAKE           : 'BRAKE',
1255        ABS_HAT0X           : 'HAT0X',
1256        ABS_HAT0Y           : 'HAT0Y',
1257        ABS_HAT1X           : 'HAT1X',
1258        ABS_HAT1Y           : 'HAT1Y',
1259        ABS_HAT2X           : 'HAT2X',
1260        ABS_HAT2Y           : 'HAT2Y',
1261        ABS_HAT3X           : 'HAT3X',
1262        ABS_HAT3Y           : 'HAT3Y',
1263        ABS_PRESSURE        : 'PRESSURE',
1264        ABS_DISTANCE        : 'DISTANCE',
1265        ABS_TILT_X          : 'TILT_X',
1266        ABS_TILT_Y          : 'TILT_Y',
1267        ABS_TOOL_WIDTH      : 'TOOL_WIDTH',
1268        ABS_VOLUME          : 'VOLUME',
1269        ABS_MISC            : 'MISC',
1270        ABS_MT_SLOT         : 'MT_SLOT',
1271        ABS_MT_TOUCH_MAJOR  : 'MT_TOUCH_MAJOR',
1272        ABS_MT_TOUCH_MINOR  : 'MT_TOUCH_MINOR',
1273        ABS_MT_WIDTH_MAJOR  : 'MT_WIDTH_MAJOR',
1274        ABS_MT_WIDTH_MINOR  : 'MT_WIDTH_MINOR',
1275        ABS_MT_ORIENTATION  : 'MT_ORIENTATION',
1276        ABS_MT_POSITION_X   : 'MT_POSITION_X',
1277        ABS_MT_POSITION_Y   : 'MT_POSITION_Y',
1278        ABS_MT_TOOL_TYPE    : 'MT_TOOL_TYPE',
1279        ABS_MT_BLOB_ID      : 'MT_BLOB_ID',
1280        ABS_MT_TRACKING_ID  : 'MT_TRACKING_ID',
1281        ABS_MT_PRESSURE     : 'MT_PRESSURE',
1282        ABS_MT_DISTANCE     : 'MT_DISTANCE'
1283    },
1284
1285    # Switches
1286    EV_SW: {
1287        SW_LID                  : 'LID',
1288        SW_TABLET_MODE          : 'TABLET_MODE',
1289        SW_HEADPHONE_INSERT     : 'HEADPHONE_INSERT',
1290        SW_RFKILL_ALL           : 'RFKILL_ALL',
1291        SW_MICROPHONE_INSERT    : 'MICROPHONE_INSERT',
1292        SW_DOCK                 : 'DOCK',
1293        SW_LINEOUT_INSERT       : 'LINEOUT_INSERT',
1294        SW_JACK_PHYSICAL_INSERT : 'JACK_PHYSICAL_INSERT',
1295        SW_VIDEOOUT_INSERT      : 'VIDEOOUT_INSERT',
1296        SW_CAMERA_LENS_COVER    : 'CAMERA_LENS_COVER',
1297        SW_KEYPAD_SLIDE         : 'KEYPAD_SLIDE',
1298        SW_FRONT_PROXIMITY      : 'FRONT_PROXIMITY',
1299        SW_ROTATE_LOCK          : 'ROTATE_LOCK',
1300    },
1301
1302    # Misc events
1303    EV_MSC: {
1304        MSC_SERIAL      : 'SERIAL',
1305        MSC_PULSELED    : 'PULSELED',
1306        MSC_GESTURE     : 'GESTURE',
1307        MSC_RAW         : 'RAW',
1308        MSC_SCAN        : 'SCAN',
1309    },
1310
1311    # LEDs
1312    EV_LED: {
1313        LED_NUML        : 'NUML',
1314        LED_CAPSL       : 'CAPSL',
1315        LED_SCROLLL     : 'SCROLLL',
1316        LED_COMPOSE     : 'COMPOSE',
1317        LED_KANA        : 'KANA',
1318        LED_SLEEP       : 'SLEEP',
1319        LED_SUSPEND     : 'SLEEP',
1320        LED_MUTE        : 'SLEEP',
1321        LED_MISC        : 'SLEEP',
1322        LED_MAIL        : 'SLEEP',
1323        LED_CHARGING    : 'SLEEP',
1324    },
1325
1326    # Autorepeat values
1327    EV_REP: {
1328        REP_DELAY       : 'DELAY',
1329        REP_PERIOD      : 'PERIOD',
1330    },
1331
1332    # Sounds
1333    EV_SND: {
1334        SND_CLICK       : 'CLICK',
1335        SND_BELL        : 'BELL'
1336    }
1337}
1338