1# USB DDK 2 3 4## Overview 5 6Provides USB DDK APIs to open and close USB interfaces, perform non-isochronous and isochronous data transfer over USB pipes, and implement control transfer and interrupt transfer, etc. 7 8**System capability**: SystemCapability.Driver.USB.Extension 9 10**Since** 11 1210 13 14## Summary 15 16 17### File 18 19| Name| Description| 20| -------- | -------- | 21| [usb_ddk_api.h](usb__ddk__api_8h.md) | Declares the USB DDK APIs used by the USB host to access USB devices.<br>File to include: <usb/usb_ddk_api.h><br>Library: libusb_ndk.z.so| 22| [usb_ddk_types.h](usb__ddk__types_8h.md) | Provides the enumerated variables, structures, and macros used in USB DDK APIs.<br>File to include: <usb/usb_ddk_types.h> <br>Library: libusb_ndk.z.so| 23 24 25### Structs 26 27| Name| Description| 28| -------- | -------- | 29| [UsbControlRequestSetup](_usb_control_request_setup.md) | Setup data for control transfer. It corresponds to **Setup Data** in the USB protocol.| 30| [UsbDeviceDescriptor](_usb_device_descriptor.md) | Standard device descriptor, corresponding to **Standard Device Descriptor** in the USB protocol.| 31| [UsbConfigDescriptor](_usb_config_descriptor.md) | Standard configuration descriptor, corresponding to **Standard Configuration Descriptor** in the USB protocol.| 32| [UsbInterfaceDescriptor](_usb_interface_descriptor.md) | Standard interface descriptor, corresponding to **Standard Interface Descriptor** in the USB protocol.| 33| [UsbEndpointDescriptor](_usb_endpoint_descriptor.md) | Standard endpoint descriptor, corresponding to **Standard Endpoint Descriptor** in the USB protocol.| 34| [UsbDdkEndpointDescriptor](_usb_ddk_endpoint_descriptor.md) | Endpoint descriptor.| 35| [UsbDdkInterfaceDescriptor](_usb_ddk_interface_descriptor.md) | Interface descriptor.| 36| [UsbDdkInterface](_usb_ddk_interface.md) | USB DDK interface, which is a collection of alternate settings for a particular USB interface.| 37| [UsbDdkConfigDescriptor](_usb_ddk_config_descriptor.md) | Configuration descriptor.| 38| [UsbRequestPipe](_usb_request_pipe.md) | Request pipe.| 39| [UsbDeviceMemMap](_usb_device_mem_map.md) | Device memory map created by calling [OH_Usb_CreateDeviceMemMap()](#oh_usb_createdevicememmap). A buffer using the device memory map can provide better performance.| 40 41### Enums 42 43| Name| Description| 44| -------- | -------- | 45| [UsbDdkErrCode](#usbddkerrcode) {<br>USB_DDK_SUCCESS = 0, USB_DDK_NO_PERM = 201, USB_DDK_INVALID_PARAMETER = 401, USB_DDK_MEMORY_ERROR = 27400001,<br>USB_DDK_INVALID_OPERATION = 27400002, USB_DDK_IO_FAILED = 27400003, USB_DDK_TIMEOUT = 27400004<br>} | USB DDK error code definitions.| 46 47 48### Functions 49 50| Name| Description| 51| -------- | -------- | 52| [OH_Usb_Init](#oh_usb_init) (void) | Initializes the DDK.| 53| [OH_Usb_Release](#oh_usb_release) (void) | Releases the DDK.| 54| [OH_Usb_ReleaseResource](#oh_usb_releaseresource14) (void) | Releases the DDK.| 55| [OH_Usb_GetDeviceDescriptor](#oh_usb_getdevicedescriptor) (uint64_t deviceId, struct [UsbDeviceDescriptor](_usb_device_descriptor.md) \*desc) | Obtains the device descriptor.| 56| [OH_Usb_GetConfigDescriptor](#oh_usb_getconfigdescriptor) (uint64_t deviceId, uint8_t configIndex, struct [UsbDdkConfigDescriptor](_usb_ddk_config_descriptor.md) \*\*const config) | Obtains the configuration descriptor. To avoid memory leakage, use **OH_Usb_FreeConfigDescriptor** to release a descriptor after use.| 57| [OH_Usb_FreeConfigDescriptor](#oh_usb_freeconfigdescriptor) (const struct [UsbDdkConfigDescriptor](_usb_ddk_config_descriptor.md) \*const config) | Releases the configuration descriptor. To avoid memory leakage, release a descriptor after use.| 58| [OH_Usb_ClaimInterface](#oh_usb_claiminterface) (uint64_t deviceId, uint8_t interfaceIndex, uint64_t \*[interfaceHandle](usb__ddk__types_8h.md#interfacehandle)) | Declares a USB interface.| 59| [OH_Usb_ReleaseInterface](#oh_usb_releaseinterface) (uint64_t [interfaceHandle](usb__ddk__types_8h.md#interfacehandle)) | Releases a USB interface.| 60| [OH_Usb_SelectInterfaceSetting](#oh_usb_selectinterfacesetting) (uint64_t [interfaceHandle](usb__ddk__types_8h.md#interfacehandle), uint8_t settingIndex) | Activates the alternate setting of a USB interface.| 61| [OH_Usb_GetCurrentInterfaceSetting](#oh_usb_getcurrentinterfacesetting) (uint64_t [interfaceHandle](usb__ddk__types_8h.md#interfacehandle), uint8_t \*settingIndex) | Obtains the activated alternate setting of a USB interface.| 62| [OH_Usb_SendControlReadRequest](#oh_usb_sendcontrolreadrequest) (uint64_t [interfaceHandle](usb__ddk__types_8h.md#interfacehandle), const struct [UsbControlRequestSetup](_usb_control_request_setup.md) \*setup, uint32_t [timeout](usb__ddk__types_8h.md#timeout), uint8_t \*data, uint32_t \*dataLen) | Sends a control read transfer request. This API works in a synchronous manner.| 63| [OH_Usb_SendControlWriteRequest](#oh_usb_sendcontrolwriterequest) (uint64_t [interfaceHandle](usb__ddk__types_8h.md#interfacehandle), const struct [UsbControlRequestSetup](_usb_control_request_setup.md) \*setup, uint32_t [timeout](usb__ddk__types_8h.md#timeout), const uint8_t \*data, uint32_t dataLen) | Sends a control write transfer request. This API works in a synchronous manner.| 64| [OH_Usb_SendPipeRequest](#oh_usb_sendpiperequest) (const struct [UsbRequestPipe](_usb_request_pipe.md) \*pipe, [UsbDeviceMemMap](_usb_device_mem_map.md) \*devMmap) | Sends a pipe request. This API works in a synchronous manner. It applies to interrupt transfer and bulk transfer.| 65| [OH_Usb_SendPipeRequestWithAshmem](#oh_usb_sendpiperequestwithashmem12) (const struct [UsbRequestPipe](_usb_request_pipe.md) \*pipe, [DDK_Ashmem](_ddk_ashmem.md) \*ashmem) | Sends a pipe request for the shared memory. This API returns the result synchronously. It applies to interrupt transfer and bulk transfer.| 66| [OH_Usb_CreateDeviceMemMap](#oh_usb_createdevicememmap) (uint64_t deviceId, size_t size, [UsbDeviceMemMap](_usb_device_mem_map.md) \*\*devMmap) | Creates a buffer. To avoid memory leakage, use [OH_Usb_DestroyDeviceMemMap()](#oh_usb_destroydevicememmap) to destroy a buffer after use.| 67| [OH_Usb_DestroyDeviceMemMap](#oh_usb_destroydevicememmap) ([UsbDeviceMemMap](_usb_device_mem_map.md) \*devMmap) | Destroys a buffer. To avoid resource leakage, destroy a buffer in time after use.| 68 69#### deviceId Description 70 71You can call **queryDevices()** to obtain the device ID, that is, **deviceId**. 72For details, see [Peripheral Management Development](../../device/driver/externaldevice-guidelines.md). 73 74#### deviceId Conversion 75 76The **deviceId** obtained through **queryDevices()** cannot be directly used as the input parameter for functions such as [OH_Usb_GetDeviceDescriptor](#oh_usb_getdevicedescriptor). 77<p>Specifically, you need to extract its first 32 bits as the input parameter **deviceId** for C APIs.</p> 78<p>The following code is for reference only: </p> 79 80 ~~~ 81uint64_t JsDeviceIdToNative(uint64_t deviceId) 82{ 83 uint32_t busNum = (uint32_t)(deviceId >> 48); 84 uint32_t devNum = (uint32_t)((deviceId & 0x0000FFFF00000000) >> 32); 85 return (((static_cast<uint64_t>(busNum)) << 32) | devNum); 86} 87~~~ 88 89## Enum Description 90 91 92### UsbDdkErrCode 93 94 95``` 96enum UsbDdkErrCode 97``` 98 99**Description** 100 101USB DDK error code definitions. 102 103| Enum| Value| Description| 104| -------- | -------- |-------- | 105| USB_DDK_SUCCESS | 0 | Operation successful.| 106| USB_DDK_NO_PERM | 201 | Operation failed.| 107| USB_DDK_INVALID_PARAMETER | 401 | Invalid parameter.| 108| USB_DDK_MEMORY_ERROR | 27400001 | Memory-related error, for example, insufficient memory, memory data copy failure, or memory application failure.| 109| USB_DDK_INVALID_OPERATION | 27400002 | Invalid operation.| 110| USB_DDK_IO_FAILED | 27400003 | The device I/O operation fails.| 111| USB_DDK_TIMEOUT | 27400004 | Transfer timed out.| 112 113 114## Function Description 115 116 117### OH_Usb_ClaimInterface() 118 119 120``` 121int32_t OH_Usb_ClaimInterface (uint64_t deviceId, uint8_t interfaceIndex, uint64_t * interfaceHandle ) 122``` 123 124**Description** 125 126Declares a USB interface. 127 128**Required permissions**: ohos.permission.ACCESS_DDK_USB 129 130**Parameters** 131 132| Name| Description| 133| -------- | -------- | 134| deviceId | Device ID.| 135| interfaceIndex | Interface index, which corresponds to [bInterfaceNumber](_usb_interface_descriptor.md#binterfacenumber) in the USB protocol.| 136| interfaceHandle | Interface operation handle. After the interface is claimed successfully, a value will be assigned to this parameter.| 137 138**Returns** 139 140- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 141- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 142- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 143- [USB_DDK_INVALID_PARAMETER](#usbddkerrcode): The input **interfaceHandle** is a null pointer. 144 145 146### OH_Usb_CreateDeviceMemMap() 147 148 149``` 150int32_t OH_Usb_CreateDeviceMemMap (uint64_t deviceId, size_t size, UsbDeviceMemMap ** devMmap ) 151``` 152 153**Description** 154 155Creates a buffer. To avoid memory leakage, use [OH_Usb_DestroyDeviceMemMap()](#oh_usb_destroydevicememmap) to destroy a buffer after use. 156 157**Required permissions**: ohos.permission.ACCESS_DDK_USB 158 159**Parameters** 160 161| Name| Description| 162| -------- | -------- | 163| deviceId | Device ID.| 164| size | Buffer size.| 165| devMmap | Data memory map, through which the created buffer is returned to the caller.| 166 167**Returns** 168 169- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 170- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 171- [USB_DDK_INVALID_PARAMETER](#usbddkerrcode): The input **devMmap** is a null pointer. 172- [USB_DDK_MEMORY_ERROR](#usbddkerrcode): indicates that the mmap fails or the memory space of the devMmap fails to be applied for. 173 174 175### OH_Usb_DestroyDeviceMemMap() 176 177 178``` 179void OH_Usb_DestroyDeviceMemMap (UsbDeviceMemMap * devMmap) 180``` 181 182**Description** 183 184Destroys a buffer. To avoid resource leakage, destroy a buffer in time after use. 185 186**Required permissions**: ohos.permission.ACCESS_DDK_USB 187 188**Parameters** 189 190| Name| Description| 191| -------- | -------- | 192| devMmap | Destroys the buffer created by [OH_Usb_CreateDeviceMemMap()](#oh_usb_createdevicememmap).| 193 194 195### OH_Usb_FreeConfigDescriptor() 196 197 198``` 199void OH_Usb_FreeConfigDescriptor (struct UsbDdkConfigDescriptor *const config) 200``` 201 202**Description** 203 204Releases the configuration descriptor. To avoid memory leakage, use **OH_Usb_FreeConfigDescriptor** to release a descriptor after use. 205 206**Required permissions**: ohos.permission.ACCESS_DDK_USB 207 208**Parameters** 209 210| Name| Description| 211| -------- | -------- | 212| config | Configuration descriptor obtained by calling [OH_Usb_GetConfigDescriptor()](#oh_usb_getconfigdescriptor).| 213 214 215### OH_Usb_GetConfigDescriptor() 216 217 218``` 219int32_t OH_Usb_GetConfigDescriptor (uint64_t deviceId, uint8_t configIndex, struct UsbDdkConfigDescriptor **const config ) 220``` 221 222**Description** 223 224Obtains the configuration descriptor. To avoid memory leakage, use **OH_Usb_FreeConfigDescriptor** to release a descriptor after use. 225 226**Required permissions**: ohos.permission.ACCESS_DDK_USB 227 228**Parameters** 229 230| Name| Description| 231| -------- | -------- | 232| deviceId | Device ID.| 233| configIndex | Configuration ID, which corresponds to [bConfigurationValue](_usb_config_descriptor.md#bconfigurationvalue) in the USB protocol.| 234| config | Configuration descriptor, which includes the standard configuration descriptor defined in the USB protocol and the associated interface descriptor and endpoint descriptor.| 235 236**Returns** 237 238- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 239- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 240- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 241- [USB_DDK_INVALID_PARAMETER](#usbddkerrcode): The input **config** is a null pointer. 242- [USB_DDK_IO_FAILED](#usbddkerrcode): The device I/O operation fails. 243 244 245### OH_Usb_GetCurrentInterfaceSetting() 246 247 248``` 249int32_t OH_Usb_GetCurrentInterfaceSetting (uint64_t interfaceHandle, uint8_t * settingIndex ) 250``` 251 252**Description** 253 254Obtains the activated alternate setting of a USB interface. 255 256**Required permissions**: ohos.permission.ACCESS_DDK_USB 257 258**Parameters** 259 260| Name| Description| 261| -------- | -------- | 262| interfaceHandle | Interface operation handle.| 263| settingIndex | Index of the alternate setting, which corresponds to [bAlternateSetting](_usb_interface_descriptor.md#balternatesetting) in the USB protocol.| 264 265**Returns** 266 267- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 268- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 269- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 270- [USB_DDK_INVALID_PARAMETER](#usbddkerrcode): The input **settingIndex** is a null pointer. 271 272 273### OH_Usb_GetDeviceDescriptor() 274 275 276``` 277int32_t OH_Usb_GetDeviceDescriptor (uint64_t deviceId, struct UsbDeviceDescriptor * desc ) 278``` 279 280**Description** 281 282Obtains the device descriptor. 283 284**Required permissions**: ohos.permission.ACCESS_DDK_USB 285 286**Parameters** 287 288| Name| Description| 289| -------- | -------- | 290| deviceId | Device ID.| 291| desc | Device descriptor. For details, see [UsbDeviceDescriptor](_usb_device_descriptor.md).| 292 293**Returns** 294 295- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 296- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 297- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 298- [USB_DDK_INVALID_PARAMETER](#usbddkerrcode): The input **desc** is a null pointer. 299 300### OH_Usb_Init() 301 302 303``` 304int32_t OH_Usb_Init (void ) 305``` 306 307**Description** 308 309Initializes the DDK. 310 311**Required permissions**: ohos.permission.ACCESS_DDK_USB 312 313**Returns** 314 315- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 316- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 317- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 318 319### OH_Usb_Release() 320 321 322``` 323void OH_Usb_Release (void) 324``` 325 326**Description** 327 328Releases the DDK. 329 330**Required permissions**: ohos.permission.ACCESS_DDK_USB 331 332### OH_Usb_ReleaseResource()<sup>14+</sup> 333 334``` 335int32_t OH_Usb_ReleaseResource (void) 336``` 337 338**Description** 339 340Releases the DDK. 341 342**Required permissions**: ohos.permission.ACCESS_DDK_USB 343 344**Returns** 345 346- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 347- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 348- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 349 350### OH_Usb_ReleaseInterface() 351 352``` 353int32_t OH_Usb_ReleaseInterface (uint64_t interfaceHandle) 354``` 355 356**Description** 357 358Releases a USB interface. 359 360**Required permissions**: ohos.permission.ACCESS_DDK_USB 361 362**Parameters** 363 364| Name| Description| 365| -------- | -------- | 366| interfaceHandle | Interface operation handle.| 367 368**Returns** 369 370- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 371- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 372- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 373 374 375### OH_Usb_SelectInterfaceSetting() 376 377 378``` 379int32_t OH_Usb_SelectInterfaceSetting (uint64_t interfaceHandle, uint8_t settingIndex ) 380``` 381 382**Description** 383 384Activates the alternate setting of a USB interface. 385 386**Required permissions**: ohos.permission.ACCESS_DDK_USB 387 388**Parameters** 389 390| Name| Description| 391| -------- | -------- | 392| interfaceHandle | Interface operation handle.| 393| settingIndex | Index of the alternate setting, which corresponds to [bAlternateSetting](_usb_interface_descriptor.md#balternatesetting) in the USB protocol.| 394 395**Returns** 396 397- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 398- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 399- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 400 401 402### OH_Usb_SendControlReadRequest() 403 404 405``` 406int32_t OH_Usb_SendControlReadRequest (uint64_t interfaceHandle, const struct UsbControlRequestSetup * setup, uint32_t timeout, uint8_t * data, uint32_t * dataLen ) 407``` 408 409**Description** 410 411Sends a control read transfer request. This API works in a synchronous manner. 412 413**Required permissions**: ohos.permission.ACCESS_DDK_USB 414 415**Parameters** 416 417| Name| Description| 418| -------- | -------- | 419| interfaceHandle | Interface operation handle.| 420| setup | Request parameters. For details, see [UsbControlRequestSetup](_usb_control_request_setup.md).| 421| timeout | Timeout duration, in milliseconds.| 422| data | Data to be transferred.| 423| dataLen | Data length. The return value indicates the length of the actually read data.| 424 425**Returns** 426 427- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 428- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 429- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 430- [USB_DDK_INVALID_PARAMETER](#usbddkerrcode): The input **setup**, **data**, or **dataLen** is a null pointer, or the value of **datalen** is less than the length of the read data. 431- [USB_DDK_MEMORY_ERROR](#usbddkerrcode): The attempt to copy the memory that stores the read data fails. 432- [USB_DDK_IO_FAILED](#usbddkerrcode): The device I/O operation fails. 433- [USB_DDK_TIMEOUT](#usbddkerrcode): The request times out. 434 435 436### OH_Usb_SendControlWriteRequest() 437 438 439``` 440int32_t OH_Usb_SendControlWriteRequest (uint64_t interfaceHandle, const struct UsbControlRequestSetup * setup, uint32_t timeout, const uint8_t * data, uint32_t dataLen ) 441``` 442 443**Description** 444 445Sends a control write transfer request. This API works in a synchronous manner. 446 447**Required permissions**: ohos.permission.ACCESS_DDK_USB 448 449**Parameters** 450 451| Name| Description| 452| -------- | -------- | 453| interfaceHandle | Interface operation handle.| 454| setup | Request parameters. For details, see [UsbControlRequestSetup](_usb_control_request_setup.md).| 455| timeout | Timeout duration, in milliseconds.| 456| data | Data to be transferred.| 457| dataLen | Data length.| 458 459**Returns** 460 461- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 462- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 463- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 464- [USB_DDK_INVALID_PARAMETER](#usbddkerrcode): The input **setup** or **data** is a null pointer. 465- [USB_DDK_IO_FAILED](#usbddkerrcode): The device I/O operation fails. 466- [USB_DDK_TIMEOUT](#usbddkerrcode): The request times out. 467 468 469### OH_Usb_SendPipeRequest() 470 471 472``` 473int32_t OH_Usb_SendPipeRequest (const struct UsbRequestPipe * pipe, UsbDeviceMemMap * devMmap ) 474``` 475 476**Description** 477 478Sends a pipe request. This API works in a synchronous manner. It applies to interrupt transfer and bulk transfer. 479 480**Required permissions**: ohos.permission.ACCESS_DDK_USB 481 482**Parameters** 483 484| Name| Description| 485| -------- | -------- | 486| pipe | Pipe used to transfer data.| 487| devMmap | Device memory map, which can be obtained by calling [OH_Usb_CreateDeviceMemMap()](#oh_usb_createdevicememmap).| 488 489**Returns** 490 491- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 492- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 493- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 494- [USB_DDK_INVALID_PARAMETER](#usbddkerrcode): The input **pipe**, **devMmap**, or **devMmap** address is a null pointer. 495- [USB_DDK_IO_FAILED](#usbddkerrcode): The device I/O operation fails. 496- [USB_DDK_TIMEOUT](#usbddkerrcode): The request times out. 497 498### OH_Usb_SendPipeRequestWithAshmem()<sup>12+</sup> 499 500 501``` 502int32_t OH_Usb_SendPipeRequestWithAshmem(const struct UsbRequestPipe *pipe, DDK_Ashmem *ashmem); 503``` 504 505**Description** 506 507Sends a pipe request for the shared memory. This API returns the result synchronously. It applies to interrupt transfer and bulk transfer. 508 509**Required permissions**: ohos.permission.ACCESS_DDK_USB 510 511**Parameters** 512 513| Name| Description| 514| -------- | -------- | 515| pipe | Pipe used to transfer data.| 516| ashmem | Shared memory, which can be obtained through [OH_DDK_CreateAshmem()](_base_ddk.md#oh_ddk_createashmem).| 517 518**Returns** 519 520- [USB_DDK_SUCCESS](#usbddkerrcode): The API call is successful. 521- [USB_DDK_NO_PERM](#usbddkerrcode): The permission verification fails. 522- [USB_DDK_INVALID_OPERATION](#usbddkerrcode): The usb_ddk service connection fails. 523- [USB_DDK_INVALID_PARAMETER](#usbddkerrcode): The input **pipe**, **ashmem**, or **ashmem** address is a null pointer. 524- [USB_DDK_IO_FAILED](#usbddkerrcode): The device I/O operation fails. 525- [USB_DDK_TIMEOUT](#usbddkerrcode): The request times out. 526