Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Mouse and keyboard report descriptors

Macros

#define HID_MOUSE_REPORT_DESC(bcnt)
 Simple HID mouse report descriptor for n button mouse.
 
#define HID_KEYBOARD_REPORT_DESC()
 Simple HID keyboard report descriptor.
 

Enumerations

enum  hid_kbd_code {
  HID_KEY_A = 4 , HID_KEY_B = 5 , HID_KEY_C = 6 , HID_KEY_D = 7 ,
  HID_KEY_E = 8 , HID_KEY_F = 9 , HID_KEY_G = 10 , HID_KEY_H = 11 ,
  HID_KEY_I = 12 , HID_KEY_J = 13 , HID_KEY_K = 14 , HID_KEY_L = 15 ,
  HID_KEY_M = 16 , HID_KEY_N = 17 , HID_KEY_O = 18 , HID_KEY_P = 19 ,
  HID_KEY_Q = 20 , HID_KEY_R = 21 , HID_KEY_S = 22 , HID_KEY_T = 23 ,
  HID_KEY_U = 24 , HID_KEY_V = 25 , HID_KEY_W = 26 , HID_KEY_X = 27 ,
  HID_KEY_Y = 28 , HID_KEY_Z = 29 , HID_KEY_1 = 30 , HID_KEY_2 = 31 ,
  HID_KEY_3 = 32 , HID_KEY_4 = 33 , HID_KEY_5 = 34 , HID_KEY_6 = 35 ,
  HID_KEY_7 = 36 , HID_KEY_8 = 37 , HID_KEY_9 = 38 , HID_KEY_0 = 39 ,
  HID_KEY_ENTER = 40 , HID_KEY_ESC = 41 , HID_KEY_BACKSPACE = 42 , HID_KEY_TAB = 43 ,
  HID_KEY_SPACE = 44 , HID_KEY_MINUS = 45 , HID_KEY_EQUAL = 46 , HID_KEY_LEFTBRACE = 47 ,
  HID_KEY_RIGHTBRACE = 48 , HID_KEY_BACKSLASH = 49 , HID_KEY_HASH = 50 , HID_KEY_SEMICOLON = 51 ,
  HID_KEY_APOSTROPHE = 52 , HID_KEY_GRAVE = 53 , HID_KEY_COMMA = 54 , HID_KEY_DOT = 55 ,
  HID_KEY_SLASH = 56 , HID_KEY_CAPSLOCK = 57 , HID_KEY_F1 = 58 , HID_KEY_F2 = 59 ,
  HID_KEY_F3 = 60 , HID_KEY_F4 = 61 , HID_KEY_F5 = 62 , HID_KEY_F6 = 63 ,
  HID_KEY_F7 = 64 , HID_KEY_F8 = 65 , HID_KEY_F9 = 66 , HID_KEY_F10 = 67 ,
  HID_KEY_F11 = 68 , HID_KEY_F12 = 69 , HID_KEY_SYSRQ = 70 , HID_KEY_SCROLLLOCK = 71 ,
  HID_KEY_PAUSE = 72 , HID_KEY_INSERT = 73 , HID_KEY_HOME = 74 , HID_KEY_PAGEUP = 75 ,
  HID_KEY_DELETE = 76 , HID_KEY_END = 77 , HID_KEY_PAGEDOWN = 78 , HID_KEY_RIGHT = 79 ,
  HID_KEY_LEFT = 80 , HID_KEY_DOWN = 81 , HID_KEY_UP = 82 , HID_KEY_NUMLOCK = 83 ,
  HID_KEY_KPSLASH = 84 , HID_KEY_KPASTERISK = 85 , HID_KEY_KPMINUS = 86 , HID_KEY_KPPLUS = 87 ,
  HID_KEY_KPENTER = 88 , HID_KEY_KP_1 = 89 , HID_KEY_KP_2 = 90 , HID_KEY_KP_3 = 91 ,
  HID_KEY_KP_4 = 92 , HID_KEY_KP_5 = 93 , HID_KEY_KP_6 = 94 , HID_KEY_KP_7 = 95 ,
  HID_KEY_KP_8 = 96 , HID_KEY_KP_9 = 97 , HID_KEY_KP_0 = 98
}
 HID keyboard button codes. More...
 
enum  hid_kbd_modifier {
  HID_KBD_MODIFIER_NONE = 0x00 , HID_KBD_MODIFIER_LEFT_CTRL = 0x01 , HID_KBD_MODIFIER_LEFT_SHIFT = 0x02 , HID_KBD_MODIFIER_LEFT_ALT = 0x04 ,
  HID_KBD_MODIFIER_LEFT_UI = 0x08 , HID_KBD_MODIFIER_RIGHT_CTRL = 0x10 , HID_KBD_MODIFIER_RIGHT_SHIFT = 0x20 , HID_KBD_MODIFIER_RIGHT_ALT = 0x40 ,
  HID_KBD_MODIFIER_RIGHT_UI = 0x80
}
 HID keyboard modifiers. More...
 
