From b211365426c10a6844e0780c66208d278e85cc0d Mon Sep 17 00:00:00 2001 From: shawn_he Date: Thu, 9 Jun 2022 13:41:13 +0800 Subject: [PATCH] update doc Signed-off-by: shawn_he --- en/application-dev/reference/apis/js-apis-usb.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-usb.md b/en/application-dev/reference/apis/js-apis-usb.md index 06aee1c2fe..63beaae803 100644 --- a/en/application-dev/reference/apis/js-apis-usb.md +++ b/en/application-dev/reference/apis/js-apis-usb.md @@ -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)}`); }); -- GitLab