1# HID DDK 2 3 4## Overview 5 6Provides HID driver development kit (DDK) functions, including those for creating a device, sending events to a device, and destroying a device. 7 8**System capability**: SystemCapability.Driver.HID.Extension 9 10**Since** 11 1211 13 14## Summary 15 16 17### Files 18 19| Name| Description| 20| -------- | -------- | 21| [hid_ddk_api.h](hid__ddk__api_8h.md) | Declares the HID DDK functions for accessing an input device from the host.<br>File to include: <hid/hid_ddk_api.h><br>Library: libhid.z.so| 22| [hid_ddk_types.h](hid__ddk__types_8h.md) | Defines the enum variables and structs used in the HID DDK.<br>File to include: <hid/hid_ddk_types.h><br>Library: libhid.z.so | 23 24 25### Structs 26 27| Name| Description| 28| -------- | -------- | 29| [Hid_EmitItem](_hid___emit_item.md) | Defines event information. | 30| [Hid_Device](_hid___device.md) | Defines basic device information. | 31| [Hid_EventTypeArray](_hid___event_type_array.md) | Defines an array of event types. | 32| [Hid_KeyCodeArray](_hid___key_code_array.md) | Defines an array of key codes. | 33| [Hid_AbsAxesArray](_hid___abs_axes_array.md) | Defines an array of absolute coordinates. | 34| [Hid_RelAxesArray](_hid___rel_axes_array.md) | Defines an array of relative coordinates. | 35| [Hid_MscEventArray](_hid___msc_event_array.md) | Defines an array of miscellaneous events. | 36| [Hid_EventProperties](_hid___event_properties.md) | Defines the event properties of a device. | 37 38 39### Types 40 41| Name| Description| 42| -------- | -------- | 43| [Hid_EmitItem](#hid_emititem) | Defines a struct for event information. | 44| [Hid_Device](#hid_device) | Defines a struct for basic device information. | 45| [Hid_EventTypeArray](#hid_eventtypearray) | Defines a struct for an array of event types. | 46| [Hid_KeyCodeArray](#hid_keycodearray) | Defines a struct for an array of key codes. | 47| [Hid_AbsAxesArray](#hid_absaxesarray) | Defines a struct for an array of absolute coordinates. | 48| [Hid_RelAxesArray](#hid_relaxesarray) | Defines a struct for an array of relative coordinates. | 49| [Hid_MscEventArray](#hid_msceventarray) | Defines a struct for an array of miscellaneous events. | 50| [Hid_EventProperties](#hid_eventproperties) | Defines a struct for the event properties of a device. | 51 52 53### Enums 54 55| Name| Description| 56| -------- | -------- | 57| [Hid_DeviceProp](#hid_deviceprop) {<br>HID_PROP_POINTER = 0x00, HID_PROP_DIRECT = 0x01, HID_PROP_BUTTON_PAD = 0x02, HID_PROP_SEMI_MT = 0x03,<br>HID_PROP_TOP_BUTTON_PAD = 0x04, HID_PROP_POINTING_STICK = 0x05, HID_PROP_ACCELEROMETER = 0x06<br>} | Enumerates the properties of input devices. | 58| [Hid_EventType](#hid_eventtype) {<br>HID_EV_SYN = 0x00, HID_EV_KEY = 0x01, HID_EV_REL = 0x02, HID_EV_ABS = 0x03,<br>HID_EV_MSC = 0x04<br>} | Enumerates the event types. | 59| [Hid_SynEvent](#hid_synevent) { HID_SYN_REPORT = 0, HID_SYN_CONFIG = 1, HID_SYN_MT_REPORT = 2, HID_SYN_DROPPED = 3 } | Enumerates sync events. | 60| [Hid_KeyCode](#hid_keycode) {<br>HID_KEY_A = 30, HID_KEY_B = 48, HID_KEY_C = 46, HID_KEY_D = 32,<br>HID_KEY_E = 18, HID_KEY_F = 33, HID_KEY_G = 34, HID_KEY_H = 35,<br>HID_KEY_I = 23, HID_KEY_J = 36, HID_KEY_K = 37, HID_KEY_L = 38,<br>HID_KEY_M = 50, HID_KEY_N = 49, HID_KEY_O = 24, HID_KEY_P = 25,<br>HID_KEY_Q = 16, HID_KEY_R = 19, HID_KEY_S = 31, HID_KEY_T = 20,<br>HID_KEY_U = 22, HID_KEY_V = 47, HID_KEY_W = 17, HID_KEY_X = 45,<br>HID_KEY_Y = 21, HID_KEY_Z = 44, HID_KEY_ESC = 1, HID_KEY_0 = 11,<br>HID_KEY_1 = 2, HID_KEY_2 = 3, HID_KEY_3 = 4, HID_KEY_4 = 5,<br>HID_KEY_5 = 6, HID_KEY_6 = 7, HID_KEY_7 = 8, HID_KEY_8 = 9,<br>HID_KEY_9 = 10, HID_KEY_GRAVE = 41, HID_KEY_MINUS = 12, HID_KEY_EQUALS = 13,<br>HID_KEY_BACKSPACE = 14, HID_KEY_LEFT_BRACKET = 26, HID_KEY_RIGHT_BRACKET = 27, HID_KEY_ENTER = 28,<br>HID_KEY_LEFT_SHIFT = 42, HID_KEY_BACKSLASH = 43, HID_KEY_SEMICOLON = 39, HID_KEY_APOSTROPHE = 40,<br>HID_KEY_SPACE = 57, HID_KEY_SLASH = 53, HID_KEY_COMMA = 51, HID_KEY_PERIOD = 52,<br>HID_KEY_RIGHT_SHIFT = 54, HID_KEY_NUMPAD_0 = 82, HID_KEY_NUMPAD_1 = 79, HID_KEY_NUMPAD_2 = 80,<br>HID_KEY_NUMPAD_3 = 81, HID_KEY_NUMPAD_4 = 75, HID_KEY_NUMPAD_5 = 76, HID_KEY_NUMPAD_6 = 77,<br>HID_KEY_NUMPAD_7 = 71, HID_KEY_NUMPAD_8 = 72, HID_KEY_NUMPAD_9 = 73, HID_KEY_NUMPAD_DIVIDE = 70,<br>HID_KEY_NUMPAD_MULTIPLY = 55, HID_KEY_NUMPAD_SUBTRACT = 74, HID_KEY_NUMPAD_ADD = 78, HID_KEY_NUMPAD_DOT = 83,<br>HID_KEY_SYSRQ = 99, HID_KEY_MUTE = 113, HID_KEY_VOLUME_DOWN = 114, HID_KEY_VOLUME_UP = 115,<br>HID_KEY_BRIGHTNESS_DOWN = 224, HID_KEY_BRIGHTNESS_UP = 225, HID_BTN_0 = 0x100, HID_BTN_1 = 0x101,<br>HID_BTN_2 = 0x102, HID_BTN_3 = 0x103, HID_BTN_4 = 0x104, HID_BTN_5 = 0x105,<br>HID_BTN_6 = 0x106, HID_BTN_7 = 0x107, HID_BTN_8 = 0x108, HID_BTN_9 = 0x109,<br>HID_BTN_LEFT = 0x110, HID_BTN_RIGHT = 0x111, HID_BTN_MIDDLE = 0x112, HID_BTN_SIDE = 0x113,<br>HID_BTN_EXTRA = 0x114, HID_BTN_FORWARD = 0x115, HID_BTN_BACKWARD = 0x116, HID_BTN_TASK = 0x117,<br>HID_BTN_TOOL_PEN = 0x140, HID_BTN_TOOL_RUBBER = 0x141, HID_BTN_TOOL_BRUSH = 0x142, HID_BTN_TOOL_PENCIL = 0x143,<br>HID_BTN_TOOL_AIRBRUSH = 0x144, HID_BTN_TOOL_FINGER = 0x145, HID_BTN_TOOL_MOUSE = 0x146, HID_BTN_TOOL_LENS = 0x147,<br>HID_BTN_TOOL_QUINT_TAP = 0x148, HID_BTN_STYLUS3 = 0x149, HID_BTN_TOUCH = 0x14a, HID_BTN_STYLUS = 0x14b,<br>HID_BTN_STYLUS2 = 0x14c, HID_BTN_TOOL_DOUBLE_TAP = 0x14d, HID_BTN_TOOL_TRIPLE_TAP = 0x14e, HID_BTN_TOOL_QUAD_TAP = 0x14f,<br>HID_BTN_WHEEL = 0x150<br>} | Enumerates the key codes. | 61| [Hid_AbsAxes](#hid_absaxes) {<br>HID_ABS_X = 0x00, HID_ABS_Y = 0x01, HID_ABS_Z = 0x02, HID_ABS_RX = 0x03,<br>HID_ABS_RY = 0x04, HID_ABS_RZ = 0x05, HID_ABS_THROTTLE = 0x06, HID_ABS_RUDDER = 0x07,<br>HID_ABS_WHEEL = 0x08, HID_ABS_GAS = 0x09, HID_ABS_BRAKE = 0x0a, HID_ABS_HAT0X = 0x10,<br>HID_ABS_HAT0Y = 0x11, HID_ABS_HAT1X = 0x12, HID_ABS_HAT1Y = 0x13, HID_ABS_HAT2X = 0x14,<br>HID_ABS_HAT2Y = 0x15, HID_ABS_HAT3X = 0x16, HID_ABS_HAT3Y = 0x17, HID_ABS_PRESSURE = 0x18,<br>HID_ABS_DISTANCE = 0x19, HID_ABS_TILT_X = 0x1a, HID_ABS_TILT_Y = 0x1b, HID_ABS_TOOL_WIDTH = 0x1c,<br>HID_ABS_VOLUME = 0x20, HID_ABS_MISC = 0x28<br>} | Enumerates the absolute coordinates. | 62| [Hid_RelAxes](#hid_relaxes) {<br>HID_REL_X = 0x00, HID_REL_Y = 0x01, HID_REL_Z = 0x02, HID_REL_RX = 0x03,<br>HID_REL_RY = 0x04, HID_REL_RZ = 0x05, HID_REL_HWHEEL = 0x06, HID_REL_DIAL = 0x07,<br>HID_REL_WHEEL = 0x08, HID_REL_MISC = 0x09, HID_REL_RESERVED = 0x0a, HID_REL_WHEEL_HI_RES = 0x0b,<br>HID_REL_HWHEEL_HI_RES = 0x0c<br>} | Enumerates the relative coordinates. | 63| [Hid_MscEvent](#hid_mscevent) {<br>HID_MSC_SERIAL = 0x00, HID_MSC_PULSE_LED = 0x01, HID_MSC_GESTURE = 0x02, HID_MSC_RAW = 0x03,<br>HID_MSC_SCAN = 0x04, HID_MSC_TIMESTAMP = 0x05<br>} | Enumerates miscellaneous input events. | 64| [Hid_DdkErrCode](#hid_ddkerrcode) {<br>HID_DDK_SUCCESS = 0, HID_DDK_FAILURE = -1, HID_DDK_INVALID_PARAMETER = -2, HID_DDK_INVALID_OPERATION = -3,<br>HID_DDK_NULL_PTR = -4, HID_DDK_TIMEOUT = -5, HID_DDK_NO_PERM = -6<br>} | Enumerates the HID DDK error codes. | 65 66 67### Functions 68 69| Name| Description| 70| -------- | -------- | 71| [OH_Hid_CreateDevice](#oh_hid_createdevice) ([Hid_Device](_hid___device.md) \*hidDevice, [Hid_EventProperties](_hid___event_properties.md) \*hidEventProperties) | Creates a device. | 72| [OH_Hid_EmitEvent](#oh_hid_emitevent) (int32_t deviceId, const [Hid_EmitItem](_hid___emit_item.md) items[], uint16_t length) | Sends an event list to a device. | 73| [OH_Hid_DestroyDevice](#oh_hid_destroydevice) (int32_t deviceId) | Destroys a device. | 74 75 76### Variables 77 78| Name| Description| 79| -------- | -------- | 80| [Hid_EmitItem::type](#type) | Event type. | 81| [Hid_EmitItem::code](#code) | Event code. | 82| [Hid_EmitItem::value](#value) | Event value. | 83| [Hid_Device::deviceName](#devicename) | Device name. | 84| [Hid_Device::vendorId](#vendorid) | Vendor ID. | 85| [Hid_Device::productId](#productid) | Product ID. | 86| [Hid_Device::version](#version) | Version number. | 87| [Hid_Device::bustype](#bustype) | Bus type. | 88| [Hid_Device::properties](#properties) | Device properties. | 89| [Hid_Device::propLength](#proplength) | Number of device properties. | 90| [Hid_EventTypeArray::hidEventType](#hideventtype) | Event type. | 91| [Hid_EventTypeArray::length](#length-15) | Array length. | 92| [Hid_KeyCodeArray::hidKeyCode](#hidkeycode) | key code. | 93| [Hid_KeyCodeArray::length](#length-25) | Array length. | 94| [Hid_AbsAxesArray::hidAbsAxes](#hidabsaxes) | Array of absolute coordinates. | 95| [Hid_AbsAxesArray::length](#length-35) | Array length. | 96| [Hid_RelAxesArray::hidRelAxes](#hidrelaxes) | Array of relative coordinates. | 97| [Hid_RelAxesArray::length](#length-45) | Array length. | 98| [Hid_MscEventArray::hidMscEvent](#hidmscevent) | Miscellaneous event. | 99| [Hid_MscEventArray::length](#length-55) | Array length. | 100| [Hid_EventProperties::hidEventTypes](#hideventtypes) | Array of event types. | 101| [Hid_EventProperties::hidKeys](#hidkeys) | Array of key codes. | 102| [Hid_EventProperties::hidAbs](#hidabs) | Array of absolute coordinate properties. | 103| [Hid_EventProperties::hidRelBits](#hidrelbits) | Array of relative coordinate properties. | 104| [Hid_EventProperties::hidMiscellaneous](#hidmiscellaneous) | Array of miscellaneous events. | 105| [Hid_EventProperties::hidAbsMax](#hidabsmax) [64] | Maximum values of the absolute coordinates. | 106| [Hid_EventProperties::hidAbsMin](#hidabsmin) [64] | Minimum values of the absolute coordinates. | 107| [Hid_EventProperties::hidAbsFuzz](#hidabsfuzz) [64] | Fuzzy values of the absolute coordinates. | 108| [Hid_EventProperties::hidAbsFlat](#hidabsflat) [64] | Fixed values of the absolute coordinates. | 109 110 111## Type Description 112 113 114### Hid_AbsAxesArray 115 116``` 117typedef struct Hid_AbsAxesArrayHid_AbsAxesArray 118``` 119**Description** 120Defines a struct for an array of absolute coordinates. 121 122**Since**: 11 123 124 125### Hid_Device 126 127``` 128typedef struct Hid_DeviceHid_Device 129``` 130**Description** 131Defines a struct for basic device information. 132 133**Since**: 11 134 135 136### Hid_EmitItem 137 138``` 139typedef struct Hid_EmitItemHid_EmitItem 140``` 141**Description** 142Defines a struct for event information. 143 144**Since**: 11 145 146 147### Hid_EventProperties 148 149``` 150typedef struct Hid_EventPropertiesHid_EventProperties 151``` 152**Description** 153Defines a struct for the event properties of a device. 154 155**Since**: 11 156 157 158### Hid_EventTypeArray 159 160``` 161typedef struct Hid_EventTypeArrayHid_EventTypeArray 162``` 163**Description** 164Defines a struct for an array of event types. 165 166**Since**: 11 167 168 169### Hid_KeyCodeArray 170 171``` 172typedef struct Hid_KeyCodeArrayHid_KeyCodeArray 173``` 174**Description** 175Defines a struct for an array of key codes. 176 177**Since**: 11 178 179 180### Hid_MscEventArray 181 182``` 183typedef struct Hid_MscEventArrayHid_MscEventArray 184``` 185**Description** 186Defines a struct for an array of miscellaneous events. 187 188**Since**: 11 189 190 191### Hid_RelAxesArray 192 193``` 194typedef struct Hid_RelAxesArrayHid_RelAxesArray 195``` 196**Description** 197Defines a struct for an array of relative coordinates. 198 199**Since**: 11 200 201 202## Enum Description 203 204 205### Hid_AbsAxes 206 207``` 208enum Hid_AbsAxes 209``` 210**Description** 211Enumerates the absolute coordinates. 212 213**Since**: 11 214 215| Value| Description| 216| -------- | -------- | 217| HID_ABS_X | X axis.| 218| HID_ABS_Y | Y axis.| 219| HID_ABS_Z | Z axis.| 220| HID_ABS_RX | X axis of the right analog stick.| 221| HID_ABS_RY | Y axis of the right analog stick.| 222| HID_ABS_RZ | Z axis of the right analog stick.| 223| HID_ABS_THROTTLE | Throttle.| 224| HID_ABS_RUDDER | Rudder.| 225| HID_ABS_WHEEL | Scroll wheel.| 226| HID_ABS_GAS | Gas.| 227| HID_ABS_BRAKE | Brake.| 228| HID_ABS_HAT0X | HAT0X | 229| HID_ABS_HAT0Y | HAT0Y | 230| HID_ABS_HAT1X | HAT1X | 231| HID_ABS_HAT1Y | HAT1Y | 232| HID_ABS_HAT2X | HAT2X | 233| HID_ABS_HAT2Y | HAT2Y | 234| HID_ABS_HAT3X | HAT3X | 235| HID_ABS_HAT3Y | HAT3Y | 236| HID_ABS_PRESSURE | Pressure.| 237| HID_ABS_DISTANCE | Distance.| 238| HID_ABS_TILT_X | Tilt of X axis.| 239| HID_ABS_TILT_Y | Tilt of Y axis.| 240| HID_ABS_TOOL_WIDTH | Width of the touch tool.| 241| HID_ABS_VOLUME | Volume.| 242| HID_ABS_MISC | Others.| 243 244 245### Hid_DdkErrCode 246 247``` 248enum Hid_DdkErrCode 249``` 250**Description** 251Enumerates the HID DDK error codes. 252 253**Since**: 11 254 255| Value| Description| 256| -------- | -------- | 257| HID_DDK_SUCCESS | Operation successful.| 258| HID_DDK_FAILURE | Operation failed.| 259| HID_DDK_INVALID_PARAMETER | Invalid parameter.| 260| HID_DDK_INVALID_OPERATION | Invalid operation.| 261| HID_DDK_NULL_PTR | Null pointer.| 262| HID_DDK_TIMEOUT | Timeout.| 263| HID_DDK_NO_PERM | Permission denied.| 264 265 266### Hid_DeviceProp 267 268``` 269enum Hid_DeviceProp 270``` 271**Description** 272Enumerates the properties of input devices. 273 274**Since**: 11 275 276| Value| Description| 277| -------- | -------- | 278| HID_PROP_POINTER | Pointer device.| 279| HID_PROP_DIRECT | Direct input device.| 280| HID_PROP_BUTTON_PAD | Touch device with bottom keys.| 281| HID_PROP_SEMI_MT | Full multi-touch device.| 282| HID_PROP_TOP_BUTTON_PAD | Touch device with top soft keys.| 283| HID_PROP_POINTING_STICK | Pointing stick.| 284| HID_PROP_ACCELEROMETER | Accelerometer.| 285 286 287### Hid_EventType 288 289``` 290enum Hid_EventType 291``` 292**Description** 293Enumerates the event types. 294 295**Since**: 11 296 297| Value| Description| 298| -------- | -------- | 299| HID_EV_SYN | Sync event.| 300| HID_EV_KEY | Key event.| 301| HID_EV_REL | Relative coordinate event.| 302| HID_EV_ABS | Absolute coordinate event.| 303| HID_EV_MSC | Miscellaneous event.| 304 305 306### Hid_KeyCode 307 308``` 309enum Hid_KeyCode 310``` 311**Description** 312Enumerates the key codes. 313 314**Since**: 11 315 316| Value| Description| 317| -------- | -------- | 318| HID_KEY_A | Key A.| 319| HID_KEY_B | Key B.| 320| HID_KEY_C | Key C.| 321| HID_KEY_D | Key D.| 322| HID_KEY_E | Key E.| 323| HID_KEY_F | Key F.| 324| HID_KEY_G | Key G.| 325| HID_KEY_H | Key H.| 326| HID_KEY_I | Key I.| 327| HID_KEY_J | Key J.| 328| HID_KEY_K | Key K.| 329| HID_KEY_L | Key L.| 330| HID_KEY_M | Key M.| 331| HID_KEY_N | Key N.| 332| HID_KEY_O | Key O.| 333| HID_KEY_P | Key P.| 334| HID_KEY_Q | Key Q.| 335| HID_KEY_R | Key R.| 336| HID_KEY_S | Key S.| 337| HID_KEY_T | Key T.| 338| HID_KEY_U | Key U.| 339| HID_KEY_V | Key V.| 340| HID_KEY_W | Key W.| 341| HID_KEY_X | Key X.| 342| HID_KEY_Y | Key Y.| 343| HID_KEY_Z | Key Z.| 344| HID_KEY_ESC | Key Esc.| 345| HID_KEY_0 | Key 0.| 346| HID_KEY_1 | Key 1.| 347| HID_KEY_2 | Key 2.| 348| HID_KEY_3 | Key 3.| 349| HID_KEY_4 | Key 4.| 350| HID_KEY_5 | Key 5.| 351| HID_KEY_6 | Key 6.| 352| HID_KEY_7 | Key 7.| 353| HID_KEY_8 | Key 8.| 354| HID_KEY_9 | Key 9.| 355| HID_KEY_GRAVE | Key grave (`).| 356| HID_KEY_MINUS | Key minus (-).| 357| HID_KEY_EQUALS | Key equals (=).| 358| HID_KEY_BACKSPACE | key Backspace.| 359| HID_KEY_LEFT_BRACKET | Key left bracket ([).| 360| HID_KEY_RIGHT_BRACKET | Key right bracket (]).| 361| HID_KEY_ENTER | Key Enter.| 362| HID_KEY_LEFT_SHIFT | Left Shift.| 363| HID_KEY_BACKSLASH | Key backslash (\).| 364| HID_KEY_SEMICOLON | Key semicolon (;).| 365| HID_KEY_APOSTROPHE | Key apostrophe (').| 366| HID_KEY_SPACE | Key Space.| 367| HID_KEY_SLASH | Key slash (/).| 368| HID_KEY_COMMA | Key comma (,).| 369| HID_KEY_PERIOD | Key period (.).| 370| HID_KEY_RIGHT_SHIFT | Right Shift.| 371| HID_KEY_NUMPAD_0 | Numeral 0 on the numeric keypad.| 372| HID_KEY_NUMPAD_1 | Numeral 1 on the numeric keypad.| 373| HID_KEY_NUMPAD_2 | Numeral 2 on the numeric keypad.| 374| HID_KEY_NUMPAD_3 | Numeral 3 on the numeric keypad.| 375| HID_KEY_NUMPAD_4 | Numeral 4 on the numeric keypad.| 376| HID_KEY_NUMPAD_5 | Numeral 5 on the numeric keypad.| 377| HID_KEY_NUMPAD_6 | Numeral 6 on the numeric keypad.| 378| HID_KEY_NUMPAD_7 | Numeral 7 on the numeric keypad.| 379| HID_KEY_NUMPAD_8 | Numeral 8 on the numeric keypad.| 380| HID_KEY_NUMPAD_9 | Numeral 9 on the numeric keypad.| 381| HID_KEY_NUMPAD_DIVIDE | Arithmetic operator / (division) on the numeric keypad.| 382| HID_KEY_NUMPAD_MULTIPLY | Arithmetic operator * (multiplication) on the numeric keypad.| 383| HID_KEY_NUMPAD_SUBTRACT | Arithmetic operator - (subtraction) on the numeric keypad.| 384| HID_KEY_NUMPAD_ADD | Arithmetic operator + (addition) on the numeric keypad.| 385| HID_KEY_NUMPAD_DOT | Decimal point (.) on the numeric keypad. | 386| HID_KEY_SYSRQ | Key **Print Screen**.| 387| HID_KEY_MUTE | Mute key.| 388| HID_KEY_VOLUME_DOWN | Key for decreasing volume.| 389| HID_KEY_VOLUME_UP | Key for increasing volume.| 390| HID_KEY_BRIGHTNESS_DOWN | Key for making the screen dimmer.| 391| HID_KEY_BRIGHTNESS_UP | Key for making the screen brighter.| 392| HID_BTN_0 | Button 0.| 393| HID_BTN_1 | Button 1| 394| HID_BTN_2 | Button 2.| 395| HID_BTN_3 | Button 3.| 396| HID_BTN_4 | Button 4.| 397| HID_BTN_5 | Button 5.| 398| HID_BTN_6 | Button 6.| 399| HID_BTN_7 | Button 7.| 400| HID_BTN_8 | Button 8.| 401| HID_BTN_9 | Button 9.| 402| HID_BTN_LEFT | Left mouse button.| 403| HID_BTN_RIGHT | Right mouse button.| 404| HID_BTN_MIDDLE | Middle mouse button.| 405| HID_BTN_SIDE | Side mouse button.| 406| HID_BTN_EXTRA | Extra mouse button.| 407| HID_BTN_FORWARD | Mouse forward button.| 408| HID_BTN_BACKWARD | Mouse backward button.| 409| HID_BTN_TASK | Mouse task button.| 410| HID_BTN_TOOL_PEN | Pen.| 411| HID_BTN_TOOL_RUBBER | Eraser.| 412| HID_BTN_TOOL_BRUSH | Brush.| 413| HID_BTN_TOOL_PENCIL | Pencil.| 414| HID_BTN_TOOL_AIRBRUSH | Air brush.| 415| HID_BTN_TOOL_FINGER | Finger.| 416| HID_BTN_TOOL_MOUSE | Mouse.| 417| HID_BTN_TOOL_LENS | Lens.| 418| HID_BTN_TOOL_QUINT_TAP | Five-finger touch.| 419| HID_BTN_STYLUS3 | Stylus 3.| 420| HID_BTN_TOUCH | Touch.| 421| HID_BTN_STYLUS | Stylus.| 422| HID_BTN_STYLUS2 | Stylus 2.| 423| HID_BTN_TOOL_DOUBLE_TAP | Two-finger touch.| 424| HID_BTN_TOOL_TRIPLE_TAP | Three-finger touch.| 425| HID_BTN_TOOL_QUAD_TAP | Four-finger touch.| 426| HID_BTN_WHEEL | Scroll wheel.| 427 428 429### Hid_MscEvent 430 431``` 432enum Hid_MscEvent 433``` 434**Description** 435Enumerates miscellaneous input events. 436 437**Since**: 11 438 439| Value| Description| 440| -------- | -------- | 441| HID_MSC_SERIAL | Serial number.| 442| HID_MSC_PULSE_LED | Pulse.| 443| HID_MSC_GESTURE | Gesture.| 444| HID_MSC_RAW | Start event.| 445| HID_MSC_SCAN | Scan.| 446| HID_MSC_TIMESTAMP | Timestamp.| 447 448 449### Hid_RelAxes 450 451``` 452enum Hid_RelAxes 453``` 454**Description** 455Enumerates the relative coordinates. 456 457**Since**: 11 458 459| Value| Description| 460| -------- | -------- | 461| HID_REL_X | X axis.| 462| HID_REL_Y | Y axis.| 463| HID_REL_Z | Z axis.| 464| HID_REL_RX | X axis of the right analog stick.| 465| HID_REL_RY | Y axis of the right analog stick.| 466| HID_REL_RZ | Z axis of the right analog stick.| 467| HID_REL_HWHEEL | Horizontal scroll wheel.| 468| HID_REL_DIAL | Scale.| 469| HID_REL_WHEEL | Scroll wheel.| 470| HID_REL_MISC | Others.| 471| HID_REL_RESERVED | Reserved.| 472| HID_REL_WHEEL_HI_RES | High-resolution scroll wheel.| 473| HID_REL_HWHEEL_HI_RES | High-resolution horizontal scroll wheel.| 474 475 476### Hid_SynEvent 477 478``` 479enum Hid_SynEvent 480``` 481**Description** 482Enumerates sync events. 483 484**Since**: 11 485 486| Value| Description| 487| -------- | -------- | 488| HID_SYN_REPORT | Indicates the end of an event.| 489| HID_SYN_CONFIG | Indicates configuration synchronization.| 490| HID_SYN_MT_REPORT | Indicates the end of a multi-touch ABS data packet.| 491| HID_SYN_DROPPED | Indicates that the event is discarded.| 492 493 494## Function Description 495 496 497### OH_Hid_CreateDevice() 498 499``` 500int32_t OH_Hid_CreateDevice (Hid_Device * hidDevice, Hid_EventProperties * hidEventProperties ) 501``` 502**Description** 503Creates a device. 504 505**Since**: 11 506 507**Parameters** 508 509| Name| Description| 510| -------- | -------- | 511| hidDevice | Pointer to the basic information about the device to create, including the device name, vendor ID, and product ID. | 512| hidEventProperties | Pointer to the event properties related to the device to create, including the event type, key event properties, absolute coordinate event properties, and relative coordinate event properties. | 513 514**Required Permissions** 515 516ohos.permission.ACCESS_DDK_HID 517 518**Returns** 519 520Returns the device ID (a non-negative number) if the operation is successful; returns a negative number otherwise. 521 522 523### OH_Hid_DestroyDevice() 524 525``` 526int32_t OH_Hid_DestroyDevice (int32_t deviceId) 527``` 528**Description** 529Destroys a device. 530 531**Since**: 11 532 533**Parameters** 534 535| Name| Description| 536| -------- | -------- | 537| deviceId | ID of the device to destroy. | 538 539**Required Permissions** 540 541ohos.permission.ACCESS_DDK_HID 542 543**Returns** 544 545Returns **0** if the operation is successful; returns a negative value otherwise. 546 547 548### OH_Hid_EmitEvent() 549 550``` 551int32_t OH_Hid_EmitEvent (int32_t deviceId, const Hid_EmitItem items[], uint16_t length ) 552``` 553**Description** 554Sends an event list to a device. 555 556**Since**: 11 557 558**Parameters** 559 560| Name| Description| 561| -------- | -------- | 562| deviceId | ID of the target device. | 563| items | List of the events to send. The event information includes the event type (**Hid_EventType**), code (**Hid_SynEvent**, **Hid_KeyCode**, **HidBtnCode**, **Hid_AbsAxes**, **Hid_RelAxes**, or **Hid_MscEvent**), and value (depending on the actual device input). | 564| length | Length of the event list (number of events to be sent at a time). | 565 566**Required Permissions** 567 568ohos.permission.ACCESS_DDK_HID 569 570**Returns** 571 572Returns **0** if the operation is successful; returns a negative value otherwise. 573 574 575## Variable Description 576 577 578### bustype 579 580``` 581uint16_t Hid_Device::bustype 582``` 583**Description** 584Bus type. 585 586 587### code 588 589``` 590uint16_t Hid_EmitItem::code 591``` 592**Description** 593Event code. 594 595 596### deviceName 597 598``` 599const char* Hid_Device::deviceName 600``` 601**Description** 602Device name. 603 604 605### hidAbs 606 607``` 608struct Hid_AbsAxesArray Hid_EventProperties::hidAbs 609``` 610**Description** 611Array of absolute coordinates. 612 613 614### hidAbsAxes 615 616``` 617Hid_AbsAxes* Hid_AbsAxesArray::hidAbsAxes 618``` 619**Description** 620Absolute coordinates. 621 622 623### hidAbsFlat 624 625``` 626int32_t Hid_EventProperties::hidAbsFlat[64] 627``` 628**Description** 629Fixed values of the absolute coordinates. 630 631 632### hidAbsFuzz 633 634``` 635int32_t Hid_EventProperties::hidAbsFuzz[64] 636``` 637**Description** 638Fuzzy values of the absolute coordinates. 639 640 641### hidAbsMax 642 643``` 644int32_t Hid_EventProperties::hidAbsMax[64] 645``` 646**Description** 647Maximum values of the absolute coordinates. 648 649 650### hidAbsMin 651 652``` 653int32_t Hid_EventProperties::hidAbsMin[64] 654``` 655**Description** 656Minimum values of the absolute coordinates. 657 658 659### hidEventType 660 661``` 662Hid_EventType* Hid_EventTypeArray::hidEventType 663``` 664**Description** 665Event type. 666 667 668### hidEventTypes 669 670``` 671struct Hid_EventTypeArray Hid_EventProperties::hidEventTypes 672``` 673**Description** 674Array of event types. 675 676 677### hidKeyCode 678 679``` 680Hid_KeyCode* Hid_KeyCodeArray::hidKeyCode 681``` 682**Description** 683Key code. 684 685 686### hidKeys 687 688``` 689struct Hid_KeyCodeArray Hid_EventProperties::hidKeys 690``` 691**Description** 692Array of key codes. 693 694 695### hidMiscellaneous 696 697``` 698struct Hid_MscEventArray Hid_EventProperties::hidMiscellaneous 699``` 700**Description** 701Array of miscellaneous events. 702 703 704### hidMscEvent 705 706``` 707Hid_MscEvent* Hid_MscEventArray::hidMscEvent 708``` 709**Description** 710Miscellaneous event. 711 712 713### hidRelAxes 714 715``` 716Hid_RelAxes* Hid_RelAxesArray::hidRelAxes 717``` 718**Description** 719Relative coordinates. 720 721 722### hidRelBits 723 724``` 725struct Hid_RelAxesArray Hid_EventProperties::hidRelBits 726``` 727**Description** 728Array of relative coordinates. 729 730 731### length [1/5] 732 733``` 734uint16_t Hid_EventTypeArray::length 735``` 736**Description** 737Length of the event type array. 738 739 740### length [2/5] 741 742``` 743uint16_t Hid_KeyCodeArray::length 744``` 745**Description** 746Length of the key code array. 747 748 749### length [3/5] 750 751``` 752uint16_t Hid_AbsAxesArray::length 753``` 754**Description** 755Length of the absolute coordinate array. 756 757 758### length [4/5] 759 760``` 761uint16_t Hid_RelAxesArray::length 762``` 763**Description** 764Length of the relative coordinate array. 765 766 767### length [5/5] 768 769``` 770uint16_t Hid_MscEventArray::length 771``` 772**Description** 773Length of the miscellaneous event array. 774 775 776### productId 777 778``` 779uint16_t Hid_Device::productId 780``` 781**Description** 782Product ID. 783 784 785### properties 786 787``` 788Hid_DeviceProp* Hid_Device::properties 789``` 790**Description** 791Device properties. 792 793 794### propLength 795 796``` 797uint16_t Hid_Device::propLength 798``` 799**Description** 800Number of device properties. 801 802 803### type 804 805``` 806uint16_t Hid_EmitItem::type 807``` 808**Description** 809Event type. 810 811 812### value 813 814``` 815uint32_t Hid_EmitItem::value 816``` 817**Description** 818Event value. 819 820 821### vendorId 822 823``` 824uint16_t Hid_Device::vendorId 825``` 826**Description** 827Vendor ID. 828 829 830### version 831 832``` 833uint16_t Hid_Device::version 834``` 835**Description** 836Version number. 837