1# hid_ddk_types.h 2<!--Kit: Driver Development Kit--> 3<!--Subsystem: Driver--> 4<!--Owner: @lixinsheng2--> 5<!--Designer: @w00373942--> 6<!--Tester: @dong-dongzhen--> 7<!--Adviser: @w_Machine_cc--> 8 9## Overview 10 11Defines the enum variables and structs used in the HID DDK. 12 13**File to include**: <hid/hid_ddk_types.h> 14 15**Library**: libhid.z.so 16 17**System capability**: SystemCapability.Driver.HID.Extension 18 19**Since**: 11 20 21**Related module**: [HidDdk](capi-hidddk.md) 22 23## Summary 24 25### Structs 26 27| Name | typedef Keyword| Description| 28|-----------------------------------------------------------| -- | -- | 29| [Hid_EmitItem](capi-hidddk-hid-emititem.md) | Hid_EmitItem | Defines event information.| 30| [Hid_Device](capi-hidddk-hid-device.md) | Hid_Device | Defines basic device information.| 31| [Hid_EventTypeArray](capi-hidddk-hid-eventtypearray.md) | Hid_EventTypeArray | Defines an array of event types.| 32| [Hid_KeyCodeArray](capi-hidddk-hid-keycodearray.md) | Hid_KeyCodeArray | Defines an array of key codes.| 33| [Hid_AbsAxesArray](capi-hidddk-hid-absaxesarray.md) | Hid_AbsAxesArray | Defines an array of absolute coordinates.| 34| [Hid_RelAxesArray](capi-hidddk-hid-relaxesarray.md) | Hid_RelAxesArray | Defines an array of relative coordinates.| 35| [Hid_MscEventArray](capi-hidddk-hid-msceventarray.md) | Hid_MscEventArray | Defines an array of miscellaneous events.| 36| [Hid_EventProperties](capi-hidddk-hid-eventproperties.md) | Hid_EventProperties | Defines the event properties of a device.| 37| [Hid_RawDevInfo](capi-hidddk-hid-rawdevinfo.md) | Hid_RawDevInfo | Defines the raw device information.| 38| [Hid_DeviceHandle](capi-hidddk-hid-devicehandle.md) | Hid_DeviceHandle | Defines the opaque USB HID device structure.| 39 40### Enums 41 42| Name| typedef Keyword| Description| 43| -- | -- | -- | 44| [Hid_DeviceProp](#hid_deviceprop) | Hid_DeviceProp | Enumerates the properties of input devices.| 45| [Hid_EventType](#hid_eventtype) | Hid_EventType | Enumerates the event types.| 46| [Hid_SynEvent](#hid_synevent) | Hid_SynEvent | Enumerates sync events.| 47| [Hid_KeyCode](#hid_keycode) | Hid_KeyCode | Enumerates the key codes.| 48| [Hid_AbsAxes](#hid_absaxes) | Hid_AbsAxes | Enumerates the absolute coordinates.| 49| [Hid_RelAxes](#hid_relaxes) | Hid_RelAxes | Enumerates the relative coordinates.| 50| [Hid_MscEvent](#hid_mscevent) | Hid_MscEvent | Enumerates miscellaneous input events.| 51| [Hid_DdkErrCode](#hid_ddkerrcode) | Hid_DdkErrCode | Enumerates the HID DDK error codes.| 52| [Hid_ReportType](#hid_reporttype) | Hid_ReportType | Defines the report (data packets exchanged between the HID device and the host) type.| 53 54### Macros 55 56| Name| Description| 57| -- | -- | 58| HID_MAX_REPORT_BUFFER_SIZE (16 * 1024 - 1) | Defines the maximum size of the report buffer.| 59 60## Enum Description 61 62### Hid_DeviceProp 63 64``` 65enum Hid_DeviceProp 66``` 67 68**Description** 69 70Enumerates the properties of input devices. 71 72**Since**: 11 73 74| Enum| Description| 75| -- | -- | 76| HID_PROP_POINTER = 0x00 | Pointer device.| 77| HID_PROP_DIRECT = 0x01 | Direct input device.| 78| HID_PROP_BUTTON_PAD = 0x02 | Touch device with bottom keys.| 79| HID_PROP_SEMI_MT = 0x03 | Full multi-touch device.| 80| HID_PROP_TOP_BUTTON_PAD = 0x04 | Touch device with top soft keys.| 81| HID_PROP_POINTING_STICK = 0x05 | Pointing stick.| 82| HID_PROP_ACCELEROMETER = 0x06 | Accelerometer.| 83 84### Hid_EventType 85 86``` 87enum Hid_EventType 88``` 89 90**Description** 91 92Enumerates the event types. 93 94**Since**: 11 95 96| Enum| Description| 97| -- | -- | 98| HID_EV_SYN = 0x00 | Sync event.| 99| HID_EV_KEY = 0x01 | Key event.| 100| HID_EV_REL = 0x02 | Relative coordinate event.| 101| HID_EV_ABS = 0x03 | Absolute coordinate event.| 102| HID_EV_MSC = 0x04 | Miscellaneous event.| 103 104### Hid_SynEvent 105 106``` 107enum Hid_SynEvent 108``` 109 110**Description** 111 112Enumerates sync events. 113 114**Since**: 11 115 116| Enum| Description| 117| -- | -- | 118| HID_SYN_REPORT = 0 | End of an event.| 119| HID_SYN_CONFIG = 1 | Configuration synchronization.| 120| HID_SYN_MT_REPORT = 2 | End of a multi-touch ABS data packet.| 121| HID_SYN_DROPPED = 3 | Event discarded.| 122 123### Hid_KeyCode 124 125``` 126enum Hid_KeyCode 127``` 128 129**Description** 130 131Enumerates the key codes. 132 133**Since**: 11 134 135| Enum| Description| 136| -- | -- | 137| HID_KEY_A = 30 | Key A| 138| HID_KEY_B = 48 | Key B| 139| HID_KEY_C = 46 | Key C| 140| HID_KEY_D = 32 | Key D| 141| HID_KEY_E = 18 | Key E| 142| HID_KEY_F = 33 | Key F| 143| HID_KEY_G = 34 | Key G| 144| HID_KEY_H = 35 | Key H| 145| HID_KEY_I = 23 | Key I| 146| HID_KEY_J = 36 | Key J| 147| HID_KEY_K = 37 | Key K| 148| HID_KEY_L = 38 | Key L| 149| HID_KEY_M = 50 | Key M| 150| HID_KEY_N = 49 | Key N| 151| HID_KEY_O = 24 | Key O| 152| HID_KEY_P = 25 | Key P| 153| HID_KEY_Q = 16 | Key Q| 154| HID_KEY_R = 19 | Key R| 155| HID_KEY_S = 31 | Key S| 156| HID_KEY_T = 20 | Key T| 157| HID_KEY_U = 22 | Key U| 158| HID_KEY_V = 47 | Key V| 159| HID_KEY_W = 17 | Key W| 160| HID_KEY_X = 45 | Key X| 161| HID_KEY_Y = 21 | Key Y| 162| HID_KEY_Z = 44 | Key Z| 163| HID_KEY_ESC = 1 | Key Esc| 164| HID_KEY_0 = 11 | Key 0| 165| HID_KEY_1 = 2 | Key 1| 166| HID_KEY_2 = 3 | Key 2| 167| HID_KEY_3 = 4 | Key 3| 168| HID_KEY_4 = 5 | Key 4| 169| HID_KEY_5 = 6 | Key 5| 170| HID_KEY_6 = 7 | Key 6| 171| HID_KEY_7 = 8 | Key 7| 172| HID_KEY_8 = 9 | Key 8| 173| HID_KEY_9 = 10 | Key 9| 174| HID_KEY_GRAVE = 41 | Key grave (`)| 175| HID_KEY_MINUS = 12 | Key -| 176| HID_KEY_EQUALS = 13 | Key =| 177| HID_KEY_BACKSPACE = 14 | Key Backspace| 178| HID_KEY_LEFT_BRACKET = 26 | Key [| 179| HID_KEY_RIGHT_BRACKET = 27 | Key ]| 180| HID_KEY_ENTER = 28 | Key Enter| 181| HID_KEY_LEFT_SHIFT = 42 | Left Shift| 182| HID_KEY_BACKSLASH = 43 | Key \| 183| HID_KEY_SEMICOLON = 39 | Key ;| 184| HID_KEY_APOSTROPHE = 40 | Key '| 185| HID_KEY_SPACE = 57 | Key Space| 186| HID_KEY_SLASH = 53 | Key /| 187| HID_KEY_COMMA = 51 | Key comma (,)| 188| HID_KEY_PERIOD = 52 | Key period (.)| 189| HID_KEY_RIGHT_SHIFT = 54 | Right Shift| 190| HID_KEY_NUMPAD_0 = 82 | Numeral 0 on the numeric keypad| 191| HID_KEY_NUMPAD_1 = 79 | Numeral 1 on the numeric keypad| 192| HID_KEY_NUMPAD_2 = 80 | Numeral 2 on the numeric keypad| 193| HID_KEY_NUMPAD_3 = 81 | Numeral 3 on the numeric keypad| 194| HID_KEY_NUMPAD_4 = 75 | Numeral 4 on the numeric keypad| 195| HID_KEY_NUMPAD_5 = 76 | Numeral 5 on the numeric keypad| 196| HID_KEY_NUMPAD_6 = 77 | Numeral 6 on the numeric keypad| 197| HID_KEY_NUMPAD_7 = 71 | Numeral 7 on the numeric keypad| 198| HID_KEY_NUMPAD_8 = 72 | Numeral 8 on the numeric keypad| 199| HID_KEY_NUMPAD_9 = 73 | Numeral 9 on the numeric keypad| 200| HID_KEY_NUMPAD_DIVIDE = 70 | Slash key (/) on the numeric keypad| 201| HID_KEY_NUMPAD_MULTIPLY = 55 | Asterisk key (*) on the numeric keypad| 202| HID_KEY_NUMPAD_SUBTRACT = 74 | Minus key (-) on the numeric keypad| 203| HID_KEY_NUMPAD_ADD = 78 | Plus key (+) on the numeric keypad| 204| HID_KEY_NUMPAD_DOT = 83 | Decimal point (.) on the numeric keypad| 205| HID_KEY_SYSRQ = 99 | SYSRQ key| 206| HID_KEY_DELETE = 111 | Delete key| 207| HID_KEY_MUTE = 113 | Mute key| 208| HID_KEY_VOLUME_DOWN = 114 | Volume Down key| 209| HID_KEY_VOLUME_UP = 115 | Volume Up key| 210| HID_KEY_BRIGHTNESS_DOWN = 224 | Brightness Down key| 211| HID_KEY_BRIGHTNESS_UP = 225 | Brightness Up key| 212| HID_BTN_0 = 0x100 | Button 0| 213| HID_BTN_1 = 0x101 | Button 1| 214| HID_BTN_2 = 0x102 | Button 2| 215| HID_BTN_3 = 0x103 | Button 3| 216| HID_BTN_4 = 0x104 | Button 4| 217| HID_BTN_5 = 0x105 | Button 5| 218| HID_BTN_6 = 0x106 | Button 6| 219| HID_BTN_7 = 0x107 | Button 7| 220| HID_BTN_8 = 0x108 | Button 8| 221| HID_BTN_9 = 0x109 | Button 9| 222| HID_BTN_LEFT = 0x110 | Left mouse button| 223| HID_BTN_RIGHT = 0x111 | Right mouse button| 224| HID_BTN_MIDDLE = 0x112 | Middle mouse button| 225| HID_BTN_SIDE = 0x113 | Side mouse button| 226| HID_BTN_EXTRA = 0x114 | Extra mouse button| 227| HID_BTN_FORWARD = 0x115 | Mouse forward button| 228| HID_BTN_BACKWARD = 0x116 | Mouse backward button| 229| HID_BTN_TASK = 0x117 | Mouse task button| 230| HID_BTN_TOOL_PEN = 0x140 | Pen| 231| HID_BTN_TOOL_RUBBER = 0x141 | Eraser| 232| HID_BTN_TOOL_BRUSH = 0x142 | Brush| 233| HID_BTN_TOOL_PENCIL = 0x143 | Pencil| 234| HID_BTN_TOOL_AIRBRUSH = 0x144 | Air brush| 235| HID_BTN_TOOL_FINGER = 0x145 | Finger| 236| HID_BTN_TOOL_MOUSE = 0x146 | Mouse| 237| HID_BTN_TOOL_LENS = 0x147 | Lens| 238| HID_BTN_TOOL_QUINT_TAP = 0x148 | Five-finger touch| 239| HID_BTN_STYLUS3 = 0x149 | Stylus 3| 240| HID_BTN_TOUCH = 0x14a | Touch| 241| HID_BTN_STYLUS = 0x14b | Stylus| 242| HID_BTN_STYLUS2 = 0x14c | Stylus 2| 243| HID_BTN_TOOL_DOUBLE_TAP = 0x14d | Two-finger touch| 244| HID_BTN_TOOL_TRIPLE_TAP = 0x14e | Three-finger touch| 245| HID_BTN_TOOL_QUAD_TAP = 0x14f | Four-finger touch| 246| HID_BTN_WHEEL = 0x150 | Scroll wheel| 247 248### Hid_AbsAxes 249 250``` 251enum Hid_AbsAxes 252``` 253 254**Description** 255 256Enumerates the absolute coordinates. 257 258**Since**: 11 259 260| Enum| Description| 261| -- | -- | 262| HID_ABS_X = 0x00 | X axis| 263| HID_ABS_Y = 0x01 | Y axis| 264| HID_ABS_Z = 0x02 | Z axis| 265| HID_ABS_RX = 0x03 | X axis of the right analog stick| 266| HID_ABS_RY = 0x04 | Y axis of the right analog stick| 267| HID_ABS_RZ = 0x05 | Z axis of the right analog stick| 268| HID_ABS_THROTTLE = 0x06 | Throttle| 269| HID_ABS_RUDDER = 0x07 | Rudder| 270| HID_ABS_WHEEL = 0x08 | Scroll wheel| 271| HID_ABS_GAS = 0x09 | Gas| 272| HID_ABS_BRAKE = 0x0a | Brake| 273| HID_ABS_HAT0X = 0x10 | HAT0X | 274| HID_ABS_HAT0Y = 0x11 | HAT0Y | 275| HID_ABS_HAT1X = 0x12 | HAT1X | 276| HID_ABS_HAT1Y = 0x13 | HAT1Y | 277| HID_ABS_HAT2X = 0x14 | HAT2X | 278| HID_ABS_HAT2Y = 0x15 | HAT2Y | 279| HID_ABS_HAT3X = 0x16 | HAT3X | 280| HID_ABS_HAT3Y = 0x17 | HAT3Y | 281| HID_ABS_PRESSURE = 0x18 | Pressure| 282| HID_ABS_DISTANCE = 0x19 | Distance| 283| HID_ABS_TILT_X = 0x1a | Tilt of X axis| 284| HID_ABS_TILT_Y = 0x1b | Tilt of Y axis| 285| HID_ABS_TOOL_WIDTH = 0x1c | Width of the touch tool| 286| HID_ABS_VOLUME = 0x20 | Volume| 287| HID_ABS_MISC = 0x28 | Others| 288 289### Hid_RelAxes 290 291``` 292enum Hid_RelAxes 293``` 294 295**Description** 296 297Enumerates the relative coordinates. 298 299**Since**: 11 300 301| Enum| Description| 302| -- | -- | 303| HID_REL_X = 0x00 | X axis| 304| HID_REL_Y = 0x01 | Y axis| 305| HID_REL_Z = 0x02 | Z axis| 306| HID_REL_RX = 0x03 | X axis of the right analog stick| 307| HID_REL_RY = 0x04 | Y axis of the right analog stick| 308| HID_REL_RZ = 0x05 | Z axis of the right analog stick| 309| HID_REL_HWHEEL = 0x06 | Horizontal scroll wheel| 310| HID_REL_DIAL = 0x07 | Scale| 311| HID_REL_WHEEL = 0x08 | Scroll wheel| 312| HID_REL_MISC = 0x09 | Others| 313| HID_REL_RESERVED = 0x0a | Reserved| 314| HID_REL_WHEEL_HI_RES = 0x0b | High-resolution scroll wheel| 315| HID_REL_HWHEEL_HI_RES = 0x0c | High-resolution horizontal scroll wheel| 316 317### Hid_MscEvent 318 319``` 320enum Hid_MscEvent 321``` 322 323**Description** 324 325Enumerates miscellaneous input events. 326 327**Since**: 11 328 329| Enum| Description| 330| -- | -- | 331| HID_MSC_SERIAL = 0x00 | Serial number| 332| HID_MSC_PULSE_LED = 0x01 | Pulse| 333| HID_MSC_GESTURE = 0x02 | Gesture| 334| HID_MSC_RAW = 0x03 | Start event| 335| HID_MSC_SCAN = 0x04 | Scan| 336| HID_MSC_TIMESTAMP = 0x05 | Timestamp| 337 338### Hid_DdkErrCode 339 340``` 341enum Hid_DdkErrCode 342``` 343 344**Description** 345 346Enumerates the HID DDK error codes. 347 348**Since**: 11 349 350| Enum| Description| 351| -- | -- | 352| HID_DDK_SUCCESS = 0 | Operation success.| 353| HID_DDK_NO_PERM = 201 | No permission. The value is changed from **-6** to **201** since API version 16.| 354| HID_DDK_INVALID_PARAMETER = 401 | Invalid parameter. The value is changed from **-2** to **401** since API version 16.| 355| HID_DDK_FAILURE = 27300001 | Operation failed. The value is changed from **-1** to **27300001** since API version 16.| 356| HID_DDK_NULL_PTR = 27300002 | Null pointer. The value is changed from **-4** to **27300002** since API version 16.| 357| HID_DDK_INVALID_OPERATION = 27300003 | Invalid operation. The value is changed from **-3** to **27300003** since API version 16.| 358| HID_DDK_TIMEOUT = 27300004 | Timeout. The value is changed from **-5** to **27300004** since API version 16.| 359| HID_DDK_INIT_ERROR = 27300005 | DDK initialization error. This enum is supported since API version 16.| 360| HID_DDK_SERVICE_ERROR = 27300006 | Service communication error. This enum is supported since API version 16.| 361| HID_DDK_MEMORY_ERROR = 27300007 | Memory-related errors, such as memory data copy failure and memory allocation failure. This enum is supported since API version 16.| 362| HID_DDK_IO_ERROR = 27300008 | I/O operation failure. This enum is supported since API version 16.| 363| HID_DDK_DEVICE_NOT_FOUND = 27300009 | Device not found. This enum is supported since API version 16.| 364 365### Hid_ReportType 366 367``` 368enum Hid_ReportType 369``` 370 371**Description** 372 373Defines the report (data packets exchanged between the HID device and the host) type. 374 375**Since**: 18 376 377| Enum| Description| 378| -- | -- | 379| HID_INPUT_REPORT = 0 | Input report.| 380| HID_OUTPUT_REPORT = 1 | Output report.| 381| HID_FEATURE_REPORT = 2 | Feature report.| 382 383 384### HID_MAX_REPORT_BUFFER_SIZE 385 386``` 387HID_MAX_REPORT_BUFFER_SIZE (16 * 1024 - 1) 388``` 389 390**Description** 391 392Defines the maximum size of the report buffer. 393 394**Since**: 18 395