未验证 提交 c78cb700 编写于 作者: A Austin 提交者: Gitee

update zh-cn/device-dev/subsystems/subsys-usbservice-guide.md.

Signed-off-by: NAustin23 <liaozhiqi7@huawei.com>
上级 d37f3a95
...@@ -13,40 +13,40 @@ ...@@ -13,40 +13,40 @@
2. 获取usb设备列表 2. 获取usb设备列表
```cpp ```cpp
std::vector<OHOS::USB::UsbDevice> deviceList; std::vector<OHOS::USB::UsbDevice> deviceList;
int32_t ret = g_usbClient.GetDevices(deviceList); int32_t ret = g_usbClient.GetDevices(deviceList);
``` ```
3. 申请设备权限 3. 申请设备权限
```cpp ```cpp
int32_t ret = g_usbClient.RequestRight(device.GetName()); int32_t ret = g_usbClient.RequestRight(device.GetName());
``` ```
4. 打开设备 4. 打开设备
```cpp ```cpp
USBDevicePipe pip; USBDevicePipe pip;
int32_t et = g_usbClient.OpenDevice(device, pip); int32_t et = g_usbClient.OpenDevice(device, pip);
``` ```
5. 配置设备接口 5. 配置设备接口
```cpp ```cpp
ret = g_usbClient.ClaimInterface(pip, interface, true); ret = g_usbClient.ClaimInterface(pip, interface, true);
interfacedeviceListdeviceinterface interfacedeviceListdeviceinterface
``` ```
6. 数据传输 6. 数据传输
```cpp ```cpp
srvClient.BulkTransfer(pipe, endpoint, vdata, timeout); srvClient.BulkTransfer(pipe, endpoint, vdata, timeout);
``` ```
pipe为打开设备后的数据传输通道,endpoint为device中数据传输的端点,vdata是需要传输或读取的二进制数据块,timeout为传输超时时长。 pipe为打开设备后的数据传输通道,endpoint为device中数据传输的端点,vdata是需要传输或读取的二进制数据块,timeout为传输超时时长。
7. 关闭设备 7. 关闭设备
```cpp ```cpp
ret = g_usbClient.Close(pip); ret = g_usbClient.Close(pip);
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册