This topic describes only module-specific error codes. For details about universal error codes, see Universal Error Codes.
Error Message
Access right denied. Call requestRight to get the USBDevicePipe access right first.
Description
When some APIs of the USB module are called, the requestRight method must be called first to request the permission. If the related permission is not available, this error code is reported.
Possible Causes
The permission to access the USB device is not granted.
Solution
Call requestRight to request for the permission to access the USB device.
Error Message
Service exception. Possible causes: No accessory is plugged in.
Description
This error code is reported if the service is abnormal.
Possible Causes
No accessory is inserted.
Solution
Insert the accessory.
Error Message
Database operation exception.
Description
A database operation exception occurs, possibly because of a database read/write conflict or because resources are not released correctly.
Solution
Call the API again.
Error Message
The target USBAccessory not matched.
Description
This error code is reported if the target USB accessory does not match the device.
Solution
Call getAccessoryList to obtain the accessory list and use a matched USB accessory to try again.
Error Message
Failed to open the native accessory node.
Description
This error code is reported if the attempt to open the native accessory node fails.
Solution
Call the API again.
Error Message
Cannot reopen the accessory.
Description
This error code is reported if an accessory is opened repeatedly.
Solution
The accessory has been opened. Continue to perform subsequent operations.
Error Message
Resource busy. Possible causes: 1. The transfer has already been submitted. 2. The interface is claimed by another program or driver.
Description
This error code is reported if the requested resource is in use.
Possible Causes
The transmission task has been submitted.
The API is occupied by another program or driver.
Solution
Error Message
No such device (it may have been disconnected).
Description
This error code is reported if the device cannot be identified.
Solution
Check whether the device type is correct and whether the device is successfully connected.
Error Message
Insufficient memory. Possible causes: 1. Memory allocation failed.
Description
This error code is reported if no memory is available when being requested. The maximum data size is 1 KB for a single transfer.
Possible Causes
The memory usage is too high to allocate sufficient space to the current task.
Solution
Clear memory in a timely manner.
Error Message
Other USB error. Possible causes: Unrecognized discard error code.
Description
This error code is reported if an unknown error occurs.
Solution
Refer to the USB device and API reference documents, and perform the operation that triggered the error again.
Error Message
The transfer is not in progress, or is already complete or cancelled.
Description
This error code is reported if the current data transfer has been canceled or completed.
Solution
Initiate a new data transfer request.
Error Message
Transmission I/O error.
Description
This error code is reported when the read/write operation fails due to the abnormal I/O channel.
Solution
Check whether the USB device connection status and the I/O channel are normal, and perform the read/write operation again after confirming that they are correct. If I/O errors persist, check whether the transfer parameter configuration is correct.
Error Message
The 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.
Description
This error code is reported if the parameter validity check fails.
Possible Causes
The validity check of the input parameter fails.
The input parameter call chain is improper.
Solution
Use a proper call chain to obtain the input parameter.
Error Message
Serial port management exception.
Description
This error code is reported if the serial port service is abnormal.
Possible Causes
The process exits due to a program exception.
Solution
Identify the cause of the program exception, restart the service, and then obtain the port number from the serial port list.
Error Message
Access denied. Call requestSerialRight to request user authorization first.
Description
This error code is reported if you do not have the permission to access the serial port device.
Possible Causes
You have not applied for the permission to access the serial port device.
Solution
Call the requestSerialRight() method to request the access permission. Recommended calling sequence: call requestSerialRight to obtain the permission first, and then call the Open API to open the device.
Error Message
PortId does not exist.
Description
This error code is reported if the port number does not exist.
Possible Causes
The original port number becomes invalid because the device connection is abnormal.
Solution
Remove and insert the device, and try again.
Error Message
The serial port device is occupied.
Description
This error code is reported if the serial port device is occupied.
Possible Causes
The serial device is occupied by another application.
Solution
Remove and insert the device, and try again.
Error Message
The serial port device is not opened. Call the open API first.
Description
This error code is reported if the serial port device is not opened.
Possible Causes
A device has not been opened.
Solution
Call the Open API to open the device before performing subsequent operations.
Error Message
Data transfer timed out.
Description
This error code is reported if data transfer times out.
Possible Causes
The peer end does not send data.
Solution
Check whether the peer device initiates data transfer.
Error Message
I/O exception. Possible causes: 1. The transfer was canceled. 2. The device offered more data than allowed.
Description
I/O exception.
Possible Causes
The transfer task is canceled abnormally.
The amount of received data in a single transfer exceeds the buffer size limit.
Solution
Check whether the transfer task was canceled abnormally, identify the cause of the cancellation, and then initiate the transfer again.
Set a buffer size that meets the requirements of the transfer scenario, and then restart the transfer task.