-
Notifications
You must be signed in to change notification settings - Fork 5
/
inputs.py
3686 lines (3253 loc) · 123 KB
/
inputs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""NOTE - THIS IS A MODIFIED VERSION OF https://github.com/zeth/inputs
EDITED TO FIX ISSUE #7.TODO SWITCH FROM USING THIS TO USING PYGAME
Inputs - user input for humans.
Inputs aims to provide easy to use, cross-platform, user input device
support for Python. I.e. keyboards, mice, gamepads, etc.
Currently supported platforms are the Raspberry Pi, Linux, Windows and
Mac OS X.
"""
# Copyright (c) 2016, 2018: Zeth
# All rights reserved.
#
# BSD Licence
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from __future__ import print_function
from __future__ import division
import os
import sys
import io
import glob
import struct
import platform
import math
import time
import codecs
from warnings import warn
from itertools import count
from operator import itemgetter
from multiprocessing import Process, Pipe
import ctypes
__version__ = "0.5"
WIN = True if platform.system() == 'Windows' else False
MAC = True if platform.system() == 'Darwin' else False
NIX = True if platform.system() == 'Linux' else False
if WIN:
# pylint: disable=wrong-import-position
import ctypes.wintypes
DWORD = ctypes.wintypes.DWORD
HANDLE = ctypes.wintypes.HANDLE
WPARAM = ctypes.wintypes.WPARAM
LPARAM = ctypes.wintypes.WPARAM
MSG = ctypes.wintypes.MSG
else:
DWORD = ctypes.c_ulong
HANDLE = ctypes.c_void_p
WPARAM = ctypes.c_ulonglong
LPARAM = ctypes.c_ulonglong
MSG = ctypes.Structure
if NIX:
from fcntl import ioctl
OLD = sys.version_info < (3, 4)
PERMISSIONS_ERROR_TEXT = (
"The user (that this program is being run as) does "
"not have permission to access the input events, "
"check groups and permissions, for example, on "
"Debian, the user needs to be in the input group.")
# Standard event format for most devices.
# long, long, unsigned short, unsigned short, int
EVENT_FORMAT = str('llHHi')
EVENT_SIZE = struct.calcsize(EVENT_FORMAT)
def chunks(raw):
"""Yield successive EVENT_SIZE sized chunks from raw."""
for i in range(0, len(raw), EVENT_SIZE):
yield struct.unpack(EVENT_FORMAT, raw[i:i+EVENT_SIZE])
if OLD:
def iter_unpack(raw):
"""Yield successive EVENT_SIZE chunks from message."""
return chunks(raw)
else:
def iter_unpack(raw):
"""Yield successive EVENT_SIZE chunks from message."""
return struct.iter_unpack(EVENT_FORMAT, raw)
def convert_timeval(seconds_since_epoch):
"""Convert time into C style timeval."""
frac, whole = math.modf(seconds_since_epoch)
microseconds = math.floor(frac * 1000000)
seconds = math.floor(whole)
return seconds, microseconds
SPECIAL_DEVICES = (
("Raspberry Pi Sense HAT Joystick",
"/dev/input/by-id/gpio-Raspberry_Pi_Sense_HAT_Joystick-event-kbd"),
("Nintendo Wii Remote",
"/dev/input/by-id/bluetooth-Nintendo_Wii_Remote-event-joystick"),
("FT5406 memory based driver",
"/dev/input/by-id/gpio-Raspberry_Pi_Touchscreen_Display-event-mouse"),
)
XINPUT_MAPPING = (
(1, 0x11),
(2, 0x11),
(3, 0x10),
(4, 0x10),
(5, 0x13a),
(6, 0x13b),
(7, 0x13d),
(8, 0x13e),
(9, 0x136),
(10, 0x137),
(13, 0x130),
(14, 0x131),
(15, 0x134),
(16, 0x133),
(17, 0x11),
('l_thumb_x', 0x00),
('l_thumb_y', 0x01),
('left_trigger', 0x02),
('r_thumb_x', 0x03),
('r_thumb_y', 0x04),
('right_trigger', 0x05),
)
XINPUT_DLL_NAMES = (
"XInput1_4.dll",
"XInput9_1_0.dll",
"XInput1_3.dll",
"XInput1_2.dll",
"XInput1_1.dll"
)
XINPUT_ERROR_DEVICE_NOT_CONNECTED = 1167
XINPUT_ERROR_SUCCESS = 0
XBOX_STYLE_LED_CONTROL = {
0: 'off',
1: 'all blink, then previous setting',
2: '1/top-left blink, then on',
3: '2/top-right blink, then on',
4: '3/bottom-left blink, then on',
5: '4/bottom-right blink, then on',
6: '1/top-left on',
7: '2/top-right on',
8: '3/bottom-left on',
9: '4/bottom-right on',
10: 'rotate',
11: 'blink, based on previous setting',
12: 'slow blink, based on previous setting',
13: 'rotate with two lights',
14: 'persistent slow all blink',
15: 'blink once, then previous setting'
}
DEVICE_PROPERTIES = (
(0x00, "INPUT_PROP_POINTER"), # needs a pointer
(0x01, "INPUT_PROP_DIRECT"), # direct input devices
(0x02, "INPUT_PROP_BUTTONPAD"), # has button(s) under pad
(0x03, "INPUT_PROP_SEMI_MT"), # touch rectangle only
(0x04, "INPUT_PROP_TOPBUTTONPAD"), # softbuttons at top of pad
(0x05, "INPUT_PROP_POINTING_STICK"), # is a pointing stick
(0x06, "INPUT_PROP_ACCELEROMETER"), # has accelerometer
(0x1f, "INPUT_PROP_MAX"),
(0x1f + 1, "INPUT_PROP_CNT"))
EVENT_TYPES = (
(0x00, "Sync"),
(0x01, "Key"),
(0x02, "Relative"),
(0x03, "Absolute"),
(0x04, "Misc"),
(0x05, "Switch"),
(0x11, "LED"),
(0x12, "Sound"),
(0x14, "Repeat"),
(0x15, "ForceFeedback"),
(0x16, "Power"),
(0x17, "ForceFeedbackStatus"),
(0x1f, "Max"),
(0x1f+1, "Current"))
SYNCHRONIZATION_EVENTS = (
(0, "SYN_REPORT"),
(1, "SYN_CONFIG"),
(2, "SYN_MT_REPORT"),
(3, "SYN_DROPPED"),
(0xf, "SYN_MAX"),
(0xf+1, "SYN_CNT"))
KEYS_AND_BUTTONS = (
(0, "KEY_RESERVED"),
(1, "KEY_ESC"),
(2, "KEY_1"),
(3, "KEY_2"),
(4, "KEY_3"),
(5, "KEY_4"),
(6, "KEY_5"),
(7, "KEY_6"),
(8, "KEY_7"),
(9, "KEY_8"),
(10, "KEY_9"),
(11, "KEY_0"),
(12, "KEY_MINUS"),
(13, "KEY_EQUAL"),
(14, "KEY_BACKSPACE"),
(15, "KEY_TAB"),
(16, "KEY_Q"),
(17, "KEY_W"),
(18, "KEY_E"),
(19, "KEY_R"),
(20, "KEY_T"),
(21, "KEY_Y"),
(22, "KEY_U"),
(23, "KEY_I"),
(24, "KEY_O"),
(25, "KEY_P"),
(26, "KEY_LEFTBRACE"),
(27, "KEY_RIGHTBRACE"),
(28, "KEY_ENTER"),
(29, "KEY_LEFTCTRL"),
(30, "KEY_A"),
(31, "KEY_S"),
(32, "KEY_D"),
(33, "KEY_F"),
(34, "KEY_G"),
(35, "KEY_H"),
(36, "KEY_J"),
(37, "KEY_K"),
(38, "KEY_L"),
(39, "KEY_SEMICOLON"),
(40, "KEY_APOSTROPHE"),
(41, "KEY_GRAVE"),
(42, "KEY_LEFTSHIFT"),
(43, "KEY_BACKSLASH"),
(44, "KEY_Z"),
(45, "KEY_X"),
(46, "KEY_C"),
(47, "KEY_V"),
(48, "KEY_B"),
(49, "KEY_N"),
(50, "KEY_M"),
(51, "KEY_COMMA"),
(52, "KEY_DOT"),
(53, "KEY_SLASH"),
(54, "KEY_RIGHTSHIFT"),
(55, "KEY_KPASTERISK"),
(56, "KEY_LEFTALT"),
(57, "KEY_SPACE"),
(58, "KEY_CAPSLOCK"),
(59, "KEY_F1"),
(60, "KEY_F2"),
(61, "KEY_F3"),
(62, "KEY_F4"),
(63, "KEY_F5"),
(64, "KEY_F6"),
(65, "KEY_F7"),
(66, "KEY_F8"),
(67, "KEY_F9"),
(68, "KEY_F10"),
(69, "KEY_NUMLOCK"),
(70, "KEY_SCROLLLOCK"),
(71, "KEY_KP7"),
(72, "KEY_KP8"),
(73, "KEY_KP9"),
(74, "KEY_KPMINUS"),
(75, "KEY_KP4"),
(76, "KEY_KP5"),
(77, "KEY_KP6"),
(78, "KEY_KPPLUS"),
(79, "KEY_KP1"),
(80, "KEY_KP2"),
(81, "KEY_KP3"),
(82, "KEY_KP0"),
(83, "KEY_KPDOT"),
(85, "KEY_ZENKAKUHANKAKU"),
(86, "KEY_102ND"),
(87, "KEY_F11"),
(88, "KEY_F12"),
(89, "KEY_RO"),
(90, "KEY_KATAKANA"),
(91, "KEY_HIRAGANA"),
(92, "KEY_HENKAN"),
(93, "KEY_KATAKANAHIRAGANA"),
(94, "KEY_MUHENKAN"),
(95, "KEY_KPJPCOMMA"),
(96, "KEY_KPENTER"),
(97, "KEY_RIGHTCTRL"),
(98, "KEY_KPSLASH"),
(99, "KEY_SYSRQ"),
(100, "KEY_RIGHTALT"),
(101, "KEY_LINEFEED"),
(102, "KEY_HOME"),
(103, "KEY_UP"),
(104, "KEY_PAGEUP"),
(105, "KEY_LEFT"),
(106, "KEY_RIGHT"),
(107, "KEY_END"),
(108, "KEY_DOWN"),
(109, "KEY_PAGEDOWN"),
(110, "KEY_INSERT"),
(111, "KEY_DELETE"),
(112, "KEY_MACRO"),
(113, "KEY_MUTE"),
(114, "KEY_VOLUMEDOWN"),
(115, "KEY_VOLUMEUP"),
(116, "KEY_POWER"), # SC System Power Down
(117, "KEY_KPEQUAL"),
(118, "KEY_KPPLUSMINUS"),
(119, "KEY_PAUSE"),
(120, "KEY_SCALE"), # AL Compiz Scale (Expose)
(121, "KEY_KPCOMMA"),
(122, "KEY_HANGEUL"),
(123, "KEY_HANJA"),
(124, "KEY_YEN"),
(125, "KEY_LEFTMETA"),
(126, "KEY_RIGHTMETA"),
(127, "KEY_COMPOSE"),
(128, "KEY_STOP"), # AC Stop
(129, "KEY_AGAIN"),
(130, "KEY_PROPS"), # AC Properties
(131, "KEY_UNDO"), # AC Undo
(132, "KEY_FRONT"),
(133, "KEY_COPY"), # AC Copy
(134, "KEY_OPEN"), # AC Open
(135, "KEY_PASTE"), # AC Paste
(136, "KEY_FIND"), # AC Search
(137, "KEY_CUT"), # AC Cut
(138, "KEY_HELP"), # AL Integrated Help Center
(139, "KEY_MENU"), # Menu (show menu)
(140, "KEY_CALC"), # AL Calculator
(141, "KEY_SETUP"),
(142, "KEY_SLEEP"), # SC System Sleep
(143, "KEY_WAKEUP"), # System Wake Up
(144, "KEY_FILE"), # AL Local Machine Browser
(145, "KEY_SENDFILE"),
(146, "KEY_DELETEFILE"),
(147, "KEY_XFER"),
(148, "KEY_PROG1"),
(149, "KEY_PROG2"),
(150, "KEY_WWW"), # AL Internet Browser
(151, "KEY_MSDOS"),
(152, "KEY_COFFEE"), # AL Terminal Lock/Screensaver
(153, "KEY_ROTATE_DISPLAY"), # Display orientation for e.g. tablets
(154, "KEY_CYCLEWINDOWS"),
(155, "KEY_MAIL"),
(156, "KEY_BOOKMARKS"), # AC Bookmarks
(157, "KEY_COMPUTER"),
(158, "KEY_BACK"), # AC Back
(159, "KEY_FORWARD"), # AC Forward
(160, "KEY_CLOSECD"),
(161, "KEY_EJECTCD"),
(162, "KEY_EJECTCLOSECD"),
(163, "KEY_NEXTSONG"),
(164, "KEY_PLAYPAUSE"),
(165, "KEY_PREVIOUSSONG"),
(166, "KEY_STOPCD"),
(167, "KEY_RECORD"),
(168, "KEY_REWIND"),
(169, "KEY_PHONE"), # Media Select Telephone
(170, "KEY_ISO"),
(171, "KEY_CONFIG"), # AL Consumer Control Configuration
(172, "KEY_HOMEPAGE"), # AC Home
(173, "KEY_REFRESH"), # AC Refresh
(174, "KEY_EXIT"), # AC Exit
(175, "KEY_MOVE"),
(176, "KEY_EDIT"),
(177, "KEY_SCROLLUP"),
(178, "KEY_SCROLLDOWN"),
(179, "KEY_KPLEFTPAREN"),
(180, "KEY_KPRIGHTPAREN"),
(181, "KEY_NEW"), # AC New
(182, "KEY_REDO"), # AC Redo/Repeat
(183, "KEY_F13"),
(184, "KEY_F14"),
(185, "KEY_F15"),
(186, "KEY_F16"),
(187, "KEY_F17"),
(188, "KEY_F18"),
(189, "KEY_F19"),
(190, "KEY_F20"),
(191, "KEY_F21"),
(192, "KEY_F22"),
(193, "KEY_F23"),
(194, "KEY_F24"),
(200, "KEY_PLAYCD"),
(201, "KEY_PAUSECD"),
(202, "KEY_PROG3"),
(203, "KEY_PROG4"),
(204, "KEY_DASHBOARD"), # AL Dashboard
(205, "KEY_SUSPEND"),
(206, "KEY_CLOSE"), # AC Close
(207, "KEY_PLAY"),
(208, "KEY_FASTFORWARD"),
(209, "KEY_BASSBOOST"),
(210, "KEY_PRINT"), # AC Print
(211, "KEY_HP"),
(212, "KEY_CAMERA"),
(213, "KEY_SOUND"),
(214, "KEY_QUESTION"),
(215, "KEY_EMAIL"),
(216, "KEY_CHAT"),
(217, "KEY_SEARCH"),
(218, "KEY_CONNECT"),
(219, "KEY_FINANCE"), # AL Checkbook/Finance
(220, "KEY_SPORT"),
(221, "KEY_SHOP"),
(222, "KEY_ALTERASE"),
(223, "KEY_CANCEL"), # AC Cancel
(224, "KEY_BRIGHTNESSDOWN"),
(225, "KEY_BRIGHTNESSUP"),
(226, "KEY_MEDIA"),
(227, "KEY_SWITCHVIDEOMODE"), # Cycle between available video
(228, "KEY_KBDILLUMTOGGLE"),
(229, "KEY_KBDILLUMDOWN"),
(230, "KEY_KBDILLUMUP"),
(231, "KEY_SEND"), # AC Send
(232, "KEY_REPLY"), # AC Reply
(233, "KEY_FORWARDMAIL"), # AC Forward Msg
(234, "KEY_SAVE"), # AC Save
(235, "KEY_DOCUMENTS"),
(236, "KEY_BATTERY"),
(237, "KEY_BLUETOOTH"),
(238, "KEY_WLAN"),
(239, "KEY_UWB"),
(240, "KEY_UNKNOWN"),
(241, "KEY_VIDEO_NEXT"), # drive next video source
(242, "KEY_VIDEO_PREV"), # drive previous video source
(243, "KEY_BRIGHTNESS_CYCLE"), # brightness up, after max is min
(244, "KEY_BRIGHTNESS_AUTO"), # Set Auto Brightness: manual
(245, "KEY_DISPLAY_OFF"), # display device to off state
(246, "KEY_WWAN"), # Wireless WAN (LTE, UMTS, GSM, etc.)
(247, "KEY_RFKILL"), # Key that controls all radios
(248, "KEY_MICMUTE"), # Mute / unmute the microphone
(0x100, "BTN_MISC"),
(0x100, "BTN_0"),
(0x101, "BTN_1"),
(0x102, "BTN_2"),
(0x103, "BTN_3"),
(0x104, "BTN_4"),
(0x105, "BTN_5"),
(0x106, "BTN_6"),
(0x107, "BTN_7"),
(0x108, "BTN_8"),
(0x109, "BTN_9"),
(0x110, "BTN_MOUSE"),
(0x110, "BTN_LEFT"),
(0x111, "BTN_RIGHT"),
(0x112, "BTN_MIDDLE"),
(0x113, "BTN_SIDE"),
(0x114, "BTN_EXTRA"),
(0x115, "BTN_FORWARD"),
(0x116, "BTN_BACK"),
(0x117, "BTN_TASK"),
(0x120, "BTN_JOYSTICK"),
(0x120, "BTN_TRIGGER"),
(0x121, "BTN_THUMB"),
(0x122, "BTN_THUMB2"),
(0x123, "BTN_TOP"),
(0x124, "BTN_TOP2"),
(0x125, "BTN_PINKIE"),
(0x126, "BTN_BASE"),
(0x127, "BTN_BASE2"),
(0x128, "BTN_BASE3"),
(0x129, "BTN_BASE4"),
(0x12a, "BTN_BASE5"),
(0x12b, "BTN_BASE6"),
(0x12f, "BTN_DEAD"),
(0x130, "BTN_GAMEPAD"),
(0x130, "BTN_SOUTH"),
(0x131, "BTN_EAST"),
(0x132, "BTN_C"),
(0x133, "BTN_NORTH"),
(0x134, "BTN_WEST"),
(0x135, "BTN_Z"),
(0x136, "BTN_TL"),
(0x137, "BTN_TR"),
(0x138, "BTN_TL2"),
(0x139, "BTN_TR2"),
(0x13a, "BTN_SELECT"),
(0x13b, "BTN_START"),
(0x13c, "BTN_MODE"),
(0x13d, "BTN_THUMBL"),
(0x13e, "BTN_THUMBR"),
(0x140, "BTN_DIGI"),
(0x140, "BTN_TOOL_PEN"),
(0x141, "BTN_TOOL_RUBBER"),
(0x142, "BTN_TOOL_BRUSH"),
(0x143, "BTN_TOOL_PENCIL"),
(0x144, "BTN_TOOL_AIRBRUSH"),
(0x145, "BTN_TOOL_FINGER"),
(0x146, "BTN_TOOL_MOUSE"),
(0x147, "BTN_TOOL_LENS"),
(0x148, "BTN_TOOL_QUINTTAP"), # Five fingers on trackpad
(0x14a, "BTN_TOUCH"),
(0x14b, "BTN_STYLUS"),
(0x14c, "BTN_STYLUS2"),
(0x14d, "BTN_TOOL_DOUBLETAP"),
(0x14e, "BTN_TOOL_TRIPLETAP"),
(0x14f, "BTN_TOOL_QUADTAP"), # Four fingers on trackpad
(0x150, "BTN_WHEEL"),
(0x150, "BTN_GEAR_DOWN"),
(0x151, "BTN_GEAR_UP"),
(0x160, "KEY_OK"),
(0x161, "KEY_SELECT"),
(0x162, "KEY_GOTO"),
(0x163, "KEY_CLEAR"),
(0x164, "KEY_POWER2"),
(0x165, "KEY_OPTION"),
(0x166, "KEY_INFO"), # AL OEM Features/Tips/Tutorial
(0x167, "KEY_TIME"),
(0x168, "KEY_VENDOR"),
(0x169, "KEY_ARCHIVE"),
(0x16a, "KEY_PROGRAM"), # Media Select Program Guide
(0x16b, "KEY_CHANNEL"),
(0x16c, "KEY_FAVORITES"),
(0x16d, "KEY_EPG"),
(0x16e, "KEY_PVR"), # Media Select Home
(0x16f, "KEY_MHP"),
(0x170, "KEY_LANGUAGE"),
(0x171, "KEY_TITLE"),
(0x172, "KEY_SUBTITLE"),
(0x173, "KEY_ANGLE"),
(0x174, "KEY_ZOOM"),
(0x175, "KEY_MODE"),
(0x176, "KEY_KEYBOARD"),
(0x177, "KEY_SCREEN"),
(0x178, "KEY_PC"), # Media Select Computer
(0x179, "KEY_TV"), # Media Select TV
(0x17a, "KEY_TV2"), # Media Select Cable
(0x17b, "KEY_VCR"), # Media Select VCR
(0x17c, "KEY_VCR2"), # VCR Plus
(0x17d, "KEY_SAT"), # Media Select Satellite
(0x17e, "KEY_SAT2"),
(0x17f, "KEY_CD"), # Media Select CD
(0x180, "KEY_TAPE"), # Media Select Tape
(0x181, "KEY_RADIO"),
(0x182, "KEY_TUNER"), # Media Select Tuner
(0x183, "KEY_PLAYER"),
(0x184, "KEY_TEXT"),
(0x185, "KEY_DVD"), # Media Select DVD
(0x186, "KEY_AUX"),
(0x187, "KEY_MP3"),
(0x188, "KEY_AUDIO"), # AL Audio Browser
(0x189, "KEY_VIDEO"), # AL Movie Browser
(0x18a, "KEY_DIRECTORY"),
(0x18b, "KEY_LIST"),
(0x18c, "KEY_MEMO"), # Media Select Messages
(0x18d, "KEY_CALENDAR"),
(0x18e, "KEY_RED"),
(0x18f, "KEY_GREEN"),
(0x190, "KEY_YELLOW"),
(0x191, "KEY_BLUE"),
(0x192, "KEY_CHANNELUP"), # Channel Increment
(0x193, "KEY_CHANNELDOWN"), # Channel Decrement
(0x194, "KEY_FIRST"),
(0x195, "KEY_LAST"), # Recall Last
(0x196, "KEY_AB"),
(0x197, "KEY_NEXT"),
(0x198, "KEY_RESTART"),
(0x199, "KEY_SLOW"),
(0x19a, "KEY_SHUFFLE"),
(0x19b, "KEY_BREAK"),
(0x19c, "KEY_PREVIOUS"),
(0x19d, "KEY_DIGITS"),
(0x19e, "KEY_TEEN"),
(0x19f, "KEY_TWEN"),
(0x1a0, "KEY_VIDEOPHONE"), # Media Select Video Phone
(0x1a1, "KEY_GAMES"), # Media Select Games
(0x1a2, "KEY_ZOOMIN"), # AC Zoom In
(0x1a3, "KEY_ZOOMOUT"), # AC Zoom Out
(0x1a4, "KEY_ZOOMRESET"), # AC Zoom
(0x1a5, "KEY_WORDPROCESSOR"), # AL Word Processor
(0x1a6, "KEY_EDITOR"), # AL Text Editor
(0x1a7, "KEY_SPREADSHEET"), # AL Spreadsheet
(0x1a8, "KEY_GRAPHICSEDITOR"), # AL Graphics Editor
(0x1a9, "KEY_PRESENTATION"), # AL Presentation App
(0x1aa, "KEY_DATABASE"), # AL Database App
(0x1ab, "KEY_NEWS"), # AL Newsreader
(0x1ac, "KEY_VOICEMAIL"), # AL Voicemail
(0x1ad, "KEY_ADDRESSBOOK"), # AL Contacts/Address Book
(0x1ae, "KEY_MESSENGER"), # AL Instant Messaging
(0x1af, "KEY_DISPLAYTOGGLE"), # Turn display (LCD) on and off
(0x1b0, "KEY_SPELLCHECK"), # AL Spell Check
(0x1b1, "KEY_LOGOFF"), # AL Logoff
(0x1b2, "KEY_DOLLAR"),
(0x1b3, "KEY_EURO"),
(0x1b4, "KEY_FRAMEBACK"), # Consumer - transport controls
(0x1b5, "KEY_FRAMEFORWARD"),
(0x1b6, "KEY_CONTEXT_MENU"), # GenDesc - system context menu
(0x1b7, "KEY_MEDIA_REPEAT"), # Consumer - transport control
(0x1b8, "KEY_10CHANNELSUP"), # 10 channels up (10+)
(0x1b9, "KEY_10CHANNELSDOWN"), # 10 channels down (10-)
(0x1ba, "KEY_IMAGES"), # AL Image Browser
(0x1c0, "KEY_DEL_EOL"),
(0x1c1, "KEY_DEL_EOS"),
(0x1c2, "KEY_INS_LINE"),
(0x1c3, "KEY_DEL_LINE"),
(0x1d0, "KEY_FN"),
(0x1d1, "KEY_FN_ESC"),
(0x1d2, "KEY_FN_F1"),
(0x1d3, "KEY_FN_F2"),
(0x1d4, "KEY_FN_F3"),
(0x1d5, "KEY_FN_F4"),
(0x1d6, "KEY_FN_F5"),
(0x1d7, "KEY_FN_F6"),
(0x1d8, "KEY_FN_F7"),
(0x1d9, "KEY_FN_F8"),
(0x1da, "KEY_FN_F9"),
(0x1db, "KEY_FN_F10"),
(0x1dc, "KEY_FN_F11"),
(0x1dd, "KEY_FN_F12"),
(0x1de, "KEY_FN_1"),
(0x1df, "KEY_FN_2"),
(0x1e0, "KEY_FN_D"),
(0x1e1, "KEY_FN_E"),
(0x1e2, "KEY_FN_F"),
(0x1e3, "KEY_FN_S"),
(0x1e4, "KEY_FN_B"),
(0x1f1, "KEY_BRL_DOT1"),
(0x1f2, "KEY_BRL_DOT2"),
(0x1f3, "KEY_BRL_DOT3"),
(0x1f4, "KEY_BRL_DOT4"),
(0x1f5, "KEY_BRL_DOT5"),
(0x1f6, "KEY_BRL_DOT6"),
(0x1f7, "KEY_BRL_DOT7"),
(0x1f8, "KEY_BRL_DOT8"),
(0x1f9, "KEY_BRL_DOT9"),
(0x1fa, "KEY_BRL_DOT10"),
(0x200, "KEY_NUMERIC_0"), # used by phones, remote controls,
(0x201, "KEY_NUMERIC_1"), # and other keypads
(0x202, "KEY_NUMERIC_2"),
(0x203, "KEY_NUMERIC_3"),
(0x204, "KEY_NUMERIC_4"),
(0x205, "KEY_NUMERIC_5"),
(0x206, "KEY_NUMERIC_6"),
(0x207, "KEY_NUMERIC_7"),
(0x208, "KEY_NUMERIC_8"),
(0x209, "KEY_NUMERIC_9"),
(0x20a, "KEY_NUMERIC_STAR"),
(0x20b, "KEY_NUMERIC_POUND"),
(0x20c, "KEY_NUMERIC_A"), # Phone key A - HUT Telephony 0xb9
(0x20d, "KEY_NUMERIC_B"),
(0x20e, "KEY_NUMERIC_C"),
(0x20f, "KEY_NUMERIC_D"),
(0x210, "KEY_CAMERA_FOCUS"),
(0x211, "KEY_WPS_BUTTON"), # WiFi Protected Setup key
(0x212, "KEY_TOUCHPAD_TOGGLE"), # Request switch touchpad on or off
(0x213, "KEY_TOUCHPAD_ON"),
(0x214, "KEY_TOUCHPAD_OFF"),
(0x215, "KEY_CAMERA_ZOOMIN"),
(0x216, "KEY_CAMERA_ZOOMOUT"),
(0x217, "KEY_CAMERA_UP"),
(0x218, "KEY_CAMERA_DOWN"),
(0x219, "KEY_CAMERA_LEFT"),
(0x21a, "KEY_CAMERA_RIGHT"),
(0x21b, "KEY_ATTENDANT_ON"),
(0x21c, "KEY_ATTENDANT_OFF"),
(0x21d, "KEY_ATTENDANT_TOGGLE"), # Attendant call on or off
(0x21e, "KEY_LIGHTS_TOGGLE"), # Reading light on or off
(0x220, "BTN_DPAD_UP"),
(0x221, "BTN_DPAD_DOWN"),
(0x222, "BTN_DPAD_LEFT"),
(0x223, "BTN_DPAD_RIGHT"),
(0x230, "KEY_ALS_TOGGLE"), # Ambient light sensor
(0x240, "KEY_BUTTONCONFIG"), # AL Button Configuration
(0x241, "KEY_TASKMANAGER"), # AL Task/Project Manager
(0x242, "KEY_JOURNAL"), # AL Log/Journal/Timecard
(0x243, "KEY_CONTROLPANEL"), # AL Control Panel
(0x244, "KEY_APPSELECT"), # AL Select Task/Application
(0x245, "KEY_SCREENSAVER"), # AL Screen Saver
(0x246, "KEY_VOICECOMMAND"), # Listening Voice Command
(0x250, "KEY_BRIGHTNESS_MIN"), # Set Brightness to Minimum
(0x251, "KEY_BRIGHTNESS_MAX"), # Set Brightness to Maximum
(0x260, "KEY_KBDINPUTASSIST_PREV"),
(0x261, "KEY_KBDINPUTASSIST_NEXT"),
(0x262, "KEY_KBDINPUTASSIST_PREVGROUP"),
(0x263, "KEY_KBDINPUTASSIST_NEXTGROUP"),
(0x264, "KEY_KBDINPUTASSIST_ACCEPT"),
(0x265, "KEY_KBDINPUTASSIST_CANCEL"),
(0x2c0, "BTN_TRIGGER_HAPPY"),
(0x2c0, "BTN_TRIGGER_HAPPY1"),
(0x2c1, "BTN_TRIGGER_HAPPY2"),
(0x2c2, "BTN_TRIGGER_HAPPY3"),
(0x2c3, "BTN_TRIGGER_HAPPY4"),
(0x2c4, "BTN_TRIGGER_HAPPY5"),
(0x2c5, "BTN_TRIGGER_HAPPY6"),
(0x2c6, "BTN_TRIGGER_HAPPY7"),
(0x2c7, "BTN_TRIGGER_HAPPY8"),
(0x2c8, "BTN_TRIGGER_HAPPY9"),
(0x2c9, "BTN_TRIGGER_HAPPY10"),
(0x2ca, "BTN_TRIGGER_HAPPY11"),
(0x2cb, "BTN_TRIGGER_HAPPY12"),
(0x2cc, "BTN_TRIGGER_HAPPY13"),
(0x2cd, "BTN_TRIGGER_HAPPY14"),
(0x2ce, "BTN_TRIGGER_HAPPY15"),
(0x2cf, "BTN_TRIGGER_HAPPY16"),
(0x2d0, "BTN_TRIGGER_HAPPY17"),
(0x2d1, "BTN_TRIGGER_HAPPY18"),
(0x2d2, "BTN_TRIGGER_HAPPY19"),
(0x2d3, "BTN_TRIGGER_HAPPY20"),
(0x2d4, "BTN_TRIGGER_HAPPY21"),
(0x2d5, "BTN_TRIGGER_HAPPY22"),
(0x2d6, "BTN_TRIGGER_HAPPY23"),
(0x2d7, "BTN_TRIGGER_HAPPY24"),
(0x2d8, "BTN_TRIGGER_HAPPY25"),
(0x2d9, "BTN_TRIGGER_HAPPY26"),
(0x2da, "BTN_TRIGGER_HAPPY27"),
(0x2db, "BTN_TRIGGER_HAPPY28"),
(0x2dc, "BTN_TRIGGER_HAPPY29"),
(0x2dd, "BTN_TRIGGER_HAPPY30"),
(0x2de, "BTN_TRIGGER_HAPPY31"),
(0x2df, "BTN_TRIGGER_HAPPY32"),
(0x2e0, "BTN_TRIGGER_HAPPY33"),
(0x2e1, "BTN_TRIGGER_HAPPY34"),
(0x2e2, "BTN_TRIGGER_HAPPY35"),
(0x2e3, "BTN_TRIGGER_HAPPY36"),
(0x2e4, "BTN_TRIGGER_HAPPY37"),
(0x2e5, "BTN_TRIGGER_HAPPY38"),
(0x2e6, "BTN_TRIGGER_HAPPY39"),
(0x2e7, "BTN_TRIGGER_HAPPY40"),
(0x2ff, "KEY_MAX"),
(0x2ff+1, "KEY_CNT"))
RELATIVE_AXES = (
(0x00, "REL_X"),
(0x01, "REL_Y"),
(0x02, "REL_Z"),
(0x03, "REL_RX"),
(0x04, "REL_RY"),
(0x05, "REL_RZ"),
(0x06, "REL_HWHEEL"),
(0x07, "REL_DIAL"),
(0x08, "REL_WHEEL"),
(0x09, "REL_MISC"),
(0x0f, "REL_MAX"),
(0x0f+1, "REL_CNT"))
ABSOLUTE_AXES = (
(0x00, "ABS_X"),
(0x01, "ABS_Y"),
(0x02, "ABS_Z"),
(0x03, "ABS_RX"),
(0x04, "ABS_RY"),
(0x05, "ABS_RZ"),
(0x06, "ABS_THROTTLE"),
(0x07, "ABS_RUDDER"),
(0x08, "ABS_WHEEL"),
(0x09, "ABS_GAS"),
(0x0a, "ABS_BRAKE"),
(0x10, "ABS_HAT0X"),
(0x11, "ABS_HAT0Y"),
(0x12, "ABS_HAT1X"),
(0x13, "ABS_HAT1Y"),
(0x14, "ABS_HAT2X"),
(0x15, "ABS_HAT2Y"),
(0x16, "ABS_HAT3X"),
(0x17, "ABS_HAT3Y"),
(0x18, "ABS_PRESSURE"),
(0x19, "ABS_DISTANCE"),
(0x1a, "ABS_TILT_X"),
(0x1b, "ABS_TILT_Y"),
(0x1c, "ABS_TOOL_WIDTH"),
(0x20, "ABS_VOLUME"),
(0x28, "ABS_MISC"),
(0x2f, "ABS_MT_SLOT"), # MT slot being modified
(0x30, "ABS_MT_TOUCH_MAJOR"), # Major axis of touching ellipse
(0x31, "ABS_MT_TOUCH_MINOR"), # Minor axis (omit if circular)
(0x32, "ABS_MT_WIDTH_MAJOR"), # Major axis of approaching ellipse
(0x33, "ABS_MT_WIDTH_MINOR"), # Minor axis (omit if circular)
(0x34, "ABS_MT_ORIENTATION"), # Ellipse orientation
(0x35, "ABS_MT_POSITION_X"), # Center X touch position
(0x36, "ABS_MT_POSITION_Y"), # Center Y touch position
(0x37, "ABS_MT_TOOL_TYPE"), # Type of touching device
(0x38, "ABS_MT_BLOB_ID"), # Group a set of packets as a blob
(0x39, "ABS_MT_TRACKING_ID"), # Unique ID of initiated contact
(0x3a, "ABS_MT_PRESSURE"), # Pressure on contact area
(0x3b, "ABS_MT_DISTANCE"), # Contact hover distance
(0x3c, "ABS_MT_TOOL_X"), # Center X tool position
(0x3d, "ABS_MT_TOOL_Y"), # Center Y tool position
(0x3f, "ABS_MAX"),
(0x3f+1, "ABS_CNT"))
SWITCH_EVENTS = (
(0x00, "SW_LID"), # set = lid shut
(0x01, "SW_TABLET_MODE"), # set = tablet mode
(0x02, "SW_HEADPHONE_INSERT"), # set = inserted
(0x03, "SW_RFKILL_ALL"), # rfkill master switch, type "any"
(0x04, "SW_MICROPHONE_INSERT"), # set = inserted
(0x05, "SW_DOCK"), # set = plugged into dock
(0x06, "SW_LINEOUT_INSERT"), # set = inserted
(0x07, "SW_JACK_PHYSICAL_INSERT"), # set = mechanical switch set
(0x08, "SW_VIDEOOUT_INSERT"), # set = inserted
(0x09, "SW_CAMERA_LENS_COVER"), # set = lens covered
(0x0a, "SW_KEYPAD_SLIDE"), # set = keypad slide out
(0x0b, "SW_FRONT_PROXIMITY"), # set = front proximity sensor active
(0x0c, "SW_ROTATE_LOCK"), # set = rotate locked/disabled
(0x0d, "SW_LINEIN_INSERT"), # set = inserted
(0x0e, "SW_MUTE_DEVICE"), # set = device disabled
(0x0f, "SW_MAX"),
(0x0f+1, "SW_CNT"))
MISC_EVENTS = (
(0x00, "MSC_SERIAL"),
(0x01, "MSC_PULSELED"),
(0x02, "MSC_GESTURE"),
(0x03, "MSC_RAW"),
(0x04, "MSC_SCAN"),
(0x05, "MSC_TIMESTAMP"),
(0x07, "MSC_MAX"),
(0x07+1, "MSC_CNT"))
LEDS = (
(0x00, "LED_NUML"),
(0x01, "LED_CAPSL"),
(0x02, "LED_SCROLLL"),
(0x03, "LED_COMPOSE"),
(0x04, "LED_KANA"),
(0x05, "LED_SLEEP"),
(0x06, "LED_SUSPEND"),
(0x07, "LED_MUTE"),
(0x08, "LED_MISC"),
(0x09, "LED_MAIL"),
(0x0a, "LED_CHARGING"),
(0x0f, "LED_MAX"),
(0x0f+1, "LED_CNT"))
LED_TYPE_CODES = (
('numlock', 0x00),
('capslock', 0x01),
('scrolllock', 0x02),
('compose', 0x03),
('kana', 0x04),
('sleep', 0x05),
('suspend', 0x06),
('mute', 0x07),
('misc', 0x08),
('mail', 0x09),
('charging', 0x0a),
('max', 0x0f),
('cnt', 0x0f+1)
)
AUTOREPEAT_VALUES = (
(0x00, "REP_DELAY"),
(0x01, "REP_PERIOD"),
(0x01, "REP_MAX"),
(0x01+1, "REP_CNT"))
SOUNDS = (
(0x00, "SND_CLICK"),
(0x01, "SND_BELL"),
(0x02, "SND_TONE"),
(0x07, "SND_MAX"),
(0x07+1, "SND_CNT"))
WIN_KEYBOARD_CODES = {
0x0100: 1,
0x0101: 0,
0x104: 1,
0x105: 0,
}
WIN_MOUSE_CODES = {
0x0201: (0x110, 1, 589825), # WM_LBUTTONDOWN --> BTN_LEFT
0x0202: (0x110, 0, 589825), # WM_LBUTTONUP --> BTN_LEFT
0x0204: (0x111, 1, 589826), # WM_RBUTTONDOWN --> BTN_RIGHT
0x0205: (0x111, 0, 589826), # WM_RBUTTONUP --> BTN_RIGHT
0x0207: (0x112, 1, 589827), # WM_MBUTTONDOWN --> BTN_MIDDLE
0x0208: (0x112, 0, 589827), # WM_MBUTTONU --> BTN_MIDDLE
0x020B: (0x113, 1, 589828), # WM_XBUTTONDOWN --> BTN_SIDE
0x020C: (0x113, 0, 589828), # WM_XBUTTONUP --> BTN_SIDE
0x020B2: (0x114, 1, 589829), # WM_XBUTTONDOWN --> BTN_EXTRA
0x020C2: (0x114, 0, 589829), # WM_XBUTTONUP --> BTN_EXTRA
}
# THING SING That thing can sing!
# SONG LONG A long, long song.
# Good-bye, Thing. You sing too long.
# pylint: disable=too-many-lines
WINCODES = (
(0x01, 0x110), # Left mouse button
(0x02, 0x111), # Right mouse button
(0x03, 0), # Control-break processing
(0x04, 0x112), # Middle mouse button (three-button mouse)
(0x05, 0x113), # X1 mouse button
(0x06, 0x114), # X2 mouse button
(0x07, 0), # Undefined
(0x08, 14), # BACKSPACE key
(0x09, 15), # TAB key
(0x0A, 0), # Reserved
(0x0B, 0), # Reserved
(0x0C, 0x163), # CLEAR key
(0x0D, 28), # ENTER key
(0x0E, 0), # Undefined
(0x0F, 0), # Undefined
(0x10, 42), # SHIFT key
(0x11, 29), # CTRL key
(0x12, 56), # ALT key
(0x13, 119), # PAUSE key
(0x14, 58), # CAPS LOCK key
(0x15, 90), # IME Kana mode
(0x15, 91), # IME Hanguel mode (maintained for compatibility; use
# VK_HANGUL)
(0x15, 91), # IME Hangul mode
(0x16, 0), # Undefined
(0x17, 92), # IME Junja mode - These all need to be fixed
(0x18, 93), # IME final mode - By someone who
(0x19, 94), # IME Hanja mode - Knows how
(0x19, 95), # IME Kanji mode - Japanese Keyboards work
(0x1A, 0), # Undefined
(0x1B, 1), # ESC key
(0x1C, 0), # IME convert
(0x1D, 0), # IME nonconvert
(0x1E, 0), # IME accept
(0x1F, 0), # IME mode change request
(0x20, 57), # SPACEBAR
(0x21, 104), # PAGE UP key
(0x22, 109), # PAGE DOWN key
(0x23, 107), # END key
(0x24, 102), # HOME key
(0x25, 105), # LEFT ARROW key
(0x26, 103), # UP ARROW key
(0x27, 106), # RIGHT ARROW key
(0x28, 108), # DOWN ARROW key
(0x29, 0x161), # SELECT key
(0x2A, 210), # PRINT key
(0x2B, 28), # EXECUTE key
(0x2C, 99), # PRINT SCREEN key
(0x2D, 110), # INS key
(0x2E, 111), # DEL key
(0x2F, 138), # HELP key
(0x30, 11), # 0 key
(0x31, 2), # 1 key
(0x32, 3), # 2 key
(0x33, 4), # 3 key
(0x34, 5), # 4 key
(0x35, 6), # 5 key
(0x36, 7), # 6 key
(0x37, 8), # 7 key
(0x38, 9), # 8 key
(0x39, 10), # 9 key
# (0x3A-40, 0), # Undefined
(0x41, 30), # A key
(0x42, 48), # B key
(0x43, 46), # C key
(0x44, 32), # D key
(0x45, 18), # E key
(0x46, 33), # F key
(0x47, 34), # G key
(0x48, 35), # H key
(0x49, 23), # I key
(0x4A, 36), # J key
(0x4B, 37), # K key
(0x4C, 38), # L key
(0x4D, 50), # M key
(0x4E, 49), # N key
(0x4F, 24), # O key
(0x50, 25), # P key
(0x51, 16), # Q key
(0x52, 19), # R key
(0x53, 31), # S key
(0x54, 20), # T key
(0x55, 22), # U key
(0x56, 47), # V key
(0x57, 17), # W key