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