• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# USB management
2
3### Introduction
4
5This example demonstrates the use of USB device management, including USB device insertion and removal status monitoring and USB device information display. The results are as follows:
6
7![](screenshots/device/DeviceList.png)
8
9# Related Conceptions
10
111. [Subscribe to USB Listening Events](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md#commoneventcreatesubscriber) : Obtain the interface usage status by subscribing to the USB insertion and removal listening events.
12
132. [Get USB Device List](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-usb.md#usbgetdevices): Gets the list of plugged in USB devices.
14
15### Related permissions
16
17Not involved
18
19### Usage
20
211. Open the **USB Listening** switch, and the interface pops up the prompt of "Start Listening...".
22
232. Plug in the device, the interface will have a "USB plugged in" prompt, the device list will show the plugged in device. If the list is not updated in time, you can manually refresh the drop-down list.
24
253. Click on the device, the pop-up box will display the specific information of the USB device, click the **OK** button to return to the main page.
26
274. Unplug the USB device, the interface will have a "removed device" prompt, and the device list will remove the device model. If the list is not updated in time, you can manually refresh the drop-down list.
28
29### Constraints and Restrictions
30
311. This sample is only supported to run on standard systems.
32
332. This sample requires DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) to compile and run.
34