enum  hid_kbd_led {
  HID_KBD_LED_NUM_LOCK = 0x01 , HID_KBD_LED_CAPS_LOCK = 0x02 , HID_KBD_LED_SCROLL_LOCK = 0x04 , HID_KBD_LED_COMPOSE = 0x08 ,
  HID_KBD_LED_KANA = 0x10
}
 HID keyboard LEDs. More...
 

Detailed Description

Macro Definition Documentation

◆ HID_KEYBOARD_REPORT_DESC

#define HID_KEYBOARD_REPORT_DESC ( )

#include <zephyr/usb/class/hid.h>

Value:
{ \
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP), \
HID_COLLECTION(HID_COLLECTION_APPLICATION), \
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP_KEYPAD), \
/* HID_USAGE_MINIMUM(Keyboard LeftControl) */ \
HID_USAGE_MIN8(0xE0), \
/* HID_USAGE_MAXIMUM(Keyboard Right GUI) */ \
HID_USAGE_MAX8(0xE7), \
HID_LOGICAL_MIN8(0), \
HID_LOGICAL_MAX8(1), \
HID_REPORT_SIZE(1), \
HID_REPORT_COUNT(8), \
/* HID_INPUT(Data,Var,Abs) */ \
HID_INPUT(0x02), \
HID_REPORT_SIZE(8), \
HID_REPORT_COUNT(1), \
/* HID_INPUT(Cnst,Var,Abs) */ \
HID_INPUT(0x03), \
HID_REPORT_SIZE(1), \
HID_REPORT_COUNT(5), \
HID_USAGE_PAGE(HID_USAGE_GEN_LEDS), \
/* HID_USAGE_MINIMUM(Num Lock) */ \
HID_USAGE_MIN8(1), \
/* HID_USAGE_MAXIMUM(Kana) */ \
HID_USAGE_MAX8(5), \
/* HID_OUTPUT(Data,Var,Abs) */ \
HID_OUTPUT(0x02), \
HID_REPORT_SIZE(3), \
HID_REPORT_COUNT(1), \
/* HID_OUTPUT(Cnst,Var,Abs) */ \
HID_OUTPUT(0x03), \
HID_REPORT_SIZE(8), \
HID_REPORT_COUNT(6), \
HID_LOGICAL_MIN8(0), \
HID_LOGICAL_MAX8(101), \
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP_KEYPAD), \
/* HID_USAGE_MIN8(Reserved) */ \
HID_USAGE_MIN8(0), \
/* HID_USAGE_MAX8(Keyboard Application) */ \
HID_USAGE_MAX8(101), \
/* HID_INPUT (Data,Ary,Abs) */ \
HID_INPUT(0x00), \
}
#define HID_USAGE_GEN_DESKTOP_KEYBOARD
HID Generic Desktop Keyboard Usage ID.
Definition hid.h:156
#define HID_COLLECTION_APPLICATION
Application collection type.
Definition hid.h:121
#define HID_USAGE_GEN_DESKTOP_KEYPAD
HID Generic Desktop Keypad Usage ID.
Definition hid.h:158
#define HID_USAGE_GEN_DESKTOP
HID Generic Desktop Controls Usage page.
Definition hid.h:137
#define HID_USAGE_GEN_LEDS
HID LEDs Usage page.
Definition hid.h:141
#define HID_END_COLLECTION
Define HID End Collection (non-data) item.
Definition hid.h:238

Simple HID keyboard report descriptor.

◆ HID_MOUSE_REPORT_DESC

#define HID_MOUSE_REPORT_DESC ( bcnt)

#include <zephyr/usb/class/hid.h>

Value:
{ \
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP), \
HID_COLLECTION(HID_COLLECTION_APPLICATION), \
HID_COLLECTION(HID_COLLECTION_PHYSICAL), \
/* Bits used for button signalling */ \
HID_USAGE_PAGE(HID_USAGE_GEN_BUTTON), \
HID_USAGE_MIN8(1), \
HID_USAGE_MAX8(bcnt), \
HID_LOGICAL_MIN8(0), \
HID_LOGICAL_MAX8(1), \
HID_REPORT_SIZE(1), \
HID_REPORT_COUNT(bcnt), \
/* HID_INPUT (Data,Var,Abs) */ \
HID_INPUT(0x02), \
/* Unused bits */ \
HID_REPORT_SIZE(8 - bcnt), \
HID_REPORT_COUNT(1), \
/* HID_INPUT (Cnst,Ary,Abs) */ \
HID_INPUT(1), \
/* X and Y axis, scroll */ \
HID_USAGE_PAGE(HID_USAGE_GEN_DESKTOP), \
HID_LOGICAL_MIN8(-127), \
HID_LOGICAL_MAX8(127), \
HID_REPORT_SIZE(8), \
HID_REPORT_COUNT(3), \
/* HID_INPUT (Data,Var,Rel) */ \
HID_INPUT(0x06), \
}
#define HID_USAGE_GEN_BUTTON
HID Button Usage page.
Definition hid.h:143
#define HID_USAGE_GEN_DESKTOP_POINTER
HID Generic Desktop Pointer Usage ID.
Definition hid.h:148
#define HID_USAGE_GEN_DESKTOP_MOUSE
HID Generic Desktop Mouse Usage ID.
Definition hid.h:150
#define HID_USAGE_GEN_DESKTOP_WHEEL
HID Generic Desktop Wheel Usage ID.
Definition hid.h:164
#define HID_COLLECTION_PHYSICAL
Physical collection type.
Definition hid.h:119
#define HID_USAGE_GEN_DESKTOP_Y
HID Generic Desktop Y Usage ID.
Definition hid.h:162
#define HID_USAGE_GEN_DESKTOP_X
HID Generic Desktop X Usage ID.
Definition hid.h:160

