1e41f4b71Sopenharmony_ci# USB Subsystem Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.USB.1 USB APIs Deprecated
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci**Access Level**
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciSystem APIs
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci**Reason for Change**
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciPermission 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.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci**Change Impact**
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciThe change is not compatible with earlier versions. You are advised to use new APIs.
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Deprecated Since**
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciOpenHarmony SDK 4.1.5.1
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**Deprecated APIs**
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ciThe 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.
24e41f4b71Sopenharmony_ci| API                                                    | Description                                                    | Substitute API                                                    |
25e41f4b71Sopenharmony_ci| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
26e41f4b71Sopenharmony_ci| 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; |
27e41f4b71Sopenharmony_ci| 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; |
28e41f4b71Sopenharmony_ci| 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; |
29e41f4b71Sopenharmony_ci| function setCurrentFunctions(funcs: FunctionType): Promise<void>; | Use the **usb.setDeviceFunctions** API to set the current USB function list.| function setDeviceFunctions(funcs: FunctionType): Promise<void>; |
30e41f4b71Sopenharmony_ci| function getCurrentFunctions(): FunctionType; | Use the **usb.getDeviceFunctions** API to obtain the numeric mask combination of the USB function list.| function getDeviceFunctions(): FunctionType; |
31e41f4b71Sopenharmony_ci| function getPorts(): Array<USBPort>; | Use the **usb.getUsbPorts** API to obtain the description of all physical USB ports.| function getUsbPorts(): Array<USBPort>; |
32e41f4b71Sopenharmony_ci| 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; |
33e41f4b71Sopenharmony_ci| 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>; |
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci**Adaptation Guide**
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ciBefore change:
38e41f4b71Sopenharmony_ciThe **apl** field in the application configuration file **xxx.cfg** is **system_basic** or **system_core**.
39e41f4b71Sopenharmony_ciAfter change:
40e41f4b71Sopenharmony_ciAdd the **ohos.permission.MANAGE_USB_CONFIG** permission to the **permission** field in the configuration file.
41