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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
use super::KeyCode;
use super::OsCode;

impl From<KeyCode> for OsCode {
    fn from(item: KeyCode) -> Self {
        match item {
            KeyCode::Escape => OsCode::KEY_ESC,
            KeyCode::Kb1 => OsCode::KEY_1,
            KeyCode::Kb2 => OsCode::KEY_2,
            KeyCode::Kb3 => OsCode::KEY_3,
            KeyCode::Kb4 => OsCode::KEY_4,
            KeyCode::Kb5 => OsCode::KEY_5,
            KeyCode::Kb6 => OsCode::KEY_6,
            KeyCode::Kb7 => OsCode::KEY_7,
            KeyCode::Kb8 => OsCode::KEY_8,
            KeyCode::Kb9 => OsCode::KEY_9,
            KeyCode::Kb0 => OsCode::KEY_0,
            KeyCode::Minus => OsCode::KEY_MINUS,
            KeyCode::Equal => OsCode::KEY_EQUAL,
            KeyCode::BSpace => OsCode::KEY_BACKSPACE,
            KeyCode::Tab => OsCode::KEY_TAB,
            KeyCode::Q => OsCode::KEY_Q,
            KeyCode::W => OsCode::KEY_W,
            KeyCode::E => OsCode::KEY_E,
            KeyCode::R => OsCode::KEY_R,
            KeyCode::T => OsCode::KEY_T,
            KeyCode::Y => OsCode::KEY_Y,
            KeyCode::U => OsCode::KEY_U,
            KeyCode::I => OsCode::KEY_I,
            KeyCode::O => OsCode::KEY_O,
            KeyCode::P => OsCode::KEY_P,
            KeyCode::LBracket => OsCode::KEY_LEFTBRACE,
            KeyCode::RBracket => OsCode::KEY_RIGHTBRACE,
            KeyCode::Enter => OsCode::KEY_ENTER,
            KeyCode::LCtrl => OsCode::KEY_LEFTCTRL,
            KeyCode::A => OsCode::KEY_A,
            KeyCode::S => OsCode::KEY_S,
            KeyCode::D => OsCode::KEY_D,
            KeyCode::F => OsCode::KEY_F,
            KeyCode::G => OsCode::KEY_G,
            KeyCode::H => OsCode::KEY_H,
            KeyCode::J => OsCode::KEY_J,
            KeyCode::K => OsCode::KEY_K,
            KeyCode::L => OsCode::KEY_L,
            KeyCode::SColon => OsCode::KEY_SEMICOLON,
            KeyCode::Quote => OsCode::KEY_APOSTROPHE,
            KeyCode::Grave => OsCode::KEY_GRAVE,
            KeyCode::LShift => OsCode::KEY_LEFTSHIFT,
            KeyCode::Bslash => OsCode::KEY_BACKSLASH,
            KeyCode::Z => OsCode::KEY_Z,
            KeyCode::X => OsCode::KEY_X,
            KeyCode::C => OsCode::KEY_C,
            KeyCode::V => OsCode::KEY_V,
            KeyCode::B => OsCode::KEY_B,
            KeyCode::N => OsCode::KEY_N,
            KeyCode::M => OsCode::KEY_M,
            KeyCode::Comma => OsCode::KEY_COMMA,
            KeyCode::Dot => OsCode::KEY_DOT,
            KeyCode::Slash => OsCode::KEY_SLASH,
            KeyCode::RShift => OsCode::KEY_RIGHTSHIFT,
            KeyCode::KpAsterisk => OsCode::KEY_KPASTERISK,
            KeyCode::LAlt => OsCode::KEY_LEFTALT,
            KeyCode::Space => OsCode::KEY_SPACE,
            KeyCode::CapsLock => OsCode::KEY_CAPSLOCK,
            KeyCode::F1 => OsCode::KEY_F1,
            KeyCode::F2 => OsCode::KEY_F2,
            KeyCode::F3 => OsCode::KEY_F3,
            KeyCode::F4 => OsCode::KEY_F4,
            KeyCode::F5 => OsCode::KEY_F5,
            KeyCode::F6 => OsCode::KEY_F6,
            KeyCode::F7 => OsCode::KEY_F7,
            KeyCode::F8 => OsCode::KEY_F8,
            KeyCode::F9 => OsCode::KEY_F9,
            KeyCode::F10 => OsCode::KEY_F10,
            KeyCode::NumLock => OsCode::KEY_NUMLOCK,
            KeyCode::Clear => OsCode::KEY_CLEAR,
            KeyCode::ScrollLock => OsCode::KEY_SCROLLLOCK,
            KeyCode::Kp7 => OsCode::KEY_KP7,
            KeyCode::Kp8 => OsCode::KEY_KP8,
            KeyCode::Kp9 => OsCode::KEY_KP9,
            KeyCode::KpMinus => OsCode::KEY_KPMINUS,
            KeyCode::Kp4 => OsCode::KEY_KP4,
            KeyCode::Kp5 => OsCode::KEY_KP5,
            KeyCode::Kp6 => OsCode::KEY_KP6,
            KeyCode::KpPlus => OsCode::KEY_KPPLUS,
            KeyCode::Kp1 => OsCode::KEY_KP1,
            KeyCode::Kp2 => OsCode::KEY_KP2,
            KeyCode::Kp3 => OsCode::KEY_KP3,
            KeyCode::Kp0 => OsCode::KEY_KP0,
            KeyCode::KpDot => OsCode::KEY_KPDOT,
            KeyCode::F11 => OsCode::KEY_F11,
            KeyCode::F12 => OsCode::KEY_F12,
            KeyCode::KpEnter => OsCode::KEY_KPENTER,
            KeyCode::RCtrl => OsCode::KEY_RIGHTCTRL,
            KeyCode::KpSlash => OsCode::KEY_KPSLASH,
            KeyCode::SysReq => OsCode::KEY_SYSRQ,
            KeyCode::RAlt => OsCode::KEY_RIGHTALT,
            KeyCode::Home => OsCode::KEY_HOME,
            KeyCode::Up => OsCode::KEY_UP,
            KeyCode::PgUp => OsCode::KEY_PAGEUP,
            KeyCode::Left => OsCode::KEY_LEFT,
            KeyCode::Right => OsCode::KEY_RIGHT,
            KeyCode::End => OsCode::KEY_END,
            KeyCode::Down => OsCode::KEY_DOWN,
            KeyCode::PgDown => OsCode::KEY_PAGEDOWN,
            KeyCode::Insert => OsCode::KEY_INSERT,
            KeyCode::Delete => OsCode::KEY_DELETE,
            KeyCode::Mute => OsCode::KEY_MUTE,
            KeyCode::VolDown => OsCode::KEY_VOLUMEDOWN,
            KeyCode::VolUp => OsCode::KEY_VOLUMEUP,
            KeyCode::Power => OsCode::KEY_POWER,
            KeyCode::KpEqual => OsCode::KEY_KPEQUAL,
            KeyCode::Pause => OsCode::KEY_PAUSE,
            KeyCode::KpComma => OsCode::KEY_KPCOMMA,
            KeyCode::LGui => OsCode::KEY_LEFTMETA,
            KeyCode::RGui => OsCode::KEY_RIGHTMETA,
            KeyCode::Stop => OsCode::KEY_STOP,
            KeyCode::Again => OsCode::KEY_AGAIN,
            KeyCode::Undo => OsCode::KEY_UNDO,
            KeyCode::Copy => OsCode::KEY_COPY,
            KeyCode::Paste => OsCode::KEY_PASTE,
            KeyCode::Find => OsCode::KEY_FIND,
            KeyCode::Cut => OsCode::KEY_CUT,
            KeyCode::Help => OsCode::KEY_HELP,
            KeyCode::Menu => OsCode::KEY_MENU,
            KeyCode::MediaCalc => OsCode::KEY_CALC,
            KeyCode::MediaSleep => OsCode::KEY_SLEEP,
            KeyCode::MediaWWW => OsCode::KEY_WWW,
            KeyCode::MediaCoffee => OsCode::KEY_COFFEE,
            KeyCode::MediaBack => OsCode::KEY_BACK,
            KeyCode::MediaForward => OsCode::KEY_FORWARD,
            KeyCode::MediaEjectCD => OsCode::KEY_EJECTCD,
            KeyCode::MediaNextSong => OsCode::KEY_NEXTSONG,
            KeyCode::MediaPlayPause => OsCode::KEY_PLAYPAUSE,
            KeyCode::MediaPreviousSong => OsCode::KEY_PREVIOUSSONG,
            KeyCode::MediaStopCD => OsCode::KEY_STOPCD,
            KeyCode::MediaRefresh => OsCode::KEY_REFRESH,
            KeyCode::MediaEdit => OsCode::KEY_EDIT,
            KeyCode::MediaScrollUp => OsCode::KEY_SCROLLUP,
            KeyCode::MediaScrollDown => OsCode::KEY_SCROLLDOWN,
            KeyCode::F13 => OsCode::KEY_F13,
            KeyCode::F14 => OsCode::KEY_F14,
            KeyCode::F15 => OsCode::KEY_F15,
            KeyCode::F16 => OsCode::KEY_F16,
            KeyCode::F17 => OsCode::KEY_F17,
            KeyCode::F18 => OsCode::KEY_F18,
            KeyCode::F19 => OsCode::KEY_F19,
            KeyCode::F20 => OsCode::KEY_F20,
            KeyCode::F21 => OsCode::KEY_F21,
            KeyCode::F22 => OsCode::KEY_F22,
            KeyCode::F23 => OsCode::KEY_F23,
            KeyCode::F24 => OsCode::KEY_F24,
            KeyCode::Wakeup => OsCode::KEY_WAKEUP,
            KeyCode::BrightnessUp => OsCode::KEY_BRIGHTNESSUP,
            KeyCode::BrightnessDown => OsCode::KEY_BRIGHTNESSDOWN,
            KeyCode::KbdIllumUp => OsCode::KEY_KBDILLUMUP,
            KeyCode::KbdIllumDown => OsCode::KEY_KBDILLUMDOWN,
            KeyCode::Lang1 => OsCode::KEY_HANGEUL,
            KeyCode::Lang2 => OsCode::KEY_HANJA,
            KeyCode::NonUsBslash => OsCode::KEY_102ND,
            KeyCode::PScreen => OsCode::KEY_PRINT,
            KeyCode::Application => OsCode::KEY_COMPOSE,
            KeyCode::AltErase => OsCode::KEY_ALTERASE,
            KeyCode::Cancel => OsCode::KEY_CANCEL,
            KeyCode::MediaMute => OsCode::KEY_MICMUTE,
            KeyCode::Intl1 => OsCode::KEY_RO,
            KeyCode::K0xAA => OsCode::KEY_MEDIA,
            KeyCode::K0xAB => OsCode::KEY_EMAIL,
            KeyCode::K0xAC => OsCode::KEY_PLAYER,
            KeyCode::K0xAD => OsCode::KEY_HOMEPAGE,
            KeyCode::K0xAE => OsCode::KEY_MAIL,
            KeyCode::K0xAF => OsCode::KEY_MUHENKAN,
            KeyCode::K0xB0 => OsCode::KEY_HENKAN,
            KeyCode::K0xB1 => OsCode::KEY_KATAKANA,
            KeyCode::K0xB2 => OsCode::KEY_KATAKANAHIRAGANA,
            KeyCode::K0xB3 => OsCode::KEY_HIRAGANA,
            _ => haphazard_kc_to_osc_mappings(item),
        }
    }
}

