The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
## When to Use
## When to Use
In Host mode, you can obtain the list of connected devices, enable or disable the devices, manage device access permissions, and perform data transfer or control transfer.
In Host mode, you can obtain the list of connected devices, enable or disable the devices, manage device access permissions, and perform data transfer or control transfer.
## APIs
## APIs
The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
The following table lists the USB APIs currently available. For details, see the [API Reference](../reference/apis/js-apis-usb.md).
The following table lists the USB APIs currently available. For details, see the [API Reference](../reference/apis/js-apis-usb.md).
**Table 1** Open USB APIs
**Table 1** Open USB APIs
...
@@ -21,7 +21,7 @@ The following table lists the USB APIs currently available. For details, see the
...
@@ -21,7 +21,7 @@ The following table lists the USB APIs currently available. For details, see the
| setConfiguration(pipe: USBDevicePipe, config: USBConfig): number | Sets the USB device configuration. |
| setConfiguration(pipe: USBDevicePipe, config: USBConfig): number | Sets the USB device configuration. |
| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. |
| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. |
| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number | Claims a USB interface |
| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number | Claims a USB interface |
@@ -36,7 +36,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/Readme-EN.
...
@@ -36,7 +36,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/Readme-EN.
2. Register an SSH public key for access to Gitee.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
@@ -55,7 +55,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/Readme-EN.
...
@@ -55,7 +55,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/Readme-EN.
5. Add the path of the **repo** tool to environment variables.
5. Add the path of the **repo** tool to environment variables.
```
```shell
vim ~/.bashrc # Edit environment variables.
vim ~/.bashrc # Edit environment variables.
export PATH=~/bin:$PATH# Add the path of the **repo** tool to the end of environment variables.
export PATH=~/bin:$PATH# Add the path of the **repo** tool to the end of environment variables.
source ~/.bashrc # Apply environment variables.
source ~/.bashrc # Apply environment variables.
...
@@ -73,7 +73,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/Readme-EN.
...
@@ -73,7 +73,7 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/Readme-EN.
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
@@ -112,19 +112,19 @@ You must install **Node.js** and HPM on your local PC. The installation procedur
...
@@ -112,19 +112,19 @@ You must install **Node.js** and HPM on your local PC. The installation procedur
Open the CMD window and run the following command:
Open the CMD window and run the following command:
```
```shell
npm install -g @ohos/hpm-cli
npm install -g @ohos/hpm-cli
```
```
3. Run the following command to check whether the installation is successful. If the HPM version is displayed, the installation is successful.
3. Run the following command to check whether the installation is successful. If the HPM version is displayed, the installation is successful.
```
```shell
hpm -V or hpm --version
hpm -V or hpm --version
```
```
4. Run the following command to upgrade the HPM version:
4. Run the following command to upgrade the HPM version:
```
```shell
npm update -g @ohos/hpm-cli
npm update -g @ohos/hpm-cli
```
```
...
@@ -199,7 +199,7 @@ The table below provides only the sites for downloading the latest OpenHarmony L
...
@@ -199,7 +199,7 @@ The table below provides only the sites for downloading the latest OpenHarmony L
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to GitHub. For details, see [Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).\)
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to GitHub. For details, see [Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).\)
@@ -123,9 +123,8 @@ The following table describes the API for initializing a modem vendor library.
...
@@ -123,9 +123,8 @@ The following table describes the API for initializing a modem vendor library.
3. Run the **hdc\_std shell hilog** command to view the debug log, and check whether the **RilInitOps\(\)** function is successfully executed. The following debug log is for reference:
3. Run the **hdc\_std shell hilog** command to view the debug log, and check whether the **RilInitOps\(\)** function is successfully executed. The following debug log is for reference:
```
```
01-01 05:13:23.071 136 2319 D 00000/RilAdapterInit: [RilAdapterDispatch-(hril_hdf.c:55)] sbuf IPC obtain test success!
09-02 07:40:47.807 455 455 I 01f08/HrilHdf: [LoadVendor-(hril_hdf.c:148)] RilInit LoadVendor start with rilLibPath:libril_vendor.z.so
01-01 05:13:23.071 136 2319 D 00000/RilAdapterInit: [LoadVendor-(hril_hdf.c:33)] RilInit rilInit start
09-02 07:40:47.830 455 455 I 01f08/HrilHdf: [LoadVendor-(hril_hdf.c:163)] HRilRegOps completed
@@ -234,19 +233,12 @@ The following table describes the APIs for responding to modem service requests,
...
@@ -234,19 +233,12 @@ The following table describes the APIs for responding to modem service requests,
4. Open another terminal window, and run the **hdc\_std shell hilog** command. Then, view the log to check whether **ReqDial\(\)** is successfully executed. The following debug log is for reference:
4. Open another terminal window, and run the **hdc\_std shell hilog** command. Then, view the log to check whether **ReqDial\(\)** is successfully executed. The following debug log is for reference: