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