1# USB Subsystem Changelog
2
3## cl.USB.1 USB APIs Deprecated
4
5**Access Level**
6
7System APIs
8
9**Reason for Change**
10
11Permission control is added to the USB APIs. The new APIs incorporate complete functions of the old system APIs and are more standard and atomic with full compliance with community API specifications.
12
13**Change Impact**
14
15The change is not compatible with earlier versions. You are advised to use new APIs.
16
17**Deprecated Since**
18
19OpenHarmony SDK 4.1.5.1
20
21**Deprecated APIs**
22
23The authentication mode is modified. **AccessTokenKit::VerifyAccessToken** is used instead of the APL level of the caller process for permission verification. The caller of the new APIs needs to apply for the **ohos.permission.** **MANAGE_USB_CONFIG** permission.
24| API                                                    | Description                                                    | Substitute API                                                    |
25| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
26| function addRight(bundleName: string, deviceName: string): boolean; | Use the **usb.addDeviceAccessRight** API to grant device access permission for an application.| function addDeviceAccessRight(bundleName: string, deviceName: string): boolean; |
27| function usbFunctionsFromString(funcs: string): number; | Use the **usb.getFunctionsFromString** API to convert the USB function list from strings to numeric masks.| function getFunctionsFromString(funcs: string): number; |
28| function usbFunctionsToString(funcs: FunctionType): string; | Use the **usb.convertFunctionsToString** API to convert the USB function list from numeric masks to strings.| function convertFunctionsToString(funcs: FunctionType): string; |
29| function setCurrentFunctions(funcs: FunctionType): Promise<void>; | Use the **usb.setDeviceFunctions** API to set the current USB function list.| function setDeviceFunctions(funcs: FunctionType): Promise<void>; |
30| function getCurrentFunctions(): FunctionType; | Use the **usb.getDeviceFunctions** API to obtain the numeric mask combination of the USB function list.| function getDeviceFunctions(): FunctionType; |
31| function getPorts(): Array<USBPort>; | Use the **usb.getUsbPorts** API to obtain the description of all physical USB ports.| function getUsbPorts(): Array<USBPort>; |
32| function getSupportedModes(portId: number): PortModeType; | Use the **usb.getUsbPortSupportModes** API to obtain the numeric mask combination for the supported mode list of the USB port.| function getUsbPortSupportModes(portId: number): PortModeType; |
33| function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise<void>; | Use the **usb.setUsbPortRoles** API to set the role types supported by a specified port, which can be **powerRole** (for charging) and **dataRole** (for data transfer).| function setUsbPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise<void>; |
34
35**Adaptation Guide**
36
37Before change:
38The **apl** field in the application configuration file **xxx.cfg** is **system_basic** or **system_core**.
39After change:
40Add the **ohos.permission.MANAGE_USB_CONFIG** permission to the **permission** field in the configuration file.
41