impl From<OsCode> for KeyCode {
    fn from(item: OsCode) -> KeyCode {
        match item {
            OsCode::KEY_ESC => KeyCode::Escape,
            OsCode::KEY_1 => KeyCode::Kb1,
            OsCode::KEY_2 => KeyCode::Kb2,
            OsCode::KEY_3 => KeyCode::Kb3,
            OsCode::KEY_4 => KeyCode::Kb4,
            OsCode::KEY_5 => KeyCode::Kb5,
            OsCode::KEY_6 => KeyCode::Kb6,
            OsCode::KEY_7 => KeyCode::Kb7,
            OsCode::KEY_8 => KeyCode::Kb8,
            OsCode::KEY_9 => KeyCode::Kb9,
            OsCode::KEY_0 => KeyCode::Kb0,
            OsCode::KEY_MINUS => KeyCode::Minus,
            OsCode::KEY_EQUAL => KeyCode::Equal,
            OsCode::KEY_BACKSPACE => KeyCode::BSpace,
            OsCode::KEY_TAB => KeyCode::Tab,
            OsCode::KEY_Q => KeyCode::Q,
            OsCode::KEY_W => KeyCode::W,
            OsCode::KEY_E => KeyCode::E,
            OsCode::KEY_R => KeyCode::R,
            OsCode::KEY_T => KeyCode::T,
            OsCode::KEY_Y => KeyCode::Y,
            OsCode::KEY_U => KeyCode::U,
            OsCode::KEY_I => KeyCode::I,
            OsCode::KEY_O => KeyCode::O,
            OsCode::KEY_P => KeyCode::P,
            OsCode::KEY_LEFTBRACE => KeyCode::LBracket,
            OsCode::KEY_RIGHTBRACE => KeyCode::RBracket,
            OsCode::KEY_ENTER => KeyCode::Enter,
            OsCode::KEY_LEFTCTRL => KeyCode::LCtrl,
            OsCode::KEY_A => KeyCode::A,
            OsCode::KEY_S => KeyCode::S,
            OsCode::KEY_D => KeyCode::D,
            OsCode::KEY_F => KeyCode::F,
            OsCode::KEY_G => KeyCode::G,
            OsCode::KEY_H => KeyCode::H,
            OsCode::KEY_J => KeyCode::J,
            OsCode::KEY_K => KeyCode::K,
            OsCode::KEY_L => KeyCode::L,
            OsCode::KEY_SEMICOLON => KeyCode::SColon,
            OsCode::KEY_APOSTROPHE => KeyCode::Quote,
            OsCode::KEY_GRAVE => KeyCode::Grave,
            OsCode::KEY_LEFTSHIFT => KeyCode::LShift,
            OsCode::KEY_BACKSLASH => KeyCode::Bslash,
            OsCode::KEY_Z => KeyCode::Z,
            OsCode::KEY_X => KeyCode::X,
            OsCode::KEY_C => KeyCode::C,
            OsCode::KEY_V => KeyCode::V,
            OsCode::KEY_B => KeyCode::B,
            OsCode::KEY_N => KeyCode::N,
            OsCode::KEY_M => KeyCode::M,
            OsCode::KEY_COMMA => KeyCode::Comma,
            OsCode::KEY_DOT => KeyCode::Dot,
            OsCode::KEY_SLASH => KeyCode::Slash,
            OsCode::KEY_RIGHTSHIFT => KeyCode::RShift,
            OsCode::KEY_KPASTERISK => KeyCode::KpAsterisk,
            OsCode::KEY_LEFTALT => KeyCode::LAlt,
            OsCode::KEY_SPACE => KeyCode::Space,
            OsCode::KEY_CAPSLOCK => KeyCode::CapsLock,
            OsCode::KEY_F1 => KeyCode::F1,
            OsCode::KEY_F2 => KeyCode::F2,
            OsCode::KEY_F3 => KeyCode::F3,
            OsCode::KEY_F4 => KeyCode::F4,
            OsCode::KEY_F5 => KeyCode::F5,
            OsCode::KEY_F6 => KeyCode::F6,
            OsCode::KEY_F7 => KeyCode::F7,
            OsCode::KEY_F8 => KeyCode::F8,
            OsCode::KEY_F9 => KeyCode::F9,
            OsCode::KEY_F10 => KeyCode::F10,
            OsCode::KEY_NUMLOCK => KeyCode::NumLock,
            OsCode::KEY_CLEAR => KeyCode::Clear,
            OsCode::KEY_SCROLLLOCK => KeyCode::ScrollLock,
            OsCode::KEY_KP7 => KeyCode::Kp7,
            OsCode::KEY_KP8 => KeyCode::Kp8,
            OsCode::KEY_KP9 => KeyCode::Kp9,
            OsCode::KEY_KPMINUS => KeyCode::KpMinus,
            OsCode::KEY_KP4 => KeyCode::Kp4,
            OsCode::KEY_KP5 => KeyCode::Kp5,
            OsCode::KEY_KP6 => KeyCode::Kp6,
            OsCode::KEY_KPPLUS => KeyCode::KpPlus,
            OsCode::KEY_KP1 => KeyCode::Kp1,
            OsCode::KEY_KP2 => KeyCode::Kp2,
            OsCode::KEY_KP3 => KeyCode::Kp3,
            OsCode::KEY_KP0 => KeyCode::Kp0,
            OsCode::KEY_KPDOT => KeyCode::KpDot,
            OsCode::KEY_F11 => KeyCode::F11,
            OsCode::KEY_F12 => KeyCode::F12,
            OsCode::KEY_KPENTER => KeyCode::KpEnter,
            OsCode::KEY_RIGHTCTRL => KeyCode::RCtrl,
            OsCode::KEY_KPSLASH => KeyCode::KpSlash,
            OsCode::KEY_SYSRQ => KeyCode::SysReq,
            OsCode::KEY_RIGHTALT => KeyCode::RAlt,
            OsCode::KEY_HOME => KeyCode::Home,
            OsCode::KEY_UP => KeyCode::Up,
            OsCode::KEY_PAGEUP => KeyCode::PgUp,
            OsCode::KEY_LEFT => KeyCode::Left,
            OsCode::KEY_RIGHT => KeyCode::Right,
            OsCode::KEY_END => KeyCode::End,
            OsCode::KEY_DOWN => KeyCode::Down,
            OsCode::KEY_PAGEDOWN => KeyCode::PgDown,
            OsCode::KEY_INSERT => KeyCode::Insert,
            OsCode::KEY_DELETE => KeyCode::Delete,
            OsCode::KEY_MUTE => KeyCode::Mute,
            OsCode::KEY_VOLUMEDOWN => KeyCode::VolDown,
            OsCode::KEY_VOLUMEUP => KeyCode::VolUp,
            OsCode::KEY_POWER => KeyCode::Power,
            OsCode::KEY_KPEQUAL => KeyCode::KpEqual,
            OsCode::KEY_PAUSE => KeyCode::Pause,
            OsCode::KEY_KPCOMMA => KeyCode::KpComma,
            OsCode::KEY_LEFTMETA => KeyCode::LGui,
            OsCode::KEY_RIGHTMETA => KeyCode::RGui,
            OsCode::KEY_STOP => KeyCode::Stop,
            OsCode::KEY_AGAIN => KeyCode::Again,
            OsCode::KEY_UNDO => KeyCode::Undo,
            OsCode::KEY_COPY => KeyCode::Copy,
            OsCode::KEY_PASTE => KeyCode::Paste,
            OsCode::KEY_FIND => KeyCode::Find,
            OsCode::KEY_CUT => KeyCode::Cut,
            OsCode::KEY_HELP => KeyCode::Help,
            OsCode::KEY_MENU => KeyCode::Menu,
            OsCode::KEY_CALC => KeyCode::MediaCalc,
            OsCode::KEY_SLEEP => KeyCode::MediaSleep,
            OsCode::KEY_WWW => KeyCode::MediaWWW,
            OsCode::KEY_COFFEE => KeyCode::MediaCoffee,
            OsCode::KEY_BACK => KeyCode::MediaBack,
            OsCode::KEY_FORWARD => KeyCode::MediaForward,
            OsCode::KEY_EJECTCD => KeyCode::MediaEjectCD,
            OsCode::KEY_NEXTSONG => KeyCode::MediaNextSong,
            OsCode::KEY_PLAYPAUSE => KeyCode::MediaPlayPause,
            OsCode::KEY_PREVIOUSSONG => KeyCode::MediaPreviousSong,
            OsCode::KEY_STOPCD => KeyCode::MediaStopCD,
            OsCode::KEY_REFRESH => KeyCode::MediaRefresh,
            OsCode::KEY_EDIT => KeyCode::MediaEdit,
            OsCode::KEY_SCROLLUP => KeyCode::MediaScrollUp,
            OsCode::KEY_SCROLLDOWN => KeyCode::MediaScrollDown,
            OsCode::KEY_F13 => KeyCode::F13,
            OsCode::KEY_F14 => KeyCode::F14,
            OsCode::KEY_F15 => KeyCode::F15,
            OsCode::KEY_F16 => KeyCode::F16,
            OsCode::KEY_F17 => KeyCode::F17,
            OsCode::KEY_F18 => KeyCode::F18,
            OsCode::KEY_F19 => KeyCode::F19,
            OsCode::KEY_F20 => KeyCode::F20,
            OsCode::KEY_F21 => KeyCode::F21,
            OsCode::KEY_F22 => KeyCode::F22,
            OsCode::KEY_F23 => KeyCode::F23,
            OsCode::KEY_F24 => KeyCode::F24,
            OsCode::KEY_WAKEUP => KeyCode::Wakeup,
            OsCode::KEY_BRIGHTNESSUP => KeyCode::BrightnessUp,
            OsCode::KEY_BRIGHTNESSDOWN => KeyCode::BrightnessDown,
            OsCode::KEY_KBDILLUMUP => KeyCode::KbdIllumUp,
            OsCode::KEY_KBDILLUMDOWN => KeyCode::KbdIllumDown,
            OsCode::KEY_HANGEUL => KeyCode::Lang1,
            OsCode::KEY_HANJA => KeyCode::Lang2,
            OsCode::KEY_102ND => KeyCode::NonUsBslash,
            OsCode::KEY_PRINT => KeyCode::PScreen,
            OsCode::KEY_COMPOSE => KeyCode::Application,
            OsCode::KEY_ALTERASE => KeyCode::AltErase,
            OsCode::KEY_CANCEL => KeyCode::Cancel,
            OsCode::KEY_MICMUTE => KeyCode::MediaMute,
            OsCode::KEY_RO => KeyCode::Intl1,
            OsCode::KEY_MEDIA => KeyCode::K0xAA,
            OsCode::KEY_EMAIL => KeyCode::K0xAB,
            OsCode::KEY_PLAYER => KeyCode::K0xAC,
            OsCode::KEY_HOMEPAGE => KeyCode::K0xAD,
            OsCode::KEY_MAIL => KeyCode::K0xAE,
            OsCode::KEY_MUHENKAN => KeyCode::K0xAF,
            OsCode::KEY_HENKAN => KeyCode::K0xB0,
            OsCode::KEY_KATAKANA => KeyCode::K0xB1,
            OsCode::KEY_KATAKANAHIRAGANA => KeyCode::K0xB2,
            OsCode::KEY_HIRAGANA => KeyCode::K0xB3,
            _ => haphazard_osc_to_kc_mappings(item),
        }
    }
}

