• Home
Name Date Size #Lines LOC

..--

entry/12-May-2024-1,1301,008

screenshots/device/12-May-2024-

.gitignoreD12-May-2024121 88

README.mdD12-May-20241.6 KiB3417

README_zh.mdD12-May-20241.1 KiB3116

build-profile.json5D12-May-20241 KiB4241

hvigorfile.jsD12-May-2024174 21

package.jsonD12-May-2024373 1818

README.md

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.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022) to compile and run.
34

README_zh.md

1# USB管理
2
3### 简介
4
5本示例展示了USB设备管理的使用,包括USB设备插拔状态监听和USB设备信息显示。实现效果如下:
6
7![](screenshots/device/DeviceList.png)
8
9### 相关概念
10
11USB管理:本模块可以对USB设备进行监听和信息读取。
12
13### 相关权限
14
15不涉及。
16
17### 使用说明
18
191.打开**USB监听**开关,界面弹出"开始监听..."的提示(USB监听开关仅监听设备是否插入并弹窗进行提示)。
20
212.插入设备,界面会有“USB已插入”的提示,设备列表会显示已插入设备的名称。如果列表没有及时更新,则可以下拉列表手动刷新。
22
233.点击设备,弹框会显示该USB设备的具体信息,点击**确定**按钮返回主页面。
24
254.将USB设备拔出,界面会有“已移除设备”的提示,设备列表会移除该名称的设备。如果列表没有及时更新,则可以下拉列表手动刷新。
26
27### 约束与限制
28
291.本示例仅支持在标准系统上运行。
30
312.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。