34#include "common/tusb_common.h"
86 HID_REPORT_TYPE_INVALID = 0,
147 HID_PROTOCOL_BOOT = 0,
148 HID_PROTOCOL_REPORT = 1
149} hid_protocol_mode_enum_t;
210 GAMEPAD_BUTTON_0 = TU_BIT(0),
211 GAMEPAD_BUTTON_1 = TU_BIT(1),
212 GAMEPAD_BUTTON_2 = TU_BIT(2),
213 GAMEPAD_BUTTON_3 = TU_BIT(3),
214 GAMEPAD_BUTTON_4 = TU_BIT(4),
215 GAMEPAD_BUTTON_5 = TU_BIT(5),
216 GAMEPAD_BUTTON_6 = TU_BIT(6),
217 GAMEPAD_BUTTON_7 = TU_BIT(7),
218 GAMEPAD_BUTTON_8 = TU_BIT(8),
219 GAMEPAD_BUTTON_9 = TU_BIT(9),
220 GAMEPAD_BUTTON_10 = TU_BIT(10),
221 GAMEPAD_BUTTON_11 = TU_BIT(11),
222 GAMEPAD_BUTTON_12 = TU_BIT(12),
223 GAMEPAD_BUTTON_13 = TU_BIT(13),
224 GAMEPAD_BUTTON_14 = TU_BIT(14),
225 GAMEPAD_BUTTON_15 = TU_BIT(15),
226 GAMEPAD_BUTTON_16 = TU_BIT(16),
227 GAMEPAD_BUTTON_17 = TU_BIT(17),
228 GAMEPAD_BUTTON_18 = TU_BIT(18),
229 GAMEPAD_BUTTON_19 = TU_BIT(19),
230 GAMEPAD_BUTTON_20 = TU_BIT(20),
231 GAMEPAD_BUTTON_21 = TU_BIT(21),
232 GAMEPAD_BUTTON_22 = TU_BIT(22),
233 GAMEPAD_BUTTON_23 = TU_BIT(23),
234 GAMEPAD_BUTTON_24 = TU_BIT(24),
235 GAMEPAD_BUTTON_25 = TU_BIT(25),
236 GAMEPAD_BUTTON_26 = TU_BIT(26),
237 GAMEPAD_BUTTON_27 = TU_BIT(27),
238 GAMEPAD_BUTTON_28 = TU_BIT(28),
239 GAMEPAD_BUTTON_29 = TU_BIT(29),
240 GAMEPAD_BUTTON_30 = TU_BIT(30),
241 GAMEPAD_BUTTON_31 = TU_BIT(31),
246#define GAMEPAD_BUTTON_A GAMEPAD_BUTTON_0
247#define GAMEPAD_BUTTON_SOUTH GAMEPAD_BUTTON_0
249#define GAMEPAD_BUTTON_B GAMEPAD_BUTTON_1
250#define GAMEPAD_BUTTON_EAST GAMEPAD_BUTTON_1
252#define GAMEPAD_BUTTON_C GAMEPAD_BUTTON_2
254#define GAMEPAD_BUTTON_X GAMEPAD_BUTTON_3
255#define GAMEPAD_BUTTON_NORTH GAMEPAD_BUTTON_3
257#define GAMEPAD_BUTTON_Y GAMEPAD_BUTTON_4
258#define GAMEPAD_BUTTON_WEST GAMEPAD_BUTTON_4
260#define GAMEPAD_BUTTON_Z GAMEPAD_BUTTON_5
261#define GAMEPAD_BUTTON_TL GAMEPAD_BUTTON_6
262#define GAMEPAD_BUTTON_TR GAMEPAD_BUTTON_7
263#define GAMEPAD_BUTTON_TL2 GAMEPAD_BUTTON_8
264#define GAMEPAD_BUTTON_TR2 GAMEPAD_BUTTON_9
265#define GAMEPAD_BUTTON_SELECT GAMEPAD_BUTTON_10
266#define GAMEPAD_BUTTON_START GAMEPAD_BUTTON_11
267#define GAMEPAD_BUTTON_MODE GAMEPAD_BUTTON_12
268#define GAMEPAD_BUTTON_THUMBL GAMEPAD_BUTTON_13
269#define GAMEPAD_BUTTON_THUMBR GAMEPAD_BUTTON_14
356#define HID_KEY_NONE 0x00
357#define HID_KEY_A 0x04
358#define HID_KEY_B 0x05
359#define HID_KEY_C 0x06
360#define HID_KEY_D 0x07
361#define HID_KEY_E 0x08
362#define HID_KEY_F 0x09
363#define HID_KEY_G 0x0A
364#define HID_KEY_H 0x0B
365#define HID_KEY_I 0x0C
366#define HID_KEY_J 0x0D
367#define HID_KEY_K 0x0E
368#define HID_KEY_L 0x0F
369#define HID_KEY_M 0x10
370#define HID_KEY_N 0x11
371#define HID_KEY_O 0x12
372#define HID_KEY_P 0x13
373#define HID_KEY_Q 0x14
374#define HID_KEY_R 0x15
375#define HID_KEY_S 0x16
376#define HID_KEY_T 0x17
377#define HID_KEY_U 0x18
378#define HID_KEY_V 0x19
379#define HID_KEY_W 0x1A
380#define HID_KEY_X 0x1B
381#define HID_KEY_Y 0x1C
382#define HID_KEY_Z 0x1D
383#define HID_KEY_1 0x1E
384#define HID_KEY_2 0x1F
385#define HID_KEY_3 0x20
386#define HID_KEY_4 0x21
387#define HID_KEY_5 0x22
388#define HID_KEY_6 0x23
389#define HID_KEY_7 0x24
390#define HID_KEY_8 0x25
391#define HID_KEY_9 0x26
392#define HID_KEY_0 0x27
393#define HID_KEY_ENTER 0x28
394#define HID_KEY_ESCAPE 0x29
395#define HID_KEY_BACKSPACE 0x2A
396#define HID_KEY_TAB 0x2B
397#define HID_KEY_SPACE 0x2C
398#define HID_KEY_MINUS 0x2D
399#define HID_KEY_EQUAL 0x2E
400#define HID_KEY_BRACKET_LEFT 0x2F
401#define HID_KEY_BRACKET_RIGHT 0x30
402#define HID_KEY_BACKSLASH 0x31
403#define HID_KEY_EUROPE_1 0x32
404#define HID_KEY_SEMICOLON 0x33
405#define HID_KEY_APOSTROPHE 0x34
406#define HID_KEY_GRAVE 0x35
407#define HID_KEY_COMMA 0x36
408#define HID_KEY_PERIOD 0x37
409#define HID_KEY_SLASH 0x38
410#define HID_KEY_CAPS_LOCK 0x39
411#define HID_KEY_F1 0x3A
412#define HID_KEY_F2 0x3B
413#define HID_KEY_F3 0x3C
414#define HID_KEY_F4 0x3D
415#define HID_KEY_F5 0x3E
416#define HID_KEY_F6 0x3F
417#define HID_KEY_F7 0x40
418#define HID_KEY_F8 0x41
419#define HID_KEY_F9 0x42
420#define HID_KEY_F10 0x43
421#define HID_KEY_F11 0x44
422#define HID_KEY_F12 0x45
423#define HID_KEY_PRINT_SCREEN 0x46
424#define HID_KEY_SCROLL_LOCK 0x47
425#define HID_KEY_PAUSE 0x48
426#define HID_KEY_INSERT 0x49
427#define HID_KEY_HOME 0x4A
428#define HID_KEY_PAGE_UP 0x4B
429#define HID_KEY_DELETE 0x4C
430#define HID_KEY_END 0x4D
431#define HID_KEY_PAGE_DOWN 0x4E
432#define HID_KEY_ARROW_RIGHT 0x4F
433#define HID_KEY_ARROW_LEFT 0x50
434#define HID_KEY_ARROW_DOWN 0x51
435#define HID_KEY_ARROW_UP 0x52
436#define HID_KEY_NUM_LOCK 0x53
437#define HID_KEY_KEYPAD_DIVIDE 0x54
438#define HID_KEY_KEYPAD_MULTIPLY 0x55
439#define HID_KEY_KEYPAD_SUBTRACT 0x56
440#define HID_KEY_KEYPAD_ADD 0x57
441#define HID_KEY_KEYPAD_ENTER 0x58
442#define HID_KEY_KEYPAD_1 0x59
443#define HID_KEY_KEYPAD_2 0x5A
444#define HID_KEY_KEYPAD_3 0x5B
445#define HID_KEY_KEYPAD_4 0x5C
446#define HID_KEY_KEYPAD_5 0x5D
447#define HID_KEY_KEYPAD_6 0x5E
448#define HID_KEY_KEYPAD_7 0x5F
449#define HID_KEY_KEYPAD_8 0x60
450#define HID_KEY_KEYPAD_9 0x61
451#define HID_KEY_KEYPAD_0 0x62
452#define HID_KEY_KEYPAD_DECIMAL 0x63
453#define HID_KEY_EUROPE_2 0x64
454#define HID_KEY_APPLICATION 0x65
455#define HID_KEY_POWER 0x66
456#define HID_KEY_KEYPAD_EQUAL 0x67
457#define HID_KEY_F13 0x68
458#define HID_KEY_F14 0x69
459#define HID_KEY_F15 0x6A
460#define HID_KEY_F16 0x6B
461#define HID_KEY_F17 0x6C
462#define HID_KEY_F18 0x6D
463#define HID_KEY_F19 0x6E
464#define HID_KEY_F20 0x6F
465#define HID_KEY_F21 0x70
466#define HID_KEY_F22 0x71
467#define HID_KEY_F23 0x72
468#define HID_KEY_F24 0x73
469#define HID_KEY_EXECUTE 0x74
470#define HID_KEY_HELP 0x75
471#define HID_KEY_MENU 0x76
472#define HID_KEY_SELECT 0x77
473#define HID_KEY_STOP 0x78
474#define HID_KEY_AGAIN 0x79
475#define HID_KEY_UNDO 0x7A
476#define HID_KEY_CUT 0x7B
477#define HID_KEY_COPY 0x7C
478#define HID_KEY_PASTE 0x7D
479#define HID_KEY_FIND 0x7E
480#define HID_KEY_MUTE 0x7F
481#define HID_KEY_VOLUME_UP 0x80
482#define HID_KEY_VOLUME_DOWN 0x81
483#define HID_KEY_LOCKING_CAPS_LOCK 0x82
484#define HID_KEY_LOCKING_NUM_LOCK 0x83
485#define HID_KEY_LOCKING_SCROLL_LOCK 0x84
486#define HID_KEY_KEYPAD_COMMA 0x85
487#define HID_KEY_KEYPAD_EQUAL_SIGN 0x86
488#define HID_KEY_KANJI1 0x87
489#define HID_KEY_KANJI2 0x88
490#define HID_KEY_KANJI3 0x89
491#define HID_KEY_KANJI4 0x8A
492#define HID_KEY_KANJI5 0x8B
493#define HID_KEY_KANJI6 0x8C
494#define HID_KEY_KANJI7 0x8D
495#define HID_KEY_KANJI8 0x8E
496#define HID_KEY_KANJI9 0x8F
497#define HID_KEY_LANG1 0x90
498#define HID_KEY_LANG2 0x91
499#define HID_KEY_LANG3 0x92
500#define HID_KEY_LANG4 0x93
501#define HID_KEY_LANG5 0x94
502#define HID_KEY_LANG6 0x95
503#define HID_KEY_LANG7 0x96
504#define HID_KEY_LANG8 0x97
505#define HID_KEY_LANG9 0x98
506#define HID_KEY_ALTERNATE_ERASE 0x99
507#define HID_KEY_SYSREQ_ATTENTION 0x9A
508#define HID_KEY_CANCEL 0x9B
509#define HID_KEY_CLEAR 0x9C
510#define HID_KEY_PRIOR 0x9D
511#define HID_KEY_RETURN 0x9E
512#define HID_KEY_SEPARATOR 0x9F
513#define HID_KEY_OUT 0xA0
514#define HID_KEY_OPER 0xA1
515#define HID_KEY_CLEAR_AGAIN 0xA2
516#define HID_KEY_CRSEL_PROPS 0xA3
517#define HID_KEY_EXSEL 0xA4
519#define HID_KEY_CONTROL_LEFT 0xE0
520#define HID_KEY_SHIFT_LEFT 0xE1
521#define HID_KEY_ALT_LEFT 0xE2
522#define HID_KEY_GUI_LEFT 0xE3
523#define HID_KEY_CONTROL_RIGHT 0xE4
524#define HID_KEY_SHIFT_RIGHT 0xE5
525#define HID_KEY_ALT_RIGHT 0xE6
526#define HID_KEY_GUI_RIGHT 0xE7
534#define HID_REPORT_DATA_0(data)
535#define HID_REPORT_DATA_1(data) , data
536#define HID_REPORT_DATA_2(data) , U16_TO_U8S_LE(data)
537#define HID_REPORT_DATA_3(data) , U32_TO_U8S_LE(data)
539#define HID_REPORT_ITEM(data, tag, type, size) \
540 (((tag) << 4) | ((type) << 2) | (size)) HID_REPORT_DATA_##size(data)
555 RI_MAIN_COLLECTION = 10,
556 RI_MAIN_FEATURE = 11,
557 RI_MAIN_COLLECTION_END = 12
560#define HID_INPUT(x) HID_REPORT_ITEM(x, RI_MAIN_INPUT , RI_TYPE_MAIN, 1)
561#define HID_OUTPUT(x) HID_REPORT_ITEM(x, RI_MAIN_OUTPUT , RI_TYPE_MAIN, 1)
562#define HID_COLLECTION(x) HID_REPORT_ITEM(x, RI_MAIN_COLLECTION , RI_TYPE_MAIN, 1)
563#define HID_FEATURE(x) HID_REPORT_ITEM(x, RI_MAIN_FEATURE , RI_TYPE_MAIN, 1)
564#define HID_COLLECTION_END HID_REPORT_ITEM(x, RI_MAIN_COLLECTION_END, RI_TYPE_MAIN, 0)
567#define HID_DATA (0<<0)
568#define HID_CONSTANT (1<<0)
570#define HID_ARRAY (0<<1)
571#define HID_VARIABLE (1<<1)
573#define HID_ABSOLUTE (0<<2)
574#define HID_RELATIVE (1<<2)
576#define HID_WRAP_NO (0<<3)
577#define HID_WRAP (1<<3)
579#define HID_LINEAR (0<<4)
580#define HID_NONLINEAR (1<<4)
582#define HID_PREFERRED_STATE (0<<5)
583#define HID_PREFERRED_NO (1<<5)
585#define HID_NO_NULL_POSITION (0<<6)
586#define HID_NULL_STATE (1<<6)
588#define HID_NON_VOLATILE (0<<7)
589#define HID_VOLATILE (1<<7)
591#define HID_BITFIELD (0<<8)
592#define HID_BUFFERED_BYTES (1<<8)
596 HID_COLLECTION_PHYSICAL = 0,
597 HID_COLLECTION_APPLICATION,
598 HID_COLLECTION_LOGICAL,
599 HID_COLLECTION_REPORT,
600 HID_COLLECTION_NAMED_ARRAY,
601 HID_COLLECTION_USAGE_SWITCH,
602 HID_COLLECTION_USAGE_MODIFIER
609 RI_GLOBAL_USAGE_PAGE = 0,
610 RI_GLOBAL_LOGICAL_MIN = 1,
611 RI_GLOBAL_LOGICAL_MAX = 2,
612 RI_GLOBAL_PHYSICAL_MIN = 3,
613 RI_GLOBAL_PHYSICAL_MAX = 4,
614 RI_GLOBAL_UNIT_EXPONENT = 5,
616 RI_GLOBAL_REPORT_SIZE = 7,
617 RI_GLOBAL_REPORT_ID = 8,
618 RI_GLOBAL_REPORT_COUNT = 9,
623#define HID_USAGE_PAGE(x) HID_REPORT_ITEM(x, RI_GLOBAL_USAGE_PAGE, RI_TYPE_GLOBAL, 1)
624#define HID_USAGE_PAGE_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_USAGE_PAGE, RI_TYPE_GLOBAL, n)
626#define HID_LOGICAL_MIN(x) HID_REPORT_ITEM(x, RI_GLOBAL_LOGICAL_MIN, RI_TYPE_GLOBAL, 1)
627#define HID_LOGICAL_MIN_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_LOGICAL_MIN, RI_TYPE_GLOBAL, n)
629#define HID_LOGICAL_MAX(x) HID_REPORT_ITEM(x, RI_GLOBAL_LOGICAL_MAX, RI_TYPE_GLOBAL, 1)
630#define HID_LOGICAL_MAX_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_LOGICAL_MAX, RI_TYPE_GLOBAL, n)
632#define HID_PHYSICAL_MIN(x) HID_REPORT_ITEM(x, RI_GLOBAL_PHYSICAL_MIN, RI_TYPE_GLOBAL, 1)
633#define HID_PHYSICAL_MIN_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_PHYSICAL_MIN, RI_TYPE_GLOBAL, n)
635#define HID_PHYSICAL_MAX(x) HID_REPORT_ITEM(x, RI_GLOBAL_PHYSICAL_MAX, RI_TYPE_GLOBAL, 1)
636#define HID_PHYSICAL_MAX_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_PHYSICAL_MAX, RI_TYPE_GLOBAL, n)
638#define HID_UNIT_EXPONENT(x) HID_REPORT_ITEM(x, RI_GLOBAL_UNIT_EXPONENT, RI_TYPE_GLOBAL, 1)
639#define HID_UNIT_EXPONENT_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_UNIT_EXPONENT, RI_TYPE_GLOBAL, n)
641#define HID_UNIT(x) HID_REPORT_ITEM(x, RI_GLOBAL_UNIT, RI_TYPE_GLOBAL, 1)
642#define HID_UNIT_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_UNIT, RI_TYPE_GLOBAL, n)
644#define HID_REPORT_SIZE(x) HID_REPORT_ITEM(x, RI_GLOBAL_REPORT_SIZE, RI_TYPE_GLOBAL, 1)
645#define HID_REPORT_SIZE_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_REPORT_SIZE, RI_TYPE_GLOBAL, n)
647#define HID_REPORT_ID(x) HID_REPORT_ITEM(x, RI_GLOBAL_REPORT_ID, RI_TYPE_GLOBAL, 1),
648#define HID_REPORT_ID_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_REPORT_ID, RI_TYPE_GLOBAL, n),
650#define HID_REPORT_COUNT(x) HID_REPORT_ITEM(x, RI_GLOBAL_REPORT_COUNT, RI_TYPE_GLOBAL, 1)
651#define HID_REPORT_COUNT_N(x, n) HID_REPORT_ITEM(x, RI_GLOBAL_REPORT_COUNT, RI_TYPE_GLOBAL, n)
653#define HID_PUSH HID_REPORT_ITEM(x, RI_GLOBAL_PUSH, RI_TYPE_GLOBAL, 0)
654#define HID_POP HID_REPORT_ITEM(x, RI_GLOBAL_POP, RI_TYPE_GLOBAL, 0)
660 RI_LOCAL_USAGE_MIN = 1,
661 RI_LOCAL_USAGE_MAX = 2,
662 RI_LOCAL_DESIGNATOR_INDEX = 3,
663 RI_LOCAL_DESIGNATOR_MIN = 4,
664 RI_LOCAL_DESIGNATOR_MAX = 5,
666 RI_LOCAL_STRING_INDEX = 7,
667 RI_LOCAL_STRING_MIN = 8,
668 RI_LOCAL_STRING_MAX = 9,
669 RI_LOCAL_DELIMITER = 10,
672#define HID_USAGE(x) HID_REPORT_ITEM(x, RI_LOCAL_USAGE, RI_TYPE_LOCAL, 1)
673#define HID_USAGE_N(x, n) HID_REPORT_ITEM(x, RI_LOCAL_USAGE, RI_TYPE_LOCAL, n)
675#define HID_USAGE_MIN(x) HID_REPORT_ITEM(x, RI_LOCAL_USAGE_MIN, RI_TYPE_LOCAL, 1)
676#define HID_USAGE_MIN_N(x, n) HID_REPORT_ITEM(x, RI_LOCAL_USAGE_MIN, RI_TYPE_LOCAL, n)
678#define HID_USAGE_MAX(x) HID_REPORT_ITEM(x, RI_LOCAL_USAGE_MAX, RI_TYPE_LOCAL, 1)
679#define HID_USAGE_MAX_N(x, n) HID_REPORT_ITEM(x, RI_LOCAL_USAGE_MAX, RI_TYPE_LOCAL, n)
687 HID_USAGE_PAGE_DESKTOP = 0x01,
688 HID_USAGE_PAGE_SIMULATE = 0x02,
689 HID_USAGE_PAGE_VIRTUAL_REALITY = 0x03,
690 HID_USAGE_PAGE_SPORT = 0x04,
691 HID_USAGE_PAGE_GAME = 0x05,
692 HID_USAGE_PAGE_GENERIC_DEVICE = 0x06,
693 HID_USAGE_PAGE_KEYBOARD = 0x07,
694 HID_USAGE_PAGE_LED = 0x08,
695 HID_USAGE_PAGE_BUTTON = 0x09,
696 HID_USAGE_PAGE_ORDINAL = 0x0a,
697 HID_USAGE_PAGE_TELEPHONY = 0x0b,
698 HID_USAGE_PAGE_CONSUMER = 0x0c,
699 HID_USAGE_PAGE_DIGITIZER = 0x0d,
700 HID_USAGE_PAGE_PID = 0x0f,
701 HID_USAGE_PAGE_UNICODE = 0x10,
702 HID_USAGE_PAGE_ALPHA_DISPLAY = 0x14,
703 HID_USAGE_PAGE_MEDICAL = 0x40,
704 HID_USAGE_PAGE_MONITOR = 0x80,
705 HID_USAGE_PAGE_POWER = 0x84,
706 HID_USAGE_PAGE_BARCODE_SCANNER = 0x8c,
707 HID_USAGE_PAGE_SCALE = 0x8d,
708 HID_USAGE_PAGE_MSR = 0x8e,
709 HID_USAGE_PAGE_CAMERA = 0x90,
710 HID_USAGE_PAGE_ARCADE = 0x91,
711 HID_USAGE_PAGE_FIDO = 0xF1D0,
712 HID_USAGE_PAGE_VENDOR = 0xFF00
717 HID_USAGE_DESKTOP_POINTER = 0x01,
718 HID_USAGE_DESKTOP_MOUSE = 0x02,
719 HID_USAGE_DESKTOP_JOYSTICK = 0x04,
720 HID_USAGE_DESKTOP_GAMEPAD = 0x05,
721 HID_USAGE_DESKTOP_KEYBOARD = 0x06,
722 HID_USAGE_DESKTOP_KEYPAD = 0x07,
723 HID_USAGE_DESKTOP_MULTI_AXIS_CONTROLLER = 0x08,
724 HID_USAGE_DESKTOP_TABLET_PC_SYSTEM = 0x09,
725 HID_USAGE_DESKTOP_X = 0x30,
726 HID_USAGE_DESKTOP_Y = 0x31,
727 HID_USAGE_DESKTOP_Z = 0x32,
728 HID_USAGE_DESKTOP_RX = 0x33,
729 HID_USAGE_DESKTOP_RY = 0x34,
730 HID_USAGE_DESKTOP_RZ = 0x35,
731 HID_USAGE_DESKTOP_SLIDER = 0x36,
732 HID_USAGE_DESKTOP_DIAL = 0x37,
733 HID_USAGE_DESKTOP_WHEEL = 0x38,
734 HID_USAGE_DESKTOP_HAT_SWITCH = 0x39,
735 HID_USAGE_DESKTOP_COUNTED_BUFFER = 0x3a,
736 HID_USAGE_DESKTOP_BYTE_COUNT = 0x3b,
737 HID_USAGE_DESKTOP_MOTION_WAKEUP = 0x3c,
738 HID_USAGE_DESKTOP_START = 0x3d,
739 HID_USAGE_DESKTOP_SELECT = 0x3e,
740 HID_USAGE_DESKTOP_VX = 0x40,
741 HID_USAGE_DESKTOP_VY = 0x41,
742 HID_USAGE_DESKTOP_VZ = 0x42,
743 HID_USAGE_DESKTOP_VBRX = 0x43,
744 HID_USAGE_DESKTOP_VBRY = 0x44,
745 HID_USAGE_DESKTOP_VBRZ = 0x45,
746 HID_USAGE_DESKTOP_VNO = 0x46,
747 HID_USAGE_DESKTOP_FEATURE_NOTIFICATION = 0x47,
748 HID_USAGE_DESKTOP_RESOLUTION_MULTIPLIER = 0x48,
749 HID_USAGE_DESKTOP_SYSTEM_CONTROL = 0x80,
750 HID_USAGE_DESKTOP_SYSTEM_POWER_DOWN = 0x81,
751 HID_USAGE_DESKTOP_SYSTEM_SLEEP = 0x82,
752 HID_USAGE_DESKTOP_SYSTEM_WAKE_UP = 0x83,
753 HID_USAGE_DESKTOP_SYSTEM_CONTEXT_MENU = 0x84,
754 HID_USAGE_DESKTOP_SYSTEM_MAIN_MENU = 0x85,
755 HID_USAGE_DESKTOP_SYSTEM_APP_MENU = 0x86,
756 HID_USAGE_DESKTOP_SYSTEM_MENU_HELP = 0x87,
757 HID_USAGE_DESKTOP_SYSTEM_MENU_EXIT = 0x88,
758 HID_USAGE_DESKTOP_SYSTEM_MENU_SELECT = 0x89,
759 HID_USAGE_DESKTOP_SYSTEM_MENU_RIGHT = 0x8A,
760 HID_USAGE_DESKTOP_SYSTEM_MENU_LEFT = 0x8B,
761 HID_USAGE_DESKTOP_SYSTEM_MENU_UP = 0x8C,
762 HID_USAGE_DESKTOP_SYSTEM_MENU_DOWN = 0x8D,
763 HID_USAGE_DESKTOP_SYSTEM_COLD_RESTART = 0x8E,
764 HID_USAGE_DESKTOP_SYSTEM_WARM_RESTART = 0x8F,
765 HID_USAGE_DESKTOP_DPAD_UP = 0x90,
766 HID_USAGE_DESKTOP_DPAD_DOWN = 0x91,
767 HID_USAGE_DESKTOP_DPAD_RIGHT = 0x92,
768 HID_USAGE_DESKTOP_DPAD_LEFT = 0x93,
769 HID_USAGE_DESKTOP_SYSTEM_DOCK = 0xA0,
770 HID_USAGE_DESKTOP_SYSTEM_UNDOCK = 0xA1,
771 HID_USAGE_DESKTOP_SYSTEM_SETUP = 0xA2,
772 HID_USAGE_DESKTOP_SYSTEM_BREAK = 0xA3,
773 HID_USAGE_DESKTOP_SYSTEM_DEBUGGER_BREAK = 0xA4,
774 HID_USAGE_DESKTOP_APPLICATION_BREAK = 0xA5,
775 HID_USAGE_DESKTOP_APPLICATION_DEBUGGER_BREAK = 0xA6,
776 HID_USAGE_DESKTOP_SYSTEM_SPEAKER_MUTE = 0xA7,
777 HID_USAGE_DESKTOP_SYSTEM_HIBERNATE = 0xA8,
778 HID_USAGE_DESKTOP_SYSTEM_DISPLAY_INVERT = 0xB0,
779 HID_USAGE_DESKTOP_SYSTEM_DISPLAY_INTERNAL = 0xB1,
780 HID_USAGE_DESKTOP_SYSTEM_DISPLAY_EXTERNAL = 0xB2,
781 HID_USAGE_DESKTOP_SYSTEM_DISPLAY_BOTH = 0xB3,
782 HID_USAGE_DESKTOP_SYSTEM_DISPLAY_DUAL = 0xB4,
783 HID_USAGE_DESKTOP_SYSTEM_DISPLAY_TOGGLE_INT_EXT = 0xB5,
784 HID_USAGE_DESKTOP_SYSTEM_DISPLAY_SWAP_PRIMARY_SECONDARY = 0xB6,
785 HID_USAGE_DESKTOP_SYSTEM_DISPLAY_LCD_AUTOSCALE = 0xB7
794 HID_USAGE_CONSUMER_CONTROL = 0x0001,
797 HID_USAGE_CONSUMER_POWER = 0x0030,
798 HID_USAGE_CONSUMER_RESET = 0x0031,
799 HID_USAGE_CONSUMER_SLEEP = 0x0032,
802 HID_USAGE_CONSUMER_BRIGHTNESS_INCREMENT = 0x006F,
803 HID_USAGE_CONSUMER_BRIGHTNESS_DECREMENT = 0x0070,
807 HID_USAGE_CONSUMER_WIRELESS_RADIO_CONTROLS = 0x000C,
808 HID_USAGE_CONSUMER_WIRELESS_RADIO_BUTTONS = 0x00C6,
809 HID_USAGE_CONSUMER_WIRELESS_RADIO_LED = 0x00C7,
810 HID_USAGE_CONSUMER_WIRELESS_RADIO_SLIDER_SWITCH = 0x00C8,
813 HID_USAGE_CONSUMER_PLAY_PAUSE = 0x00CD,
814 HID_USAGE_CONSUMER_SCAN_NEXT = 0x00B5,
815 HID_USAGE_CONSUMER_SCAN_PREVIOUS = 0x00B6,
816 HID_USAGE_CONSUMER_STOP = 0x00B7,
817 HID_USAGE_CONSUMER_VOLUME = 0x00E0,
818 HID_USAGE_CONSUMER_MUTE = 0x00E2,
819 HID_USAGE_CONSUMER_BASS = 0x00E3,
820 HID_USAGE_CONSUMER_TREBLE = 0x00E4,
821 HID_USAGE_CONSUMER_BASS_BOOST = 0x00E5,
822 HID_USAGE_CONSUMER_VOLUME_INCREMENT = 0x00E9,
823 HID_USAGE_CONSUMER_VOLUME_DECREMENT = 0x00EA,
824 HID_USAGE_CONSUMER_BASS_INCREMENT = 0x0152,
825 HID_USAGE_CONSUMER_BASS_DECREMENT = 0x0153,
826 HID_USAGE_CONSUMER_TREBLE_INCREMENT = 0x0154,
827 HID_USAGE_CONSUMER_TREBLE_DECREMENT = 0x0155,
830 HID_USAGE_CONSUMER_AL_CONSUMER_CONTROL_CONFIGURATION = 0x0183,
831 HID_USAGE_CONSUMER_AL_EMAIL_READER = 0x018A,
832 HID_USAGE_CONSUMER_AL_CALCULATOR = 0x0192,
833 HID_USAGE_CONSUMER_AL_LOCAL_BROWSER = 0x0194,
836 HID_USAGE_CONSUMER_AC_SEARCH = 0x0221,
837 HID_USAGE_CONSUMER_AC_HOME = 0x0223,
838 HID_USAGE_CONSUMER_AC_BACK = 0x0224,
839 HID_USAGE_CONSUMER_AC_FORWARD = 0x0225,
840 HID_USAGE_CONSUMER_AC_STOP = 0x0226,
841 HID_USAGE_CONSUMER_AC_REFRESH = 0x0227,
842 HID_USAGE_CONSUMER_AC_BOOKMARKS = 0x022A,
845 HID_USAGE_CONSUMER_AC_PAN = 0x0238,
851 HID_USAGE_FIDO_U2FHID = 0x01,
852 HID_USAGE_FIDO_DATA_IN = 0x20,
853 HID_USAGE_FIDO_DATA_OUT = 0x21
872#define HID_ASCII_TO_KEYCODE \
881 {0, HID_KEY_BACKSPACE }, \
883 {0, HID_KEY_ENTER }, \
886 {0, HID_KEY_ENTER }, \
900 {0, HID_KEY_ESCAPE }, \
906 {0, HID_KEY_SPACE }, \
908 {1, HID_KEY_APOSTROPHE }, \
913 {0, HID_KEY_APOSTROPHE }, \
917 {1, HID_KEY_EQUAL }, \
918 {0, HID_KEY_COMMA }, \
919 {0, HID_KEY_MINUS }, \
920 {0, HID_KEY_PERIOD }, \
921 {0, HID_KEY_SLASH }, \
932 {1, HID_KEY_SEMICOLON }, \
933 {0, HID_KEY_SEMICOLON }, \
934 {1, HID_KEY_COMMA }, \
935 {0, HID_KEY_EQUAL }, \
936 {1, HID_KEY_PERIOD }, \
937 {1, HID_KEY_SLASH }, \
966 {0, HID_KEY_BRACKET_LEFT }, \
967 {0, HID_KEY_BACKSLASH }, \
968 {0, HID_KEY_BRACKET_RIGHT }, \
970 {1, HID_KEY_MINUS }, \
972 {0, HID_KEY_GRAVE }, \
999 {1, HID_KEY_BRACKET_LEFT }, \
1000 {1, HID_KEY_BACKSLASH }, \
1001 {1, HID_KEY_BRACKET_RIGHT }, \
1002 {1, HID_KEY_GRAVE }, \
1003 {0, HID_KEY_DELETE } \
1016#define HID_KEYCODE_TO_ASCII \
1058 {'\x1b', '\x1b' }, \
1069 {'\'' , '\"' }, /* 0x34 */ \
1070 {'`' , '~' }, /* 0x35 */ \
1071 {',' , '<' }, /* 0x36 */ \
1072 {'.' , '>' }, /* 0x37 */ \
1073 {'/' , '?' }, /* 0x38 */ \
1075 {0 , 0 }, /* 0x39 */ \
1076 {0 , 0 }, /* 0x3a */ \
1077 {0 , 0 }, /* 0x3b */ \
1078 {0 , 0 }, /* 0x3c */ \
1079 {0 , 0 }, /* 0x3d */ \
1080 {0 , 0 }, /* 0x3e */ \
1081 {0 , 0 }, /* 0x3f */ \
1082 {0 , 0 }, /* 0x40 */ \
1083 {0 , 0 }, /* 0x41 */ \
1084 {0 , 0 }, /* 0x42 */ \
1085 {0 , 0 }, /* 0x43 */ \
1086 {0 , 0 }, /* 0x44 */ \
1087 {0 , 0 }, /* 0x45 */ \
1088 {0 , 0 }, /* 0x46 */ \
1089 {0 , 0 }, /* 0x47 */ \
1090 {0 , 0 }, /* 0x48 */ \
1091 {0 , 0 }, /* 0x49 */ \
1092 {0 , 0 }, /* 0x4a */ \
1093 {0 , 0 }, /* 0x4b */ \
1094 {0 , 0 }, /* 0x4c */ \
1095 {0 , 0 }, /* 0x4d */ \
1096 {0 , 0 }, /* 0x4e */ \
1097 {0 , 0 }, /* 0x4f */ \
1098 {0 , 0 }, /* 0x50 */ \
1099 {0 , 0 }, /* 0x51 */ \
1100 {0 , 0 }, /* 0x52 */ \
1101 {0 , 0 }, /* 0x53 */ \
1103 {'/' , '/' }, /* 0x54 */ \
1104 {'*' , '*' }, /* 0x55 */ \
1105 {'-' , '-' }, /* 0x56 */ \
1106 {'+' , '+' }, /* 0x57 */ \
1107 {'\r' , '\r' }, /* 0x58 */ \
1108 {'1' , 0 }, /* 0x59 */ \
1109 {'2' , 0 }, /* 0x5a */ \
1110 {'3' , 0 }, /* 0x5b */ \
1111 {'4' , 0 }, /* 0x5c */ \
1112 {'5' , '5' }, /* 0x5d */ \
1113 {'6' , 0 }, /* 0x5e */ \
1114 {'7' , 0 }, /* 0x5f */ \
1115 {'8' , 0 }, /* 0x60 */ \
1116 {'9' , 0 }, /* 0x61 */ \
1117 {'0' , 0 }, /* 0x62 */ \
1118 {'.' , 0 }, /* 0x63 */ \
1119 {0 , 0 }, /* 0x64 */ \
1120 {0 , 0 }, /* 0x65 */ \
1121 {0 , 0 }, /* 0x66 */ \
1122 {'=' , '=' }, /* 0x67 */ \
1129#endif /* _TUSB_HID_H__ */
uint8_t bDescriptorType
Descriptor Type. Value: TUSB_DESC_CS_INTERFACE.
Definition audio.h:657
uint8_t bLength
Size of this descriptor in bytes: 9.
Definition audio.h:656
struct TU_ATTR_PACKED tusb_hid_descriptor_hid_t
USB HID Descriptor.
hid_request_enum_t
HID Class Specific Control Request.
Definition hid.h:94
hid_subclass_enum_t
HID Subclass.
Definition hid.h:62
hid_interface_protocol_enum_t
HID Interface Protocol.
Definition hid.h:69
hid_descriptor_enum_t
HID Descriptor Type.
Definition hid.h:77
hid_report_type_t
HID Request Report Type.
Definition hid.h:85
hid_local_enum_t
HID Local Code.
Definition hid.h:105
@ HID_REQ_CONTROL_GET_PROTOCOL
Get Protocol.
Definition hid.h:97
@ HID_REQ_CONTROL_SET_REPORT
Set Report.
Definition hid.h:98
@ HID_REQ_CONTROL_GET_REPORT
Get Report.
Definition hid.h:95
@ HID_REQ_CONTROL_SET_PROTOCOL
Set Protocol.
Definition hid.h:100
@ HID_REQ_CONTROL_SET_IDLE
Set Idle.
Definition hid.h:99
@ HID_REQ_CONTROL_GET_IDLE
Get Idle.
Definition hid.h:96
@ HID_SUBCLASS_BOOT
Boot Interface Subclass.
Definition hid.h:64
@ HID_SUBCLASS_NONE
No Subclass.
Definition hid.h:63
@ HID_ITF_PROTOCOL_KEYBOARD
Keyboard.
Definition hid.h:71
@ HID_ITF_PROTOCOL_MOUSE
Mouse.
Definition hid.h:72
@ HID_ITF_PROTOCOL_NONE
None.
Definition hid.h:70
@ HID_DESC_TYPE_PHYSICAL
Physical Descriptor.
Definition hid.h:80
@ HID_DESC_TYPE_REPORT
Report Descriptor.
Definition hid.h:79
@ HID_DESC_TYPE_HID
HID Descriptor.
Definition hid.h:78
@ HID_REPORT_TYPE_INPUT
Input.
Definition hid.h:87
@ HID_REPORT_TYPE_OUTPUT
Output.
Definition hid.h:88
@ HID_REPORT_TYPE_FEATURE
Feature.
Definition hid.h:89
@ HID_LOCAL_Switzerland
Switzerland.
Definition hid.h:135
@ HID_LOCAL_Swiss_German
Swiss/German.
Definition hid.h:134
@ HID_LOCAL_Czech_Republic
Czech_Republic.
Definition hid.h:111
@ HID_LOCAL_Danish
Danish.
Definition hid.h:112
@ HID_LOCAL_Persian_Farsi
Persian (Farsi)
Definition hid.h:126
@ HID_LOCAL_Latin_American
Latin_American.
Definition hid.h:123
@ HID_LOCAL_Korean
Korean.
Definition hid.h:122
@ HID_LOCAL_Taiwan
Taiwan.
Definition hid.h:136
@ HID_LOCAL_Turkish_Q
Turkish-Q.
Definition hid.h:137
@ HID_LOCAL_Netherlands_Dutch
Netherlands/Dutch.
Definition hid.h:124
@ HID_LOCAL_Belgian
Belgian.
Definition hid.h:108
@ HID_LOCAL_Canadian_Bilingual
Canadian_Bilingual.
Definition hid.h:109
@ HID_LOCAL_Portuguese
Portuguese.
Definition hid.h:128
@ HID_LOCAL_Arabic
Arabic.
Definition hid.h:107
@ HID_LOCAL_Slovakia
Slovakia.
Definition hid.h:130
@ HID_LOCAL_Spanish
Spanish.
Definition hid.h:131
@ HID_LOCAL_Greek
Greek.
Definition hid.h:116
@ HID_LOCAL_Russia
Russia.
Definition hid.h:129
@ HID_LOCAL_Turkish_F
Turkish-F.
Definition hid.h:141
@ HID_LOCAL_NotSupported
NotSupported.
Definition hid.h:106
@ HID_LOCAL_Hungary
Hungary.
Definition hid.h:118
@ HID_LOCAL_Swedish
Swedish.
Definition hid.h:132
@ HID_LOCAL_Yugoslavia
Yugoslavia.
Definition hid.h:140
@ HID_LOCAL_International
International.
Definition hid.h:119
@ HID_LOCAL_Hebrew
Hebrew.
Definition hid.h:117
@ HID_LOCAL_Finnish
Finnish.
Definition hid.h:113
@ HID_LOCAL_Canadian_French
Canadian_French.
Definition hid.h:110
@ HID_LOCAL_Swiss_French
Swiss/French.
Definition hid.h:133
@ HID_LOCAL_US
US.
Definition hid.h:139
@ HID_LOCAL_UK
UK.
Definition hid.h:138
@ HID_LOCAL_Italian
Italian.
Definition hid.h:120
@ HID_LOCAL_French
French.
Definition hid.h:114
@ HID_LOCAL_German
German.
Definition hid.h:115
@ HID_LOCAL_Japan_Katakana
Japan_Katakana.
Definition hid.h:121
@ HID_LOCAL_Norwegian
Norwegian.
Definition hid.h:125
@ HID_LOCAL_Poland
Poland.
Definition hid.h:127
hid_gamepad_button_bm_t
Standard Gamepad Buttons Bitmap.
Definition hid.h:209
struct TU_ATTR_PACKED hid_gamepad_report_t
HID Gamepad Protocol Report.
hid_gamepad_hat_t
Standard Gamepad HAT/DPAD Buttons (from Linux input event codes)
Definition hid.h:273
@ GAMEPAD_HAT_UP
DPAD_UP.
Definition hid.h:275
@ GAMEPAD_HAT_DOWN_LEFT
DPAD_DOWN_LEFT.
Definition hid.h:280
@ GAMEPAD_HAT_DOWN_RIGHT
DPAD_DOWN_RIGHT.
Definition hid.h:278
@ GAMEPAD_HAT_LEFT
DPAD_LEFT.
Definition hid.h:281
@ GAMEPAD_HAT_RIGHT
DPAD_RIGHT.
Definition hid.h:277
@ GAMEPAD_HAT_DOWN
DPAD_DOWN.
Definition hid.h:279
@ GAMEPAD_HAT_UP_RIGHT
DPAD_UP_RIGHT.
Definition hid.h:276
@ GAMEPAD_HAT_CENTERED
DPAD_CENTERED.
Definition hid.h:274
@ GAMEPAD_HAT_UP_LEFT
DPAD_UP_LEFT.
Definition hid.h:282
hid_keyboard_modifier_bm_t
Keyboard modifier codes bitmap.
Definition hid.h:331
hid_keyboard_led_bm_t
Definition hid.h:343
struct TU_ATTR_PACKED hid_keyboard_report_t
Standard HID Boot Protocol Keyboard Report.
@ KEYBOARD_MODIFIER_RIGHTALT
Right Alt.
Definition hid.h:338
@ KEYBOARD_MODIFIER_RIGHTGUI
Right Window.
Definition hid.h:339
@ KEYBOARD_MODIFIER_RIGHTCTRL
Right Control.
Definition hid.h:336
@ KEYBOARD_MODIFIER_LEFTGUI
Left Window.
Definition hid.h:335
@ KEYBOARD_MODIFIER_LEFTCTRL
Left Control.
Definition hid.h:332
@ KEYBOARD_MODIFIER_RIGHTSHIFT
Right Shift.
Definition hid.h:337
@ KEYBOARD_MODIFIER_LEFTALT
Left Alt.
Definition hid.h:334
@ KEYBOARD_MODIFIER_LEFTSHIFT
Left Shift.
Definition hid.h:333
@ KEYBOARD_LED_CAPSLOCK
Caps Lock LED.
Definition hid.h:345
@ KEYBOARD_LED_KANA
Kana mode.
Definition hid.h:348
@ KEYBOARD_LED_SCROLLLOCK
Scroll Lock LED.
Definition hid.h:346
@ KEYBOARD_LED_COMPOSE
Composition Mode.
Definition hid.h:347
@ KEYBOARD_LED_NUMLOCK
Num Lock LED.
Definition hid.h:344
hid_mouse_button_bm_t
Standard Mouse Buttons Bitmap.
Definition hid.h:305
struct TU_ATTR_PACKED hid_mouse_report_t
Standard HID Boot Protocol Mouse Report.
@ MOUSE_BUTTON_FORWARD
Forward button,.
Definition hid.h:310
@ MOUSE_BUTTON_BACKWARD
Backward button,.
Definition hid.h:309
@ MOUSE_BUTTON_LEFT
Left button.
Definition hid.h:306
@ MOUSE_BUTTON_RIGHT
Right button.
Definition hid.h:307
@ MOUSE_BUTTON_MIDDLE
Middle button.
Definition hid.h:308
AUDIO Channel Cluster Descriptor (4.1)
Definition audio.h:647
int8_t rx
Delta Rx movement of analog left trigger.
Definition hid.h:201
uint16_t wReportLength
Definition hid.h:57
uint8_t buttons
Definition hid.h:296
uint16_t bcdHID
Definition hid.h:52
uint32_t buttons
Buttons mask for currently pressed buttons.
Definition hid.h:204
uint8_t keycode[6]
Definition hid.h:326
int8_t z
Delta z movement of right analog-joystick.
Definition hid.h:199
int8_t wheel
Definition hid.h:299
int8_t x
Delta x movement of left analog-stick.
Definition hid.h:197
uint8_t bReportType
Definition hid.h:56
uint8_t modifier
Definition hid.h:324
uint8_t bNumDescriptors
Definition hid.h:54
int8_t y
Delta y movement of left analog-stick.
Definition hid.h:198
int8_t rz
Delta Rz movement of right analog-joystick.
Definition hid.h:200
uint8_t bCountryCode
Definition hid.h:53
uint8_t reserved
Definition hid.h:325
int8_t ry
Delta Ry movement of analog right trigger.
Definition hid.h:202
uint8_t hat
Buttons mask for currently pressed buttons in the DPad/hat.
Definition hid.h:203