fn haphazard_osc_to_kc_mappings(osc: OsCode) -> KeyCode {
    match osc {
        OsCode::KEY_252 => KeyCode::K252,
        OsCode::KEY_253 => KeyCode::K253,
        OsCode::KEY_254 => KeyCode::K254,
        OsCode::KEY_255 => KeyCode::K255,
        OsCode::BTN_0 => KeyCode::K256,
        OsCode::BTN_1 => KeyCode::K257,
        OsCode::BTN_2 => KeyCode::K258,
        OsCode::BTN_3 => KeyCode::K259,
        OsCode::BTN_4 => KeyCode::K260,
        OsCode::BTN_5 => KeyCode::K261,
        OsCode::BTN_6 => KeyCode::K262,
        OsCode::BTN_7 => KeyCode::K263,
        OsCode::BTN_8 => KeyCode::K264,
        OsCode::BTN_9 => KeyCode::K265,
        OsCode::KEY_266 => KeyCode::K266,
        OsCode::KEY_267 => KeyCode::K267,
        OsCode::KEY_268 => KeyCode::K268,
        OsCode::KEY_269 => KeyCode::K269,
        OsCode::KEY_270 => KeyCode::K270,
        OsCode::KEY_271 => KeyCode::K271,
        OsCode::BTN_LEFT => KeyCode::K272,
        OsCode::BTN_RIGHT => KeyCode::K273,
        OsCode::BTN_MIDDLE => KeyCode::K274,
        OsCode::BTN_SIDE => KeyCode::K275,
        OsCode::BTN_EXTRA => KeyCode::K276,
        OsCode::BTN_FORWARD => KeyCode::K277,
        OsCode::BTN_BACK => KeyCode::K278,
        OsCode::BTN_TASK => KeyCode::K279,
        OsCode::KEY_280 => KeyCode::K280,
        OsCode::KEY_281 => KeyCode::K281,
        OsCode::KEY_282 => KeyCode::K282,
        OsCode::KEY_283 => KeyCode::K283,
        OsCode::KEY_284 => KeyCode::K284,
        OsCode::KEY_285 => KeyCode::K285,
        OsCode::KEY_286 => KeyCode::K286,
        OsCode::KEY_287 => KeyCode::K287,
        OsCode::BTN_TRIGGER => KeyCode::K288,
        OsCode::BTN_THUMB => KeyCode::K289,
        OsCode::BTN_THUMB2 => KeyCode::K290,
        OsCode::BTN_TOP => KeyCode::K291,
        OsCode::BTN_TOP2 => KeyCode::K292,
        OsCode::BTN_PINKIE => KeyCode::K293,
        OsCode::BTN_BASE => KeyCode::K294,
        OsCode::BTN_BASE2 => KeyCode::K295,
        OsCode::BTN_BASE3 => KeyCode::K296,
        OsCode::BTN_BASE4 => KeyCode::K297,
        OsCode::BTN_BASE5 => KeyCode::K298,
        OsCode::BTN_BASE6 => KeyCode::K299,
        OsCode::KEY_300 => KeyCode::K300,
        OsCode::KEY_301 => KeyCode::K301,
        OsCode::KEY_302 => KeyCode::K302,
        OsCode::BTN_DEAD => KeyCode::K303,
        OsCode::BTN_SOUTH => KeyCode::K304,
        OsCode::BTN_EAST => KeyCode::K305,
        OsCode::BTN_C => KeyCode::K306,
        OsCode::BTN_NORTH => KeyCode::K307,
        OsCode::BTN_WEST => KeyCode::K308,
        OsCode::BTN_Z => KeyCode::K309,
        OsCode::BTN_TL => KeyCode::K310,
        OsCode::BTN_TR => KeyCode::K311,
        OsCode::BTN_TL2 => KeyCode::K312,
        OsCode::BTN_TR2 => KeyCode::K313,
        OsCode::BTN_SELECT => KeyCode::K314,
        OsCode::BTN_START => KeyCode::K315,
        OsCode::BTN_MODE => KeyCode::K316,
        OsCode::BTN_THUMBL => KeyCode::K317,
        OsCode::BTN_THUMBR => KeyCode::K318,
        OsCode::KEY_319 => KeyCode::K319,
        OsCode::BTN_TOOL_PEN => KeyCode::K320,
        OsCode::BTN_TOOL_RUBBER => KeyCode::K321,
        OsCode::BTN_TOOL_BRUSH => KeyCode::K322,
        OsCode::BTN_TOOL_PENCIL => KeyCode::K323,
        OsCode::BTN_TOOL_AIRBRUSH => KeyCode::K324,
        OsCode::BTN_TOOL_FINGER => KeyCode::K325,
        OsCode::BTN_TOOL_MOUSE => KeyCode::K326,
        OsCode::BTN_TOOL_LENS => KeyCode::K327,
        OsCode::BTN_TOOL_QUINTTAP => KeyCode::K328,
        OsCode::BTN_STYLUS3 => KeyCode::K329,
        OsCode::BTN_TOUCH => KeyCode::K330,
        OsCode::BTN_STYLUS => KeyCode::K331,
        OsCode::BTN_STYLUS2 => KeyCode::K332,
        OsCode::BTN_TOOL_DOUBLETAP => KeyCode::K333,
        OsCode::BTN_TOOL_TRIPLETAP => KeyCode::K334,
        OsCode::BTN_TOOL_QUADTAP => KeyCode::K335,
        OsCode::BTN_GEAR_DOWN => KeyCode::K336,
        OsCode::BTN_GEAR_UP => KeyCode::K337,
        OsCode::KEY_338 => KeyCode::K338,
        OsCode::KEY_339 => KeyCode::K339,
        OsCode::KEY_340 => KeyCode::K340,
        OsCode::KEY_341 => KeyCode::K341,
        OsCode::KEY_342 => KeyCode::K342,
        OsCode::KEY_343 => KeyCode::K343,
        OsCode::KEY_344 => KeyCode::K344,
        OsCode::KEY_345 => KeyCode::K345,
        OsCode::KEY_346 => KeyCode::K346,
        OsCode::KEY_347 => KeyCode::K347,
        OsCode::KEY_348 => KeyCode::K348,
        OsCode::KEY_349 => KeyCode::K349,
        OsCode::KEY_350 => KeyCode::K350,
        OsCode::KEY_351 => KeyCode::K351,
        OsCode::KEY_OK => KeyCode::K352,
        OsCode::KEY_SELECT => KeyCode::K353,
        OsCode::KEY_GOTO => KeyCode::K354,
        OsCode::KEY_CLEAR => KeyCode::K355,
        OsCode::KEY_POWER2 => KeyCode::K356,
        OsCode::KEY_OPTION => KeyCode::K357,
        OsCode::KEY_INFO => KeyCode::K358,
        OsCode::KEY_TIME => KeyCode::K359,
        OsCode::KEY_VENDOR => KeyCode::K360,
        OsCode::KEY_ARCHIVE => KeyCode::K361,
        OsCode::KEY_PROGRAM => KeyCode::K362,
        OsCode::KEY_CHANNEL => KeyCode::K363,
        OsCode::KEY_FAVORITES => KeyCode::K364,
        OsCode::KEY_EPG => KeyCode::K365,
        OsCode::KEY_PVR => KeyCode::K366,
        OsCode::KEY_MHP => KeyCode::K367,
        OsCode::KEY_LANGUAGE => KeyCode::K368,
        OsCode::KEY_TITLE => KeyCode::K369,
        OsCode::KEY_SUBTITLE => KeyCode::K370,
        OsCode::KEY_ANGLE => KeyCode::K371,
        OsCode::KEY_FULL_SCREEN => KeyCode::K372,
        OsCode::KEY_MODE => KeyCode::K373,
        OsCode::KEY_KEYBOARD => KeyCode::K374,
        OsCode::KEY_ASPECT_RATIO => KeyCode::K375,
        OsCode::KEY_PC => KeyCode::K376,
        OsCode::KEY_TV => KeyCode::K377,
        OsCode::KEY_TV2 => KeyCode::K378,
        OsCode::KEY_VCR => KeyCode::K379,
        OsCode::KEY_VCR2 => KeyCode::K380,
        OsCode::KEY_SAT => KeyCode::K381,
        OsCode::KEY_SAT2 => KeyCode::K382,
        OsCode::KEY_CD => KeyCode::K383,
        OsCode::KEY_TAPE => KeyCode::K384,
        OsCode::KEY_RADIO => KeyCode::K385,
        OsCode::KEY_TUNER => KeyCode::K386,
        OsCode::KEY_PLAYER => KeyCode::K387,
        OsCode::KEY_TEXT => KeyCode::K388,
        OsCode::KEY_DVD => KeyCode::K389,
        OsCode::KEY_AUX => KeyCode::K390,
        OsCode::KEY_MP3 => KeyCode::K391,
        OsCode::KEY_AUDIO => KeyCode::K392,
        OsCode::KEY_VIDEO => KeyCode::K393,
        OsCode::KEY_DIRECTORY => KeyCode::K394,
        OsCode::KEY_LIST => KeyCode::K395,
        OsCode::KEY_MEMO => KeyCode::K396,
        OsCode::KEY_CALENDAR => KeyCode::K397,
        OsCode::KEY_RED => KeyCode::K398,
        OsCode::KEY_GREEN => KeyCode::K399,
        OsCode::KEY_YELLOW => KeyCode::K400,
        OsCode::KEY_BLUE => KeyCode::K401,
        OsCode::KEY_CHANNELUP => KeyCode::K402,
        OsCode::KEY_CHANNELDOWN => KeyCode::K403,
        OsCode::KEY_FIRST => KeyCode::K404,
        OsCode::KEY_LAST => KeyCode::K405,
        OsCode::KEY_AB => KeyCode::K406,
        OsCode::KEY_NEXT => KeyCode::K407,
        OsCode::KEY_RESTART => KeyCode::K408,
        OsCode::KEY_SLOW => KeyCode::K409,
        OsCode::KEY_SHUFFLE => KeyCode::K410,
        OsCode::KEY_BREAK => KeyCode::K411,
        OsCode::KEY_PREVIOUS => KeyCode::K412,
        OsCode::KEY_DIGITS => KeyCode::K413,
        OsCode::KEY_TEEN => KeyCode::K414,
        OsCode::KEY_TWEN => KeyCode::K415,
        OsCode::KEY_VIDEOPHONE => KeyCode::K416,
        OsCode::KEY_GAMES => KeyCode::K417,
        OsCode::KEY_ZOOMIN => KeyCode::K418,
        OsCode::KEY_ZOOMOUT => KeyCode::K419,
        OsCode::KEY_ZOOMRESET => KeyCode::K420,
        OsCode::KEY_WORDPROCESSOR => KeyCode::K421,
        OsCode::KEY_EDITOR => KeyCode::K422,
        OsCode::KEY_SPREADSHEET => KeyCode::K423,
        OsCode::KEY_GRAPHICSEDITOR => KeyCode::K424,
        OsCode::KEY_PRESENTATION => KeyCode::K425,
        OsCode::KEY_DATABASE => KeyCode::K426,
        OsCode::KEY_NEWS => KeyCode::K427,
        OsCode::KEY_VOICEMAIL => KeyCode::K428,
        OsCode::KEY_ADDRESSBOOK => KeyCode::K429,
        OsCode::KEY_MESSENGER => KeyCode::K430,
        OsCode::KEY_DISPLAYTOGGLE => KeyCode::K431,
        OsCode::KEY_SPELLCHECK => KeyCode::K432,
        OsCode::KEY_LOGOFF => KeyCode::K433,
        OsCode::KEY_DOLLAR => KeyCode::K434,
        OsCode::KEY_EURO => KeyCode::K435,
        OsCode::KEY_FRAMEBACK => KeyCode::K436,
        OsCode::KEY_FRAMEFORWARD => KeyCode::K437,
        OsCode::KEY_CONTEXT_MENU => KeyCode::K438,
        OsCode::KEY_MEDIA_REPEAT => KeyCode::K439,
        OsCode::KEY_10CHANNELSUP => KeyCode::K440,
        OsCode::KEY_10CHANNELSDOWN => KeyCode::K441,
        OsCode::KEY_IMAGES => KeyCode::K442,
        OsCode::KEY_443 => KeyCode::K443,
        OsCode::KEY_444 => KeyCode::K444,
        OsCode::KEY_445 => KeyCode::K445,
        OsCode::KEY_446 => KeyCode::K446,
        OsCode::KEY_447 => KeyCode::K447,
        OsCode::KEY_DEL_EOL => KeyCode::K448,
        OsCode::KEY_DEL_EOS => KeyCode::K449,
        OsCode::KEY_INS_LINE => KeyCode::K450,
        OsCode::KEY_DEL_LINE => KeyCode::K451,
        OsCode::KEY_452 => KeyCode::K452,
        OsCode::KEY_453 => KeyCode::K453,
        OsCode::KEY_454 => KeyCode::K454,
        OsCode::KEY_455 => KeyCode::K455,
        OsCode::KEY_456 => KeyCode::K456,
        OsCode::KEY_457 => KeyCode::K457,
        OsCode::KEY_458 => KeyCode::K458,
        OsCode::KEY_459 => KeyCode::K459,
        OsCode::KEY_460 => KeyCode::K460,
        OsCode::KEY_461 => KeyCode::K461,
        OsCode::KEY_462 => KeyCode::K462,
        OsCode::KEY_463 => KeyCode::K463,
        OsCode::KEY_FN => KeyCode::K464,
        OsCode::KEY_FN_ESC => KeyCode::K465,
        OsCode::KEY_FN_F1 => KeyCode::K466,
        OsCode::KEY_FN_F2 => KeyCode::K467,
        OsCode::KEY_FN_F3 => KeyCode::K468,
        OsCode::KEY_FN_F4 => KeyCode::K469,
        OsCode::KEY_FN_F5 => KeyCode::K470,
        OsCode::KEY_FN_F6 => KeyCode::K471,
        OsCode::KEY_FN_F7 => KeyCode::K472,
        OsCode::KEY_FN_F8 => KeyCode::K473,
        OsCode::KEY_FN_F9 => KeyCode::K474,
        OsCode::KEY_FN_F10 => KeyCode::K475,
        OsCode::KEY_FN_F11 => KeyCode::K476,
        OsCode::KEY_FN_F12 => KeyCode::K477,
        OsCode::KEY_FN_1 => KeyCode::K478,
        OsCode::KEY_FN_2 => KeyCode::K479,
        OsCode::KEY_FN_D => KeyCode::K480,
        OsCode::KEY_FN_E => KeyCode::K481,
        OsCode::KEY_FN_F => KeyCode::K482,
        OsCode::KEY_FN_S => KeyCode::K483,
        OsCode::KEY_FN_B => KeyCode::K484,
        OsCode::KEY_485 => KeyCode::K485,
        OsCode::KEY_486 => KeyCode::K486,
        OsCode::KEY_487 => KeyCode::K487,
        OsCode::KEY_488 => KeyCode::K488,
        OsCode::KEY_489 => KeyCode::K489,
        OsCode::KEY_490 => KeyCode::K490,
        OsCode::KEY_491 => KeyCode::K491,
        OsCode::KEY_492 => KeyCode::K492,
        OsCode::KEY_493 => KeyCode::K493,
        OsCode::KEY_494 => KeyCode::K494,
        OsCode::KEY_495 => KeyCode::K495,
        OsCode::KEY_496 => KeyCode::K496,
        OsCode::KEY_BRL_DOT1 => KeyCode::K497,
        OsCode::KEY_BRL_DOT2 => KeyCode::K498,
        OsCode::KEY_BRL_DOT3 => KeyCode::K499,
        OsCode::KEY_BRL_DOT4 => KeyCode::K500,
        OsCode::KEY_BRL_DOT5 => KeyCode::K501,
        OsCode::KEY_BRL_DOT6 => KeyCode::K502,
        OsCode::KEY_BRL_DOT7 => KeyCode::K503,
        OsCode::KEY_BRL_DOT8 => KeyCode::K504,
        OsCode::KEY_BRL_DOT9 => KeyCode::K505,
        OsCode::KEY_BRL_DOT10 => KeyCode::K506,
        OsCode::KEY_507 => KeyCode::K507,
        OsCode::KEY_508 => KeyCode::K508,
        OsCode::KEY_509 => KeyCode::K509,
        OsCode::KEY_510 => KeyCode::K510,
        OsCode::KEY_511 => KeyCode::K511,
        OsCode::KEY_NUMERIC_0 => KeyCode::K512,
        OsCode::KEY_NUMERIC_1 => KeyCode::K513,
        OsCode::KEY_NUMERIC_2 => KeyCode::K514,
        OsCode::KEY_NUMERIC_3 => KeyCode::K515,
        OsCode::KEY_NUMERIC_4 => KeyCode::K516,
        OsCode::KEY_NUMERIC_5 => KeyCode::K517,
        OsCode::KEY_NUMERIC_6 => KeyCode::K518,
        OsCode::KEY_NUMERIC_7 => KeyCode::K519,
        OsCode::KEY_NUMERIC_8 => KeyCode::K520,
        OsCode::KEY_NUMERIC_9 => KeyCode::K521,
        OsCode::KEY_NUMERIC_STAR => KeyCode::K522,
        OsCode::KEY_NUMERIC_POUND => KeyCode::K523,
        OsCode::KEY_NUMERIC_A => KeyCode::K524,
        OsCode::KEY_NUMERIC_B => KeyCode::K525,
        OsCode::KEY_NUMERIC_C => KeyCode::K526,
        OsCode::KEY_NUMERIC_D => KeyCode::K527,
        OsCode::KEY_CAMERA_FOCUS => KeyCode::K528,
        OsCode::KEY_WPS_BUTTON => KeyCode::K529,
        OsCode::KEY_TOUCHPAD_TOGGLE => KeyCode::K530,
        OsCode::KEY_TOUCHPAD_ON => KeyCode::K531,
        OsCode::KEY_TOUCHPAD_OFF => KeyCode::K532,
        OsCode::KEY_CAMERA_ZOOMIN => KeyCode::K533,
        OsCode::KEY_CAMERA_ZOOMOUT => KeyCode::K534,
        OsCode::KEY_CAMERA_UP => KeyCode::K535,
        OsCode::KEY_CAMERA_DOWN => KeyCode::K536,
        OsCode::KEY_CAMERA_LEFT => KeyCode::K537,
        OsCode::KEY_CAMERA_RIGHT => KeyCode::K538,
        OsCode::KEY_ATTENDANT_ON => KeyCode::K539,
        OsCode::KEY_ATTENDANT_OFF => KeyCode::K540,
        OsCode::KEY_ATTENDANT_TOGGLE => KeyCode::K541,
        OsCode::KEY_LIGHTS_TOGGLE => KeyCode::K542,
        OsCode::KEY_543 => KeyCode::K543,
        OsCode::BTN_DPAD_UP => KeyCode::K544,
        OsCode::BTN_DPAD_DOWN => KeyCode::K545,
        OsCode::BTN_DPAD_LEFT => KeyCode::K546,
        OsCode::BTN_DPAD_RIGHT => KeyCode::K547,
        OsCode::KEY_548 => KeyCode::K548,
        OsCode::KEY_549 => KeyCode::K549,
        OsCode::KEY_550 => KeyCode::K550,
        OsCode::KEY_551 => KeyCode::K551,
        OsCode::KEY_552 => KeyCode::K552,
        OsCode::KEY_553 => KeyCode::K553,
        OsCode::KEY_554 => KeyCode::K554,
        OsCode::KEY_555 => KeyCode::K555,
        OsCode::KEY_556 => KeyCode::K556,
        OsCode::KEY_557 => KeyCode::K557,
        OsCode::KEY_558 => KeyCode::K558,
        OsCode::KEY_559 => KeyCode::K559,
        OsCode::KEY_ALS_TOGGLE => KeyCode::K560,
        OsCode::KEY_ROTATE_LOCK_TOGGLE => KeyCode::K561,
        OsCode::KEY_562 => KeyCode::K562,
        OsCode::KEY_563 => KeyCode::K563,
        OsCode::KEY_564 => KeyCode::K564,
        OsCode::KEY_565 => KeyCode::K565,
        OsCode::KEY_566 => KeyCode::K566,
        OsCode::KEY_567 => KeyCode::K567,
        OsCode::KEY_568 => KeyCode::K568,
        OsCode::KEY_569 => KeyCode::K569,
        OsCode::KEY_570 => KeyCode::K570,
        OsCode::KEY_571 => KeyCode::K571,
        OsCode::KEY_572 => KeyCode::K572,
        OsCode::KEY_573 => KeyCode::K573,
        OsCode::KEY_574 => KeyCode::K574,
        OsCode::KEY_575 => KeyCode::K575,
        OsCode::KEY_BUTTONCONFIG => KeyCode::K576,
        OsCode::KEY_TASKMANAGER => KeyCode::K577,
        OsCode::KEY_JOURNAL => KeyCode::K578,
        OsCode::KEY_CONTROLPANEL => KeyCode::K579,
        OsCode::KEY_APPSELECT => KeyCode::K580,
        OsCode::KEY_SCREENSAVER => KeyCode::K581,
        OsCode::KEY_VOICECOMMAND => KeyCode::K582,
        OsCode::KEY_ASSISTANT => KeyCode::K583,
        OsCode::KEY_KBD_LAYOUT_NEXT => KeyCode::K584,
        OsCode::KEY_585 => KeyCode::K585,
        OsCode::KEY_586 => KeyCode::K586,
        OsCode::KEY_587 => KeyCode::K587,
        OsCode::KEY_588 => KeyCode::K588,
        OsCode::KEY_589 => KeyCode::K589,
        OsCode::KEY_590 => KeyCode::K590,
        OsCode::KEY_591 => KeyCode::K591,
        OsCode::KEY_BRIGHTNESS_MIN => KeyCode::K592,
        OsCode::KEY_BRIGHTNESS_MAX => KeyCode::K593,
        OsCode::KEY_594 => KeyCode::K594,
        OsCode::KEY_595 => KeyCode::K595,
        OsCode::KEY_596 => KeyCode::K596,
        OsCode::KEY_597 => KeyCode::K597,
        OsCode::KEY_598 => KeyCode::K598,
        OsCode::KEY_599 => KeyCode::K599,
        OsCode::KEY_600 => KeyCode::K600,
        OsCode::KEY_601 => KeyCode::K601,
        OsCode::KEY_602 => KeyCode::K602,
        OsCode::KEY_603 => KeyCode::K603,
        OsCode::KEY_604 => KeyCode::K604,
        OsCode::KEY_605 => KeyCode::K605,
        OsCode::KEY_606 => KeyCode::K606,
        OsCode::KEY_607 => KeyCode::K607,
        OsCode::KEY_KBDINPUTASSIST_PREV => KeyCode::K608,
        OsCode::KEY_KBDINPUTASSIST_NEXT => KeyCode::K609,
        OsCode::KEY_KBDINPUTASSIST_PREVGROUP => KeyCode::K610,
        OsCode::KEY_KBDINPUTASSIST_NEXTGROUP => KeyCode::K611,
        OsCode::KEY_KBDINPUTASSIST_ACCEPT => KeyCode::K612,
        OsCode::KEY_KBDINPUTASSIST_CANCEL => KeyCode::K613,
        OsCode::KEY_RIGHT_UP => KeyCode::K614,
        OsCode::KEY_RIGHT_DOWN => KeyCode::K615,
        OsCode::KEY_LEFT_UP => KeyCode::K616,
        OsCode::KEY_LEFT_DOWN => KeyCode::K617,
        OsCode::KEY_ROOT_MENU => KeyCode::K618,
        OsCode::KEY_MEDIA_TOP_MENU => KeyCode::K619,
        OsCode::KEY_NUMERIC_11 => KeyCode::K620,
        OsCode::KEY_NUMERIC_12 => KeyCode::K621,
        OsCode::KEY_AUDIO_DESC => KeyCode::K622,
        OsCode::KEY_3D_MODE => KeyCode::K623,
        OsCode::KEY_NEXT_FAVORITE => KeyCode::K624,
        OsCode::KEY_STOP_RECORD => KeyCode::K625,
        OsCode::KEY_PAUSE_RECORD => KeyCode::K626,
        OsCode::KEY_VOD => KeyCode::K627,
        OsCode::KEY_UNMUTE => KeyCode::K628,
        OsCode::KEY_FASTREVERSE => KeyCode::K629,
        OsCode::KEY_SLOWREVERSE => KeyCode::K630,
        OsCode::KEY_DATA => KeyCode::K631,
        OsCode::KEY_ONSCREEN_KEYBOARD => KeyCode::K632,
        OsCode::KEY_633 => KeyCode::K633,
        OsCode::KEY_634 => KeyCode::K634,
        OsCode::KEY_635 => KeyCode::K635,
        OsCode::KEY_636 => KeyCode::K636,
        OsCode::KEY_637 => KeyCode::K637,
        OsCode::KEY_638 => KeyCode::K638,
        OsCode::KEY_639 => KeyCode::K639,
        OsCode::KEY_640 => KeyCode::K640,
        OsCode::KEY_641 => KeyCode::K641,
        OsCode::KEY_642 => KeyCode::K642,
        OsCode::KEY_643 => KeyCode::K643,
        OsCode::KEY_644 => KeyCode::K644,
        OsCode::KEY_645 => KeyCode::K645,
        OsCode::KEY_646 => KeyCode::K646,
        OsCode::KEY_647 => KeyCode::K647,
        OsCode::KEY_648 => KeyCode::K648,
        OsCode::KEY_649 => KeyCode::K649,
        OsCode::KEY_650 => KeyCode::K650,
        OsCode::KEY_651 => KeyCode::K651,
        OsCode::KEY_652 => KeyCode::K652,
        OsCode::KEY_653 => KeyCode::K653,
        OsCode::KEY_654 => KeyCode::K654,
        OsCode::KEY_655 => KeyCode::K655,
        OsCode::KEY_656 => KeyCode::K656,
        OsCode::KEY_657 => KeyCode::K657,
        OsCode::KEY_658 => KeyCode::K658,
        OsCode::KEY_659 => KeyCode::K659,
        OsCode::KEY_660 => KeyCode::K660,
        OsCode::KEY_661 => KeyCode::K661,
        OsCode::KEY_662 => KeyCode::K662,
        OsCode::KEY_663 => KeyCode::K663,
        OsCode::KEY_664 => KeyCode::K664,
        OsCode::KEY_665 => KeyCode::K665,
        OsCode::KEY_666 => KeyCode::K666,
        OsCode::KEY_667 => KeyCode::K667,
        OsCode::KEY_668 => KeyCode::K668,
        OsCode::KEY_669 => KeyCode::K669,
        OsCode::KEY_670 => KeyCode::K670,
        OsCode::KEY_671 => KeyCode::K671,
        OsCode::KEY_672 => KeyCode::K672,
        OsCode::KEY_673 => KeyCode::K673,
        OsCode::KEY_674 => KeyCode::K674,
        OsCode::KEY_675 => KeyCode::K675,
        OsCode::KEY_676 => KeyCode::K676,
        OsCode::KEY_677 => KeyCode::K677,
        OsCode::KEY_678 => KeyCode::K678,
        OsCode::KEY_679 => KeyCode::K679,
        OsCode::KEY_680 => KeyCode::K680,
        OsCode::KEY_681 => KeyCode::K681,
        OsCode::KEY_682 => KeyCode::K682,
        OsCode::KEY_683 => KeyCode::K683,
        OsCode::KEY_684 => KeyCode::K684,
        OsCode::KEY_685 => KeyCode::K685,
        OsCode::KEY_686 => KeyCode::K686,
        OsCode::KEY_687 => KeyCode::K687,
        OsCode::KEY_688 => KeyCode::K688,
        OsCode::KEY_689 => KeyCode::K689,
        OsCode::KEY_690 => KeyCode::K690,
        OsCode::KEY_691 => KeyCode::K691,
        OsCode::KEY_692 => KeyCode::K692,
        OsCode::KEY_693 => KeyCode::K693,
        OsCode::KEY_694 => KeyCode::K694,
        OsCode::KEY_695 => KeyCode::K695,
        OsCode::KEY_696 => KeyCode::K696,
        OsCode::KEY_697 => KeyCode::K697,
        OsCode::KEY_698 => KeyCode::K698,
        OsCode::KEY_699 => KeyCode::K699,
        OsCode::KEY_700 => KeyCode::K700,
        OsCode::KEY_701 => KeyCode::K701,
        OsCode::KEY_702 => KeyCode::K702,
        OsCode::KEY_703 => KeyCode::K703,
        OsCode::BTN_TRIGGER_HAPPY1 => KeyCode::K704,
        OsCode::BTN_TRIGGER_HAPPY2 => KeyCode::K705,
        OsCode::BTN_TRIGGER_HAPPY3 => KeyCode::K706,
        OsCode::BTN_TRIGGER_HAPPY4 => KeyCode::K707,
        OsCode::BTN_TRIGGER_HAPPY5 => KeyCode::K708,
        OsCode::BTN_TRIGGER_HAPPY6 => KeyCode::K709,
        OsCode::BTN_TRIGGER_HAPPY7 => KeyCode::K710,
        OsCode::BTN_TRIGGER_HAPPY8 => KeyCode::K711,
        OsCode::BTN_TRIGGER_HAPPY9 => KeyCode::K712,
        OsCode::BTN_TRIGGER_HAPPY10 => KeyCode::K713,
        OsCode::BTN_TRIGGER_HAPPY11 => KeyCode::K714,
        OsCode::BTN_TRIGGER_HAPPY12 => KeyCode::K715,
        OsCode::BTN_TRIGGER_HAPPY13 => KeyCode::K716,
        OsCode::BTN_TRIGGER_HAPPY14 => KeyCode::K717,
        OsCode::BTN_TRIGGER_HAPPY15 => KeyCode::K718,
        OsCode::BTN_TRIGGER_HAPPY16 => KeyCode::K719,
        OsCode::BTN_TRIGGER_HAPPY17 => KeyCode::K720,
        OsCode::BTN_TRIGGER_HAPPY18 => KeyCode::K721,
        OsCode::BTN_TRIGGER_HAPPY19 => KeyCode::K722,
        OsCode::BTN_TRIGGER_HAPPY20 => KeyCode::K723,
        OsCode::BTN_TRIGGER_HAPPY21 => KeyCode::K724,
        OsCode::BTN_TRIGGER_HAPPY22 => KeyCode::K725,
        OsCode::BTN_TRIGGER_HAPPY23 => KeyCode::K726,
        OsCode::BTN_TRIGGER_HAPPY24 => KeyCode::K727,
        OsCode::BTN_TRIGGER_HAPPY25 => KeyCode::K728,
        OsCode::BTN_TRIGGER_HAPPY26 => KeyCode::K729,
        OsCode::BTN_TRIGGER_HAPPY27 => KeyCode::K730,
        OsCode::BTN_TRIGGER_HAPPY28 => KeyCode::K731,
        OsCode::BTN_TRIGGER_HAPPY29 => KeyCode::K732,
        OsCode::BTN_TRIGGER_HAPPY30 => KeyCode::K733,
        OsCode::BTN_TRIGGER_HAPPY31 => KeyCode::K734,
        OsCode::BTN_TRIGGER_HAPPY32 => KeyCode::K735,
        OsCode::BTN_TRIGGER_HAPPY33 => KeyCode::K736,
        OsCode::BTN_TRIGGER_HAPPY34 => KeyCode::K737,
        OsCode::BTN_TRIGGER_HAPPY35 => KeyCode::K738,
        OsCode::BTN_TRIGGER_HAPPY36 => KeyCode::K739,
        OsCode::BTN_TRIGGER_HAPPY37 => KeyCode::K740,
        OsCode::BTN_TRIGGER_HAPPY38 => KeyCode::K741,
        OsCode::BTN_TRIGGER_HAPPY39 => KeyCode::K742,
        OsCode::BTN_TRIGGER_HAPPY40 => KeyCode::K743,
        OsCode::BTN_MAX => KeyCode::K744,
        _ => KeyCode::No,
    }
}

