• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Peripheral Management Module Changelog
2## cl.usbddk.1 Change in the USB_DDK/HID_DDK Error Code Definition
3
4**Access Level**
5
6Public API
7
8**Reason for Change**
9
10The existing error codes of the peripheral management module may affect user experience in the following scenarios:
11
12  1. Error codes are not defined. When an undefined error code is returned, no effective handling guide is available.
13
14  2. There is no mapping error for an error code, and the error code needs to be deprecated.
15
16Therefore, the involved error codes need to be rectified.
17
18**Change Impact**
19
20This change is a non-compatible change.
21
22Possible impacts:
23
24  1. After the definition of existing error codes is standardized, you need to verify the error codes again.
25
26  2. For existing undefined error codes, you need to add error code verification and handling measures.
27
28USB error codes
29
30| Before Change| After Change|
31| ------ | ------ |
32| USB_DDK_SUCCESS = 0 | Unchanged|
33| USB_DDK_FAILED = -1 | Deprecated|
34| USB_DDK_INVALID_PARAMETER = -2 | USB_DDK_INVALID_PARAMETER = 401 |
35| USB_DDK_MEMORY_ERROR = -3 | USB_DDK_MEMORY_ERROR = 27400001 |
36| USB_DDK_INVALID_OPERATION = -4 | USB_DDK_INVALID_OPERATION = 27400002 |
37| USB_DDK_NULL_PTR = -5 | Deprecated|
38| USB_DDK_DEVICE_BUSY = -6 | Deprecated|
39| USB_DDK_TIMEOUT = -7 | USB_DDK_TIMEOUT = 27400004 |
40| USB_DDK_NO_PERM = 201 | Added|
41| USB_DDK_IO_FAILED = 27400003 | Added|
42
43HID error codes
44
45| Before Change| After Change|
46| ------ | ------ |
47| HID_DDK_SUCCESS = 0 | Unchanged|
48| HID_DDK_NO_PERM = -6 | HID_DDK_NO_PERM = 201 |
49| HID_DDK_INVALID_PARAMETER = -2 | HID_DDK_INVALID_PARAMETER = 401 |
50| HID_DDK_FAILURE = -1 | HID_DDK_FAILURE = 27300001 |
51| HID_DDK_NULL_PTR = -4 | HID_DDK_NULL_PTR = 27300002 |
52| HID_DDK_INVALID_OPERATION = -3 | HID_DDK_INVALID_OPERATION = 27300003 |
53| HID_DDK_TIMEOUT = -5 | HID_DDK_TIMEOUT = 27300004 |
54
55**Start API Level**
56
5710
58
59**Change Since**
60
61OpenHarmony SDK 5.0.0.52
62
63**Key API/Component Changes**
64
65drivers/external_device_manager
66
67**Adaptation Guide**
68
69Developers do not need to perform additional adaptation. If specific error codes need to be verified, view the latest error code definition.
70
71You are advised to verify the enum macros instead of the defined enum values when verifying the error codes.
72
73The following is an example of verifying the error code for the HID permission error:
74
75  ```C++
76  //...
77  int32_t ret;
78  ret = OH_Hid_CreateDevice(hidDevice, hidEventProperties);
79  if (ret == HID_DDK_NO_PERM) {
80      // Handling for the permission error
81  }
82  ```
83