未验证 提交 2bb41d2d 编写于 作者: O openharmony_ci 提交者: Gitee

!5182 【英文】翻译已完成4588

Merge pull request !5182 from shawn_he/master
......@@ -158,7 +158,6 @@ Requests the temporary permission for the application to access the USB device.
});
```
## usb.claimInterface
claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number
......@@ -243,14 +242,13 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
console.log(`setConfiguration = ${ret}`);
```
## usb.setInterface
setInterface(pipe: USBDevicePipe, iface: USBInterface): number
Sets a USB interface.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and interfaces, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and interfaces, call [usb.requestRight](#usbrequestright) to request the device access permission, call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter, and call [usb.claimInterface](#usbclaiminterface) to claim a USB interface..
**System capability**: SystemCapability.USB.USBManager
......@@ -290,7 +288,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
- **Return value**
| Type| Description|
| -------- | -------- |
| Uint8Array | Raw descriptor data. |
| Uint8Array | Raw descriptor data. The value **undefined** indicates that the operation has failed. |
- **Example**
```js
......@@ -316,7 +314,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
- **Return value**
| Type| Description|
| -------- | -------- |
| number | File descriptor of the USB device. |
| number | File descriptor of the USB device. The value **-1** indicates that the operation has failed. |
- **Example**
```js
......@@ -360,7 +358,7 @@ bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, tim
Performs bulk transfer.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and endpoints, call [usb.requestRight](#usbrequestright) to request the device access permission, call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter, and call [usb.claimInterface](#usbclaiminterface) to claim the USB interface.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and endpoints, call [usb.requestRight](#usbrequestright) to request the device access permission, call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter, and call [usb.claimInterface](#usbclaiminterface) to claim a USB interface.
**System capability**: SystemCapability.USB.USBManager
......@@ -381,7 +379,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
```js
// Call usb.getDevices to obtain a data set. Then, obtain a USB device and its access permission.
// Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device.
// Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer.
// Call usb.claimInterface to claim a USB interface. After that, call usb.bulkTransfer to start bulk transfer.
usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => {
console.log(`bulkTransfer = ${JSON.stringify(ret)}`);
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册