1# USB Error Codes 2 3<!--Kit: Basic Services Kit--> 4<!--Subsystem: USB--> 5<!--Owner: @hwymlgitcode--> 6<!--Designer: @w00373942--> 7<!--Tester: @dong-dongzhen--> 8<!--Adviser: @w_Machine_cc--> 9 10> **NOTE** 11> 12> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md). 13 14## 14400001 USB Device Connection Denied 15 16**Error Message** 17 18Access right denied. Call requestRight to get the USBDevicePipe access right first. 19 20**Description** 21 22This error code is reported if a certain API of the USB module is called but the required permission is not granted. 23 24**Possible Causes** 25 26The permission to access the USB device is not granted. 27 28**Solution** 29 30Call **requestRight** to request for the permission to access the USB device. 31<!--Del--> 32## 14400002 HDC Disabled 33 34**Error Message** 35 36Permission denied. The HDC is disabled by the system. 37 38**Description** 39 40This error code is reported if HDC is disabled by the system. 41 42**Possible Causes** 43 44The USB debugging permission is not granted. 45 46**Solution** 47 48Apply for the USB debugging permission. 49 50## 14400003 Port Role Switching Unsupported 51 52**Error Message** 53 54Unsupported operation. The current device does not support port role switching. 55 56**Description** 57 58This error code is reported if the port role is switched. 59 60**Possible Causes** 61 62The port role is incorrect. 63 64**Solution** 65 66Use the correct port role. 67<!--DelEnd--> 68## 14400004 Service Exception 69 70**Error Message** 71 72Service exception. Possible causes: No accessory is plugged in. 73 74**Description** 75 76This error code is reported if the service is abnormal. 77 78**Possible Causes** 79 80No accessory is inserted. 81 82**Solution** 83 84Insert the accessory. 85 86## 14400005 Database Operation Exception 87 88**Error Message** 89 90Database operation exception. 91 92**Description** 93 94This error code is reported if the database operation is abnormal. 95 96**Solution** 97 98Call the API again. 99<!--Del--> 100## 14400006 USB Device Function Unsupported 101 102**Error Message** 103 104Unsupported operation. The function is not supported. 105 106**Description** 107 108This error code is reported if the unsupported USB device function is used. 109 110**Possible Causes** 111 112The USB device function is not supported. 113 114**Solution** 115 116Use the correct USB device function. 117<!--DelEnd--> 118## 14401001 Target USB Accessory Unmatched 119 120**Error Message** 121 122The target USBAccessory not matched. 123 124**Description** 125 126This error code is reported if the target USB accessory does not match the device. 127 128**Solution** 129 130Call **getAccessoryList** to obtain the accessory list and use a matched USB accessory to try again. 131 132## 14401002 Failed to Open the Native Accessory Node 133 134**Error Message** 135 136Failed to open the native accessory node. 137 138**Description** 139 140This error code is reported if the attempt to open the native accessory node fails. 141 142**Solution** 143 144Call the API again. 145 146## 14401003 Accessory Opened Repeatedly 147 148**Error Message** 149 150Cannot reopen the accessory. 151 152**Description** 153 154This error code is reported if an accessory is opened repeatedly. 155 156**Solution** 157 158The accessory has been opened. Continue to perform subsequent operations. 159 160## 14400007 Resource Busy 161 162**Error Message** 163 164Resource busy. Possible causes: 1. The transfer has already been submitted. 2. The interface is claimed by another program or driver. 165 166**Description** 167 168This error code is reported if the requested resource is in use. 169 170**Possible Causes** 171 1721. The transmission task has been submitted. 173 1742. The API is occupied by another program or driver. 175 176**Solution** 177 178Check whether [usbManager.claimInterface](js-apis-usbManager.md#usbmanagerclaiminterface) is successfully called. 179 180## 14400008 No Device (Disconnected) 181 182**Error Message** 183 184No such device (it may have been disconnected). 185 186**Description** 187 188This error code is reported if the device cannot be identified. 189 190**Solution** 191 192Check whether the device type is correct and whether the device is successfully connected. 193 194## 14400009 Insufficient Memory 195 196**Error Message** 197 198Insufficient memory. Possible causes: 1. Memory allocation failed. 199 200**Description** 201 202This error code is reported if no memory is available when being requested. The maximum data size is 1 KB for a single transfer. 203 204**Possible Causes** 205 206The memory usage is too high to allocate sufficient space to the current task. 207 208**Solution** 209 210Clear memory in a timely manner. 211 212## 14400010 Unrecognized Error 213 214**Error Message** 215 216Other USB error. Possible causes: Unrecognized discard error code. 217 218**Description** 219 220This error code is reported if an unknown error occurs. 221 222**Solution** 223 224Correct the error by referring to the related documentation, and try again. 225 226## 14400011 No Ongoing Transfer Found 227 228**Error Message** 229 230The transfer is not in progress, or is already complete or cancelled. 231 232**Description** 233 234This error code is reported if the current data transfer has been canceled or completed. 235 236**Solution** 237 238Initiate a new data transfer request. 239 240## 14400012 I/O Error 241 242**Error Message** 243 244Transmission I/O error. 245 246**Description** 247 248This error code is reported when the read/write operation fails due to the abnormal I/O channel. 249 250**Solution** 251 252Try again. 253 254## 14400013 Parameter Validity Check Failed 255 256**Error Message** 257 258The USBDevicePipe validity check failed. Possible causes: 1. The input parameters fail the validation check. 2. The call chain used to obtain the input parameters is not reasonable. 259 260**Description** 261 262This error code is reported if the parameter validity check fails. 263 264 **Possible Causes** 265 2661. The validity check of the input parameter fails. 267 2682. The input parameter call chain is improper. 269 270**Solution** 271 272Use a proper call chain to obtain the input parameter. 273 274 275## 31400001 Serial Port Service Error 276 277**Error Message** 278 279Serial port management exception. 280 281**Description** 282 283This error code is reported if the serial port service is abnormal. 284 285**Possible Causes** 286 287The process exits due to a program exception. 288 289**Solution** 290 291Check whether the device is connected, and obtain the correct serial port number from the serial port list. 292 293## 31400002 No Serial Port Device Access Permission 294 295**Error Message** 296 297Access denied. Call requestSerialRight to request user authorization first. 298 299**Description** 300 301This error code is reported if you do not have the permission to access the serial port device. 302 303**Possible Causes** 304 305You have not applied for the permission to access the serial port device. 306 307**Solution** 308 309Call **requestSerialRight** to apply for the access permission. 310 311## 31400003 Port Number Not Exist 312 313**Error Message** 314 315PortId does not exist. 316 317**Description** 318 319This error code is reported if the port number does not exist. 320 321**Possible Causes** 322 323The original port number becomes invalid because the device connection is abnormal. 324 325**Solution** 326 327Remove and insert the device, and try again. 328 329## 31400004 Port in Use 330 331**Error Message** 332 333The serial port device is occupied. 334 335**Description** 336 337This error code is reported if the serial port device is occupied. 338 339**Possible Causes** 340 341The serial port device is enabled repeatedly. 342 343**Solution** 344 345Remove and insert the device, and try again. 346 347## 31400005 Device Not Opened 348 349**Error Message** 350 351The serial port device is not opened. Call the open API first. 352 353**Description** 354 355This error code is reported if the serial port device is not opened. 356 357**Possible Causes** 358 359A device has not been opened. 360 361**Solution** 362 363Call the **Open** API to open the device before performing subsequent operations. 364 365## 31400006 Data Transfer Timeout 366 367**Error Message** 368 369Data transfer timed out. 370 371**Description** 372 373This error code is reported if data transfer times out. 374 375**Possible Causes** 376 377The peer end does not send data. 378 379**Solution** 380 381Check whether the peer device initiates data transfer. 382 383## 31400007 I/O Exception 384 385**Error Message** 386 387I/O exception.Possible causes: 1. The transfer was canceled. 2. The device offered more data than allowed. 388 389**Description** 390 391This error code is reported if an I/O exception occurs. 392 393**Possible Causes** 394 3951. The transfer task is canceled abnormally. 396 3972. The amount of received data in a single transfer exceeds the buffer size limit. 398 399**Solution** 400 401Adjust the buffer size properly, and perform data transfer again. 402