fn haphazard_kc_to_osc_mappings(kc: KeyCode) -> OsCode {
    match kc {
        KeyCode::K252 => OsCode::KEY_252,
        KeyCode::K253 => OsCode::KEY_253,
        KeyCode::K254 => OsCode::KEY_254,
        KeyCode::K255 => OsCode::KEY_255,
        KeyCode::K256 => OsCode::BTN_0,
        KeyCode::K257 => OsCode::BTN_1,
        KeyCode::K258 => OsCode::BTN_2,
        KeyCode::K259 => OsCode::BTN_3,
        KeyCode::K260 => OsCode::BTN_4,
        KeyCode::K261 => OsCode::BTN_5,
        KeyCode::K262 => OsCode::BTN_6,
        KeyCode::K263 => OsCode::BTN_7,
        KeyCode::K264 => OsCode::BTN_8,
        KeyCode::K265 => OsCode::BTN_9,
        KeyCode::K266 => OsCode::KEY_266,
        KeyCode::K267 => OsCode::KEY_267,
        KeyCode::K268 => OsCode::KEY_268,
        KeyCode::K269 => OsCode::KEY_269,
        KeyCode::K270 => OsCode::KEY_270,
        KeyCode::K271 => OsCode::KEY_271,
        KeyCode::K272 => OsCode::BTN_LEFT,
        KeyCode::K273 => OsCode::BTN_RIGHT,
        KeyCode::K274 => OsCode::BTN_MIDDLE,
        KeyCode::K275 => OsCode::BTN_SIDE,
        KeyCode::K276 => OsCode::BTN_EXTRA,
        KeyCode::K277 => OsCode::BTN_FORWARD,
        KeyCode::K278 => OsCode::BTN_BACK,
        KeyCode::K279 => OsCode::BTN_TASK,
        KeyCode::K280 => OsCode::KEY_280,
        KeyCode::K281 => OsCode::KEY_281,
        KeyCode::K282 => OsCode::KEY_282,
        KeyCode::K283 => OsCode::KEY_283,
        KeyCode::K284 => OsCode::KEY_284,
        KeyCode::K285 => OsCode::KEY_285,
        KeyCode::K286 => OsCode::KEY_286,
        KeyCode::K287 => OsCode::KEY_287,
        KeyCode::K288 => OsCode::BTN_TRIGGER,
        KeyCode::K289 => OsCode::BTN_THUMB,
        KeyCode::K290 => OsCode::BTN_THUMB2,
        KeyCode::K291 => OsCode::BTN_TOP,
        KeyCode::K292 => OsCode::BTN_TOP2,
        KeyCode::K293 => OsCode::BTN_PINKIE,
        KeyCode::K294 => OsCode::BTN_BASE,
        KeyCode::K295 => OsCode::BTN_BASE2,
        KeyCode::K296 => OsCode::BTN_BASE3,
        KeyCode::K297 => OsCode::BTN_BASE4,
        KeyCode::K298 => OsCode::BTN_BASE5,
        KeyCode::K299 => OsCode::BTN_BASE6,
        KeyCode::K300 => OsCode::KEY_300,
        KeyCode::K301 => OsCode::KEY_301,
        KeyCode::K302 => OsCode::KEY_302,
        KeyCode::K303 => OsCode::BTN_DEAD,
        KeyCode::K304 => OsCode::BTN_SOUTH,
        KeyCode::K305 => OsCode::BTN_EAST,
        KeyCode::K306 => OsCode::BTN_C,
        KeyCode::K307 => OsCode::BTN_NORTH,
        KeyCode::K308 => OsCode::BTN_WEST,
        KeyCode::K309 => OsCode::BTN_Z,
        KeyCode::K310 => OsCode::BTN_TL,
        KeyCode::K311 => OsCode::BTN_TR,
        KeyCode::K312 => OsCode::BTN_TL2,
        KeyCode::K313 => OsCode::BTN_TR2,
        KeyCode::K314 => OsCode::BTN_SELECT,
        KeyCode::K315 => OsCode::BTN_START,
        KeyCode::K316 => OsCode::BTN_MODE,
        KeyCode::K317 => OsCode::BTN_THUMBL,
        KeyCode::K318 => OsCode::BTN_THUMBR,
        KeyCode::K319 => OsCode::KEY_319,
        KeyCode::K320 => OsCode::BTN_TOOL_PEN,
        KeyCode::K321 => OsCode::BTN_TOOL_RUBBER,
        KeyCode::K322 => OsCode::BTN_TOOL_BRUSH,
        KeyCode::K323 => OsCode::BTN_TOOL_PENCIL,
        KeyCode::K324 => OsCode::BTN_TOOL_AIRBRUSH,
        KeyCode::K325 => OsCode::BTN_TOOL_FINGER,
        KeyCode::K326 => OsCode::BTN_TOOL_MOUSE,
        KeyCode::K327 => OsCode::BTN_TOOL_LENS,
        KeyCode::K328 => OsCode::BTN_TOOL_QUINTTAP,
        KeyCode::K329 => OsCode::BTN_STYLUS3,
        KeyCode::K330 => OsCode::BTN_TOUCH,
        KeyCode::K331 => OsCode::BTN_STYLUS,
        KeyCode::K332 => OsCode::BTN_STYLUS2,
        KeyCode::K333 => OsCode::BTN_TOOL_DOUBLETAP,
        KeyCode::K334 => OsCode::BTN_TOOL_TRIPLETAP,
        KeyCode::K335 => OsCode::BTN_TOOL_QUADTAP,
        KeyCode::K336 => OsCode::BTN_GEAR_DOWN,
        KeyCode::K337 => OsCode::BTN_GEAR_UP,
        KeyCode::K338 => OsCode::KEY_338,
        KeyCode::K339 => OsCode::KEY_339,
        KeyCode::K340 => OsCode::KEY_340,
        KeyCode::K341 => OsCode::KEY_341,
        KeyCode::K342 => OsCode::KEY_342,
        KeyCode::K343 => OsCode::KEY_343,
        KeyCode::K344 => OsCode::KEY_344,
        KeyCode::K345 => OsCode::KEY_345,
        KeyCode::K346 => OsCode::KEY_346,
        KeyCode::K347 => OsCode::KEY_347,
        KeyCode::K348 => OsCode::KEY_348,
        KeyCode::K349 => OsCode::KEY_349,
        KeyCode::K350 => OsCode::KEY_350,
        KeyCode::K351 => OsCode::KEY_351,
        KeyCode::K352 => OsCode::KEY_OK,
        KeyCode::K353 => OsCode::KEY_SELECT,
        KeyCode::K354 => OsCode::KEY_GOTO,
        KeyCode::K355 => OsCode::KEY_CLEAR,
        KeyCode::K356 => OsCode::KEY_POWER2,
        KeyCode::K357 => OsCode::KEY_OPTION,
        KeyCode::K358 => OsCode::KEY_INFO,
        KeyCode::K359 => OsCode::KEY_TIME,
        KeyCode::K360 => OsCode::KEY_VENDOR,
        KeyCode::K361 => OsCode::KEY_ARCHIVE,
        KeyCode::K362 => OsCode::KEY_PROGRAM,
        KeyCode::K363 => OsCode::KEY_CHANNEL,
        KeyCode::K364 => OsCode::KEY_FAVORITES,
        KeyCode::K365 => OsCode::KEY_EPG,
        KeyCode::K366 => OsCode::KEY_PVR,
        KeyCode::K367 => OsCode::KEY_MHP,
        KeyCode::K368 => OsCode::KEY_LANGUAGE,
        KeyCode::K369 => OsCode::KEY_TITLE,
        KeyCode::K370 => OsCode::KEY_SUBTITLE,
        KeyCode::K371 => OsCode::KEY_ANGLE,
        KeyCode::K372 => OsCode::KEY_FULL_SCREEN,
        KeyCode::K373 => OsCode::KEY_MODE,
        KeyCode::K374 => OsCode::KEY_KEYBOARD,
        KeyCode::K375 => OsCode::KEY_ASPECT_RATIO,
        KeyCode::K376 => OsCode::KEY_PC,
        KeyCode::K377 => OsCode::KEY_TV,
        KeyCode::K378 => OsCode::KEY_TV2,
        KeyCode::K379 => OsCode::KEY_VCR,
        KeyCode::K380 => OsCode::KEY_VCR2,
        KeyCode::K381 => OsCode::KEY_SAT,
        KeyCode::K382 => OsCode::KEY_SAT2,
        KeyCode::K383 => OsCode::KEY_CD,
        KeyCode::K384 => OsCode::KEY_TAPE,
        KeyCode::K385 => OsCode::KEY_RADIO,
        KeyCode::K386 => OsCode::KEY_TUNER,
        KeyCode::K387 => OsCode::KEY_PLAYER,
        KeyCode::K388 => OsCode::KEY_TEXT,
        KeyCode::K389 => OsCode::KEY_DVD,
        KeyCode::K390 => OsCode::KEY_AUX,
        KeyCode::K391 => OsCode::KEY_MP3,
        KeyCode::K392 => OsCode::KEY_AUDIO,
        KeyCode::K393 => OsCode::KEY_VIDEO,
        KeyCode::K394 => OsCode::KEY_DIRECTORY,
        KeyCode::K395 => OsCode::KEY_LIST,
        KeyCode::K396 => OsCode::KEY_MEMO,
        KeyCode::K397 => OsCode::KEY_CALENDAR,
        KeyCode::K398 => OsCode::KEY_RED,
        KeyCode::K399 => OsCode::KEY_GREEN,
        KeyCode::K400 => OsCode::KEY_YELLOW,
        KeyCode::K401 => OsCode::KEY_BLUE,
        KeyCode::K402 => OsCode::KEY_CHANNELUP,
        KeyCode::K403 => OsCode::KEY_CHANNELDOWN,
        KeyCode::K404 => OsCode::KEY_FIRST,
        KeyCode::K405 => OsCode::KEY_LAST,
        KeyCode::K406 => OsCode::KEY_AB,
        KeyCode::K407 => OsCode::KEY_NEXT,
        KeyCode::K408 => OsCode::KEY_RESTART,
        KeyCode::K409 => OsCode::KEY_SLOW,
        KeyCode::K410 => OsCode::KEY_SHUFFLE,
        KeyCode::K411 => OsCode::KEY_BREAK,
        KeyCode::K412 => OsCode::KEY_PREVIOUS,
        KeyCode::K413 => OsCode::KEY_DIGITS,
        KeyCode::K414 => OsCode::KEY_TEEN,
        KeyCode::K415 => OsCode::KEY_TWEN,
        KeyCode::K416 => OsCode::KEY_VIDEOPHONE,
        KeyCode::K417 => OsCode::KEY_GAMES,
        KeyCode::K418 => OsCode::KEY_ZOOMIN,
        KeyCode::K419 => OsCode::KEY_ZOOMOUT,
        KeyCode::K420 => OsCode::KEY_ZOOMRESET,
        KeyCode::K421 => OsCode::KEY_WORDPROCESSOR,
        KeyCode::K422 => OsCode::KEY_EDITOR,
        KeyCode::K423 => OsCode::KEY_SPREADSHEET,
        KeyCode::K424 => OsCode::KEY_GRAPHICSEDITOR,
        KeyCode::K425 => OsCode::KEY_PRESENTATION,
        KeyCode::K426 => OsCode::KEY_DATABASE,
        KeyCode::K427 => OsCode::KEY_NEWS,
        KeyCode::K428 => OsCode::KEY_VOICEMAIL,
        KeyCode::K429 => OsCode::KEY_ADDRESSBOOK,
        KeyCode::K430 => OsCode::KEY_MESSENGER,
        KeyCode::K431 => OsCode::KEY_DISPLAYTOGGLE,
        KeyCode::K432 => OsCode::KEY_SPELLCHECK,
        KeyCode::K433 => OsCode::KEY_LOGOFF,
        KeyCode::K434 => OsCode::KEY_DOLLAR,
        KeyCode::K435 => OsCode::KEY_EURO,
        KeyCode::K436 => OsCode::KEY_FRAMEBACK,
        KeyCode::K437 => OsCode::KEY_FRAMEFORWARD,
        KeyCode::K438 => OsCode::KEY_CONTEXT_MENU,
        KeyCode::K439 => OsCode::KEY_MEDIA_REPEAT,
        KeyCode::K440 => OsCode::KEY_10CHANNELSUP,
        KeyCode::K441 => OsCode::KEY_10CHANNELSDOWN,
        KeyCode::K442 => OsCode::KEY_IMAGES,
        KeyCode::K443 => OsCode::KEY_443,
        KeyCode::K444 => OsCode::KEY_444,
        KeyCode::K445 => OsCode::KEY_445,
        KeyCode::K446 => OsCode::KEY_446,
        KeyCode::K447 => OsCode::KEY_447,
        KeyCode::K448 => OsCode::KEY_DEL_EOL,
        KeyCode::K449 => OsCode::KEY_DEL_EOS,
        KeyCode::K450 => OsCode::KEY_INS_LINE,
        KeyCode::K451 => OsCode::KEY_DEL_LINE,
        KeyCode::K452 => OsCode::KEY_452,
        KeyCode::K453 => OsCode::KEY_453,
        KeyCode::K454 => OsCode::KEY_454,
        KeyCode::K455 => OsCode::KEY_455,
        KeyCode::K456 => OsCode::KEY_456,
        KeyCode::K457 => OsCode::KEY_457,
        KeyCode::K458 => OsCode::KEY_458,
        KeyCode::K459 => OsCode::KEY_459,
        KeyCode::K460 => OsCode::KEY_460,
        KeyCode::K461 => OsCode::KEY_461,
        KeyCode::K462 => OsCode::KEY_462,
        KeyCode::K463 => OsCode::KEY_463,
        KeyCode::K464 => OsCode::KEY_FN,
        KeyCode::K465 => OsCode::KEY_FN_ESC,
        KeyCode::K466 => OsCode::KEY_FN_F1,
        KeyCode::K467 => OsCode::KEY_FN_F2,
        KeyCode::K468 => OsCode::KEY_FN_F3,
        KeyCode::K469 => OsCode::KEY_FN_F4,
        KeyCode::K470 => OsCode::KEY_FN_F5,
        KeyCode::K471 => OsCode::KEY_FN_F6,
        KeyCode::K472 => OsCode::KEY_FN_F7,
        KeyCode::K473 => OsCode::KEY_FN_F8,
        KeyCode::K474 => OsCode::KEY_FN_F9,
        KeyCode::K475 => OsCode::KEY_FN_F10,
        KeyCode::K476 => OsCode::KEY_FN_F11,
        KeyCode::K477 => OsCode::KEY_FN_F12,
        KeyCode::K478 => OsCode::KEY_FN_1,
        KeyCode::K479 => OsCode::KEY_FN_2,
        KeyCode::K480 => OsCode::KEY_FN_D,
        KeyCode::K481 => OsCode::KEY_FN_E,
        KeyCode::K482 => OsCode::KEY_FN_F,
        KeyCode::K483 => OsCode::KEY_FN_S,
        KeyCode::K484 => OsCode::KEY_FN_B,
        KeyCode::K485 => OsCode::KEY_485,
        KeyCode::K486 => OsCode::KEY_486,
        KeyCode::K487 => OsCode::KEY_487,
        KeyCode::K488 => OsCode::KEY_488,
        KeyCode::K489 => OsCode::KEY_489,
        KeyCode::K490 => OsCode::KEY_490,
        KeyCode::K491 => OsCode::KEY_491,
        KeyCode::K492 => OsCode::KEY_492,
        KeyCode::K493 => OsCode::KEY_493,
        KeyCode::K494 => OsCode::KEY_494,
        KeyCode::K495 => OsCode::KEY_495,
        KeyCode::K496 => OsCode::KEY_496,
        KeyCode::K497 => OsCode::KEY_BRL_DOT1,
        KeyCode::K498 => OsCode::KEY_BRL_DOT2,
        KeyCode::K499 => OsCode::KEY_BRL_DOT3,
        KeyCode::K500 => OsCode::KEY_BRL_DOT4,
        KeyCode::K501 => OsCode::KEY_BRL_DOT5,
        KeyCode::K502 => OsCode::KEY_BRL_DOT6,
        KeyCode::K503 => OsCode::KEY_BRL_DOT7,
        KeyCode::K504 => OsCode::KEY_BRL_DOT8,
        KeyCode::K505 => OsCode::KEY_BRL_DOT9,
        KeyCode::K506 => OsCode::KEY_BRL_DOT10,
        KeyCode::K507 => OsCode::KEY_507,
        KeyCode::K508 => OsCode::KEY_508,
        KeyCode::K509 => OsCode::KEY_509,
        KeyCode::K510 => OsCode::KEY_510,
        KeyCode::K511 => OsCode::KEY_511,
        KeyCode::K512 => OsCode::KEY_NUMERIC_0,
        KeyCode::K513 => OsCode::KEY_NUMERIC_1,
        KeyCode::K514 => OsCode::KEY_NUMERIC_2,
        KeyCode::K515 => OsCode::KEY_NUMERIC_3,
        KeyCode::K516 => OsCode::KEY_NUMERIC_4,
        KeyCode::K517 => OsCode::KEY_NUMERIC_5,
        KeyCode::K518 => OsCode::KEY_NUMERIC_6,
        KeyCode::K519 => OsCode::KEY_NUMERIC_7,
        KeyCode::K520 => OsCode::KEY_NUMERIC_8,
        KeyCode::K521 => OsCode::KEY_NUMERIC_9,
        KeyCode::K522 => OsCode::KEY_NUMERIC_STAR,
        KeyCode::K523 => OsCode::KEY_NUMERIC_POUND,
        KeyCode::K524 => OsCode::KEY_NUMERIC_A,
        KeyCode::K525 => OsCode::KEY_NUMERIC_B,
        KeyCode::K526 => OsCode::KEY_NUMERIC_C,
        KeyCode::K527 => OsCode::KEY_NUMERIC_D,
        KeyCode::K528 => OsCode::KEY_CAMERA_FOCUS,
        KeyCode::K529 => OsCode::KEY_WPS_BUTTON,
        KeyCode::K530 => OsCode::KEY_TOUCHPAD_TOGGLE,
        KeyCode::K531 => OsCode::KEY_TOUCHPAD_ON,
        KeyCode::K532 => OsCode::KEY_TOUCHPAD_OFF,
        KeyCode::K533 => OsCode::KEY_CAMERA_ZOOMIN,
        KeyCode::K534 => OsCode::KEY_CAMERA_ZOOMOUT,
        KeyCode::K535 => OsCode::KEY_CAMERA_UP,
        KeyCode::K536 => OsCode::KEY_CAMERA_DOWN,
        KeyCode::K537 => OsCode::KEY_CAMERA_LEFT,
        KeyCode::K538 => OsCode::KEY_CAMERA_RIGHT,
        KeyCode::K539 => OsCode::KEY_ATTENDANT_ON,
        KeyCode::K540 => OsCode::KEY_ATTENDANT_OFF,
        KeyCode::K541 => OsCode::KEY_ATTENDANT_TOGGLE,
        KeyCode::K542 => OsCode::KEY_LIGHTS_TOGGLE,
        KeyCode::K543 => OsCode::KEY_543,
        KeyCode::K544 => OsCode::BTN_DPAD_UP,
        KeyCode::K545 => OsCode::BTN_DPAD_DOWN,
        KeyCode::K546 => OsCode::BTN_DPAD_LEFT,
        KeyCode::K547 => OsCode::BTN_DPAD_RIGHT,
        KeyCode::K548 => OsCode::KEY_548,
        KeyCode::K549 => OsCode::KEY_549,
        KeyCode::K550 => OsCode::KEY_550,
        KeyCode::K551 => OsCode::KEY_551,
        KeyCode::K552 => OsCode::KEY_552,
        KeyCode::K553 => OsCode::KEY_553,
        KeyCode::K554 => OsCode::KEY_554,
        KeyCode::K555 => OsCode::KEY_555,
        KeyCode::K556 => OsCode::KEY_556,
        KeyCode::K557 => OsCode::KEY_557,
        KeyCode::K558 => OsCode::KEY_558,
        KeyCode::K559 => OsCode::KEY_559,
        KeyCode::K560 => OsCode::KEY_ALS_TOGGLE,
        KeyCode::K561 => OsCode::KEY_ROTATE_LOCK_TOGGLE,
        KeyCode::K562 => OsCode::KEY_562,
        KeyCode::K563 => OsCode::KEY_563,
        KeyCode::K564 => OsCode::KEY_564,
        KeyCode::K565 => OsCode::KEY_565,
        KeyCode::K566 => OsCode::KEY_566,
        KeyCode::K567 => OsCode::KEY_567,
        KeyCode::K568 => OsCode::KEY_568,
        KeyCode::K569 => OsCode::KEY_569,
        KeyCode::K570 => OsCode::KEY_570,
        KeyCode::K571 => OsCode::KEY_571,
        KeyCode::K572 => OsCode::KEY_572,
        KeyCode::K573 => OsCode::KEY_573,
        KeyCode::K574 => OsCode::KEY_574,
        KeyCode::K575 => OsCode::KEY_575,
        KeyCode::K576 => OsCode::KEY_BUTTONCONFIG,
        KeyCode::K577 => OsCode::KEY_TASKMANAGER,
        KeyCode::K578 => OsCode::KEY_JOURNAL,
        KeyCode::K579 => OsCode::KEY_CONTROLPANEL,
        KeyCode::K580 => OsCode::KEY_APPSELECT,
        KeyCode::K581 => OsCode::KEY_SCREENSAVER,
        KeyCode::K582 => OsCode::KEY_VOICECOMMAND,
        KeyCode::K583 => OsCode::KEY_ASSISTANT,
        KeyCode::K584 => OsCode::KEY_KBD_LAYOUT_NEXT,
        KeyCode::K585 => OsCode::KEY_585,
        KeyCode::K586 => OsCode::KEY_586,
        KeyCode::K587 => OsCode::KEY_587,
        KeyCode::K588 => OsCode::KEY_588,
        KeyCode::K589 => OsCode::KEY_589,
        KeyCode::K590 => OsCode::KEY_590,
        KeyCode::K591 => OsCode::KEY_591,
        KeyCode::K592 => OsCode::KEY_BRIGHTNESS_MIN,
        KeyCode::K593 => OsCode::KEY_BRIGHTNESS_MAX,
        KeyCode::K594 => OsCode::KEY_594,
        KeyCode::K595 => OsCode::KEY_595,
        KeyCode::K596 => OsCode::KEY_596,
        KeyCode::K597 => OsCode::KEY_597,
        KeyCode::K598 => OsCode::KEY_598,
        KeyCode::K599 => OsCode::KEY_599,
        KeyCode::K600 => OsCode::KEY_600,
        KeyCode::K601 => OsCode::KEY_601,
        KeyCode::K602 => OsCode::KEY_602,
        KeyCode::K603 => OsCode::KEY_603,
        KeyCode::K604 => OsCode::KEY_604,
        KeyCode::K605 => OsCode::KEY_605,
        KeyCode::K606 => OsCode::KEY_606,
        KeyCode::K607 => OsCode::KEY_607,
        KeyCode::K608 => OsCode::KEY_KBDINPUTASSIST_PREV,
        KeyCode::K609 => OsCode::KEY_KBDINPUTASSIST_NEXT,
        KeyCode::K610 => OsCode::KEY_KBDINPUTASSIST_PREVGROUP,
        KeyCode::K611 => OsCode::KEY_KBDINPUTASSIST_NEXTGROUP,
        KeyCode::K612 => OsCode::KEY_KBDINPUTASSIST_ACCEPT,
        KeyCode::K613 => OsCode::KEY_KBDINPUTASSIST_CANCEL,
        KeyCode::K614 => OsCode::KEY_RIGHT_UP,
        KeyCode::K615 => OsCode::KEY_RIGHT_DOWN,
        KeyCode::K616 => OsCode::KEY_LEFT_UP,
        KeyCode::K617 => OsCode::KEY_LEFT_DOWN,
        KeyCode::K618 => OsCode::KEY_ROOT_MENU,
        KeyCode::K619 => OsCode::KEY_MEDIA_TOP_MENU,
        KeyCode::K620 => OsCode::KEY_NUMERIC_11,
        KeyCode::K621 => OsCode::KEY_NUMERIC_12,
        KeyCode::K622 => OsCode::KEY_AUDIO_DESC,
        KeyCode::K623 => OsCode::KEY_3D_MODE,
        KeyCode::K624 => OsCode::KEY_NEXT_FAVORITE,
        KeyCode::K625 => OsCode::KEY_STOP_RECORD,
        KeyCode::K626 => OsCode::KEY_PAUSE_RECORD,
        KeyCode::K627 => OsCode::KEY_VOD,
        KeyCode::K628 => OsCode::KEY_UNMUTE,
        KeyCode::K629 => OsCode::KEY_FASTREVERSE,
        KeyCode::K630 => OsCode::KEY_SLOWREVERSE,
        KeyCode::K631 => OsCode::KEY_DATA,
        KeyCode::K632 => OsCode::KEY_ONSCREEN_KEYBOARD,
        KeyCode::K633 => OsCode::KEY_633,
        KeyCode::K634 => OsCode::KEY_634,
        KeyCode::K635 => OsCode::KEY_635,
        KeyCode::K636 => OsCode::KEY_636,
        KeyCode::K637 => OsCode::KEY_637,
        KeyCode::K638 => OsCode::KEY_638,
        KeyCode::K639 => OsCode::KEY_639,
        KeyCode::K640 => OsCode::KEY_640,
        KeyCode::K641 => OsCode::KEY_641,
        KeyCode::K642 => OsCode::KEY_642,
        KeyCode::K643 => OsCode::KEY_643,
        KeyCode::K644 => OsCode::KEY_644,
        KeyCode::K645 => OsCode::KEY_645,
        KeyCode::K646 => OsCode::KEY_646,
        KeyCode::K647 => OsCode::KEY_647,
        KeyCode::K648 => OsCode::KEY_648,
        KeyCode::K649 => OsCode::KEY_649,
        KeyCode::K650 => OsCode::KEY_650,
        KeyCode::K651 => OsCode::KEY_651,
        KeyCode::K652 => OsCode::KEY_652,
        KeyCode::K653 => OsCode::KEY_653,
        KeyCode::K654 => OsCode::KEY_654,
        KeyCode::K655 => OsCode::KEY_655,
        KeyCode::K656 => OsCode::KEY_656,
        KeyCode::K657 => OsCode::KEY_657,
        KeyCode::K658 => OsCode::KEY_658,
        KeyCode::K659 => OsCode::KEY_659,
        KeyCode::K660 => OsCode::KEY_660,
        KeyCode::K661 => OsCode::KEY_661,
        KeyCode::K662 => OsCode::KEY_662,
        KeyCode::K663 => OsCode::KEY_663,
        KeyCode::K664 => OsCode::KEY_664,
        KeyCode::K665 => OsCode::KEY_665,
        KeyCode::K666 => OsCode::KEY_666,
        KeyCode::K667 => OsCode::KEY_667,
        KeyCode::K668 => OsCode::KEY_668,
        KeyCode::K669 => OsCode::KEY_669,
        KeyCode::K670 => OsCode::KEY_670,
        KeyCode::K671 => OsCode::KEY_671,
        KeyCode::K672 => OsCode::KEY_672,
        KeyCode::K673 => OsCode::KEY_673,
        KeyCode::K674 => OsCode::KEY_674,
        KeyCode::K675 => OsCode::KEY_675,
        KeyCode::K676 => OsCode::KEY_676,
        KeyCode::K677 => OsCode::KEY_677,
        KeyCode::K678 => OsCode::KEY_678,
        KeyCode::K679 => OsCode::KEY_679,
        KeyCode::K680 => OsCode::KEY_680,
        KeyCode::K681 => OsCode::KEY_681,
        KeyCode::K682 => OsCode::KEY_682,
        KeyCode::K683 => OsCode::KEY_683,
        KeyCode::K684 => OsCode::KEY_684,
        KeyCode::K685 => OsCode::KEY_685,
        KeyCode::K686 => OsCode::KEY_686,
        KeyCode::K687 => OsCode::KEY_687,
        KeyCode::K688 => OsCode::KEY_688,
        KeyCode::K689 => OsCode::KEY_689,
        KeyCode::K690 => OsCode::KEY_690,
        KeyCode::K691 => OsCode::KEY_691,
        KeyCode::K692 => OsCode::KEY_692,
        KeyCode::K693 => OsCode::KEY_693,
        KeyCode::K694 => OsCode::KEY_694,
        KeyCode::K695 => OsCode::KEY_695,
        KeyCode::K696 => OsCode::KEY_696,
        KeyCode::K697 => OsCode::KEY_697,
        KeyCode::K698 => OsCode::KEY_698,
        KeyCode::K699 => OsCode::KEY_699,
        KeyCode::K700 => OsCode::KEY_700,
        KeyCode::K701 => OsCode::KEY_701,
        KeyCode::K702 => OsCode::KEY_702,
        KeyCode::K703 => OsCode::KEY_703,
        KeyCode::K704 => OsCode::BTN_TRIGGER_HAPPY1,
        KeyCode::K705 => OsCode::BTN_TRIGGER_HAPPY2,
        KeyCode::K706 => OsCode::BTN_TRIGGER_HAPPY3,
        KeyCode::K707 => OsCode::BTN_TRIGGER_HAPPY4,
        KeyCode::K708 => OsCode::BTN_TRIGGER_HAPPY5,
        KeyCode::K709 => OsCode::BTN_TRIGGER_HAPPY6,
        KeyCode::K710 => OsCode::BTN_TRIGGER_HAPPY7,
        KeyCode::K711 => OsCode::BTN_TRIGGER_HAPPY8,
        KeyCode::K712 => OsCode::BTN_TRIGGER_HAPPY9,
        KeyCode::K713 => OsCode::BTN_TRIGGER_HAPPY10,
        KeyCode::K714 => OsCode::BTN_TRIGGER_HAPPY11,
        KeyCode::K715 => OsCode::BTN_TRIGGER_HAPPY12,
        KeyCode::K716 => OsCode::BTN_TRIGGER_HAPPY13,
        KeyCode::K717 => OsCode::BTN_TRIGGER_HAPPY14,
        KeyCode::K718 => OsCode::BTN_TRIGGER_HAPPY15,
        KeyCode::K719 => OsCode::BTN_TRIGGER_HAPPY16,
        KeyCode::K720 => OsCode::BTN_TRIGGER_HAPPY17,
        KeyCode::K721 => OsCode::BTN_TRIGGER_HAPPY18,
        KeyCode::K722 => OsCode::BTN_TRIGGER_HAPPY19,
        KeyCode::K723 => OsCode::BTN_TRIGGER_HAPPY20,
        KeyCode::K724 => OsCode::BTN_TRIGGER_HAPPY21,
        KeyCode::K725 => OsCode::BTN_TRIGGER_HAPPY22,
        KeyCode::K726 => OsCode::BTN_TRIGGER_HAPPY23,
        KeyCode::K727 => OsCode::BTN_TRIGGER_HAPPY24,
        KeyCode::K728 => OsCode::BTN_TRIGGER_HAPPY25,
        KeyCode::K729 => OsCode::BTN_TRIGGER_HAPPY26,
        KeyCode::K730 => OsCode::BTN_TRIGGER_HAPPY27,
        KeyCode::K731 => OsCode::BTN_TRIGGER_HAPPY28,
        KeyCode::K732 => OsCode::BTN_TRIGGER_HAPPY29,
        KeyCode::K733 => OsCode::BTN_TRIGGER_HAPPY30,
        KeyCode::K734 => OsCode::BTN_TRIGGER_HAPPY31,
        KeyCode::K735 => OsCode::BTN_TRIGGER_HAPPY32,
        KeyCode::K736 => OsCode::BTN_TRIGGER_HAPPY33,
        KeyCode::K737 => OsCode::BTN_TRIGGER_HAPPY34,
        KeyCode::K738 => OsCode::BTN_TRIGGER_HAPPY35,
        KeyCode::K739 => OsCode::BTN_TRIGGER_HAPPY36,
        KeyCode::K740 => OsCode::BTN_TRIGGER_HAPPY37,
        KeyCode::K741 => OsCode::BTN_TRIGGER_HAPPY38,
        KeyCode::K742 => OsCode::BTN_TRIGGER_HAPPY39,
        KeyCode::K743 => OsCode::BTN_TRIGGER_HAPPY40,
        KeyCode::K744 => OsCode::BTN_MAX,
        _ => OsCode::KEY_UNKNOWN,
    }
}