Simple HID mouse report descriptor for n button mouse.

Parameters
bcntButton count. Allowed values from 1 to 8.

Enumeration Type Documentation

◆ hid_kbd_code

#include <zephyr/usb/class/hid.h>

HID keyboard button codes.

Enumerator
HID_KEY_A 
HID_KEY_B 
HID_KEY_C 
HID_KEY_D 
HID_KEY_E 
HID_KEY_F 
HID_KEY_G 
HID_KEY_H 
HID_KEY_I 
HID_KEY_J 
HID_KEY_K 
HID_KEY_L 
HID_KEY_M 
HID_KEY_N 
HID_KEY_O 
HID_KEY_P 
HID_KEY_Q 
HID_KEY_R 
HID_KEY_S 
HID_KEY_T 
HID_KEY_U 
HID_KEY_V 
HID_KEY_W 
HID_KEY_X 
HID_KEY_Y 
HID_KEY_Z 
HID_KEY_1 
HID_KEY_2 
HID_KEY_3 
HID_KEY_4 
HID_KEY_5 
HID_KEY_6 
HID_KEY_7 
HID_KEY_8 
HID_KEY_9 
HID_KEY_0 
HID_KEY_ENTER 
HID_KEY_ESC 
HID_KEY_BACKSPACE 
HID_KEY_TAB 
HID_KEY_SPACE 
HID_KEY_MINUS 
HID_KEY_EQUAL 
HID_KEY_LEFTBRACE 
HID_KEY_RIGHTBRACE 
HID_KEY_BACKSLASH 
HID_KEY_HASH 
HID_KEY_SEMICOLON 
HID_KEY_APOSTROPHE 
HID_KEY_GRAVE 
HID_KEY_COMMA 
HID_KEY_DOT 
HID_KEY_SLASH 
HID_KEY_CAPSLOCK 
HID_KEY_F1 
HID_KEY_F2 
HID_KEY_F3 
HID_KEY_F4 
HID_KEY_F5 
HID_KEY_F6 
HID_KEY_F7 
HID_KEY_F8 
HID_KEY_F9 
HID_KEY_F10 
HID_KEY_F11 
HID_KEY_F12 
HID_KEY_SYSRQ 
HID_KEY_SCROLLLOCK 
HID_KEY_PAUSE 
HID_KEY_INSERT 
HID_KEY_HOME 
HID_KEY_PAGEUP 
HID_KEY_DELETE 
HID_KEY_END 
HID_KEY_PAGEDOWN 
HID_KEY_RIGHT 
HID_KEY_LEFT 
HID_KEY_DOWN 
HID_KEY_UP 
HID_KEY_NUMLOCK 
HID_KEY_KPSLASH 
HID_KEY_KPASTERISK 
HID_KEY_KPMINUS 
HID_KEY_KPPLUS 
HID_KEY_KPENTER 
HID_KEY_KP_1 
HID_KEY_KP_2 
HID_KEY_KP_3 
HID_KEY_KP_4 
HID_KEY_KP_5 
HID_KEY_KP_6 
HID_KEY_KP_7 
HID_KEY_KP_8 
HID_KEY_KP_9 
HID_KEY_KP_0 

◆ hid_kbd_led

#include <zephyr/usb/class/hid.h>

HID keyboard LEDs.

Enumerator
HID_KBD_LED_NUM_LOCK 
HID_KBD_LED_CAPS_LOCK 
HID_KBD_LED_SCROLL_LOCK 
HID_KBD_LED_COMPOSE 
HID_KBD_LED_KANA 

◆ hid_kbd_modifier

#include <zephyr/usb/class/hid.h>

HID keyboard modifiers.

Enumerator
HID_KBD_MODIFIER_NONE 
HID_KBD_MODIFIER_LEFT_CTRL 
HID_KBD_MODIFIER_LEFT_SHIFT 
HID_KBD_MODIFIER_LEFT_ALT 
HID_KBD_MODIFIER_LEFT_UI 
HID_KBD_MODIFIER_RIGHT_CTRL 
HID_KBD_MODIFIER_RIGHT_SHIFT 
HID_KBD_MODIFIER_RIGHT_ALT 
HID_KBD_MODIFIER_RIGHT_UI