From 5d4973f79e98fde6f004400d19e3f035a17d5da4 Mon Sep 17 00:00:00 2001 From: wusongqing Date: Mon, 14 Feb 2022 17:47:24 +0800 Subject: [PATCH] updated docs Signed-off-by: wusongqing --- en/device-dev/faqs/Readme-EN.md | 16 +- ...-building.md => faqs-environment-setup.md} | 0 ...s-init.md => faqs-startup-and-recovery.md} | 0 .../subsystems/subsys-toolchain-hdc-guide.md | 667 ++++++++++++++++++ en/device-dev/subsystems/subsys-toolchain.md | 2 +- ...sys_utils_faqs.md => subsys-utils-faqs.md} | 0 ...s_utils_guide.md => subsys-utils-guide.md} | 0 ...s_overview.md => subsys-utils-overview.md} | 0 en/device-dev/subsystems/subsys-utils.md | 6 +- zh-cn/device-dev/faqs/Readme-CN.md | 6 +- ...-building.md => faqs-environment-setup.md} | 0 ...nit.md => faqs-startup-and-recovery.md.md} | 0 12 files changed, 682 insertions(+), 15 deletions(-) rename en/device-dev/faqs/{faqs-environment-building.md => faqs-environment-setup.md} (100%) rename en/device-dev/faqs/{faqs-init.md => faqs-startup-and-recovery.md} (100%) create mode 100644 en/device-dev/subsystems/subsys-toolchain-hdc-guide.md rename en/device-dev/subsystems/{subsys_utils_faqs.md => subsys-utils-faqs.md} (100%) rename en/device-dev/subsystems/{subsys_utils_guide.md => subsys-utils-guide.md} (100%) rename en/device-dev/subsystems/{subsys_utils_overview.md => subsys-utils-overview.md} (100%) rename zh-cn/device-dev/faqs/{faqs-environment-building.md => faqs-environment-setup.md} (100%) rename zh-cn/device-dev/faqs/{faqs-init.md => faqs-startup-and-recovery.md.md} (100%) diff --git a/en/device-dev/faqs/Readme-EN.md b/en/device-dev/faqs/Readme-EN.md index 192f50248a..24536dc1f6 100644 --- a/en/device-dev/faqs/Readme-EN.md +++ b/en/device-dev/faqs/Readme-EN.md @@ -1,11 +1,11 @@ # FAQs -- [Overview of FAQs](overview-of-faqs.md) -- [Environment Setup](environment-setup.md) -- [Compilation and Building Subsystem](compilation-and-building-subsystem.md) -- [Burning](burning.md) -- [Kernel](kernel.md) -- [Porting](porting.md) -- [Startup and Recovery](startup-and-recovery.md) -- [System Applications](system-applications.md) +- [Overview of FAQs](faqs-overview.md) +- [Environment Setup](faqs-environment-setup.md) +- [Compilation and Building Subsystem](faqs-building) +- [Burning](faqs-burning.md) +- [Kernel](faqs-kernel.md) +- [Porting](faqs-porting) +- [Startup and Recovery](faqs-startup-and-recovery.md) +- [System Applications](faqs-system-applications) diff --git a/en/device-dev/faqs/faqs-environment-building.md b/en/device-dev/faqs/faqs-environment-setup.md similarity index 100% rename from en/device-dev/faqs/faqs-environment-building.md rename to en/device-dev/faqs/faqs-environment-setup.md diff --git a/en/device-dev/faqs/faqs-init.md b/en/device-dev/faqs/faqs-startup-and-recovery.md similarity index 100% rename from en/device-dev/faqs/faqs-init.md rename to en/device-dev/faqs/faqs-startup-and-recovery.md diff --git a/en/device-dev/subsystems/subsys-toolchain-hdc-guide.md b/en/device-dev/subsystems/subsys-toolchain-hdc-guide.md new file mode 100644 index 0000000000..3c72f79eac --- /dev/null +++ b/en/device-dev/subsystems/subsys-toolchain-hdc-guide.md @@ -0,0 +1,667 @@ +# hdc\_std Usage Guidelines + +hdc\_std \(OpenHarmony Device Connector\) is a command line tool provided by OpenHarmony for debugging. With this tool, you can interact with real devices or simulators from a Windows or Linux OS. + +This section describes how to set up the hdc\_std environment and use its common commands. + +## Preparations + +**Obtaining hdc\_std:** + +Obtain **hdc\_std** from the **prebuilt** directory at [developtools\_hdc\_standard](https://gitee.com/openharmony/developtools_hdc_standard). + +**Example:** + +To obtain hdc\_std on Windows, obtain the executable file **hdc\_std.exe** from **prebuilt/windows** and place it in a directory on the disk. + +## Important Notes + +- If an exception occurs when you are using hdc\_std, run the **hdc\_std kill** command to kill the hdc\_std service or run the **hdc\_std start -r** command to restart the service process. +- If no device information is obtained after **hdc\_std list targets** is executed, use the task manager to check whether the **hdc.exe** process exists. If it exists, kill the process. + +## Option-related Commands + +The following commands are available: + +### -h/help -v/version + +Obtains hdc help and version information. + +**Table 1** Command description + + + + + + + + + +

Return Value

+

Description

+

Required information

+

hdc help or version information

+
+ +Examples: + +hdc\_std -h / hdc\_std help + +hdc\_std -v / hdc\_std version + +### -t key + +Connects to a device with a specified key. + +**Table 2** Command description + + + + + + + + + + + + + + + +

Parameter

+

Description

+

key

+

Key that identifies the device. The value is in the IP address:Port number format or is a USB serial number.

+

Return Value

+

Description

+

1. error: device '***' not found

+

②Nothing to do...

+

1. The device does not exist.

+

2. The command appended to -t key does not exist.

+
+ +Examples: + +This option must be used together with a specific operation command. The following uses the shell command as an example: + +**hdc\_std list targets** \(obtain device information\) + +**hdc\_std -t _key_ shell** \(replace _key_ with the device information obtained\) + +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>You can connect to multiple devices from the device you use for development. Each device has a unique key. The key can be _IP address:Port number_ for a device connected through a network or the serial number for a device connected through USB. + +## Querying the Device List + +The following command is used to query the device list: + +### list targets\[-v\] + +Displays all the connected devices. + +**Table 3** Command description + + + + + + + + + + + + + + + +

Parameter

+

Description

+

-v

+

Prints detailed device information.

+

Return Value

+

Description

+

1. Device information

+

②[Empty]

+

1. A list of connected devices

+

2. No device information is found.

+
+ +Examples: + +hdc\_std list targets + +hdc\_std list targets -v + +## Service Process Commands + +The following commands are available: + +### target mount + +Mounts a partition, such as **/system**, with the read and write permissions. + +**Table 4** Command description + + + + + + + + + + + + + + + +

Parameter

+

Description

+

None

+

None

+

Return Value

+

Description

+

①Mount finish

+

2. Returned information

+

1. Information returned when the operation is successful.

+

2. Information returned when the operation fails.

+
+ +Example: + +hdc\_std target mount + +### smode \[off\] + +Grants the root permission to a background service process. The **off** option is used to revoke the granted permission. + +Examples: + +hdc\_std smode + +hdc\_std smode off + +### kill \[-r\] + +Stops a service process. + +**Table 5** Command description + + + + + + + + + + + + + + + +

Parameter

+

Description

+

-r

+

Triggers the service restart.

+

Return Value

+

Description

+

①Kill server finish

+

2. Error information

+

1. Information returned when the operation is successful.

+

2. The operation fails.

+
+ +Example: + +hdc\_std kill + +### start \[-r\] + +Starts a service process. + +**Table 6** Command description + + + + + + + + + + + + + + + +

Parameter

+

Description

+

-r

+

Restarts the service process if it has started.

+

Return Value

+

Description

+

None

+

None

+
+ +Examples: + +hdc\_std start + +## Network Commands + +The following commands are available: + +### tconn _host_\[:_port_\]\[-remove\] + +Connects to a device with a specified IP address and port number. + +**Table 7** Command description + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

host[:port]

+

IP address and port number of the device to be connected

+

-remove

+

Disconnects from the specified device.

+

Return Value

+

Description

+

1. Error information

+

2. None

+

1. The operation fails.

+

2. The operation is successful.

+
+ +Example: + +hdc\_std tconn 192.168.0.100:8710 + +### tmode usb + +Restarts the daemon process and connects to the device using USB. + +**Table 8** Command description + + + + + + + + + + + + + + + +

Parameter

+

Description

+

None

+

None

+

Return Value

+

Description

+

1. Error information

+

2. None

+

1. The operation fails.

+

2. The operation is successful.

+
+ +Example: + +hdc\_std tmode usb + +### tmode port _port-number_ + +Restarts the daemon process and connects to the device over TCP. + +**Table 9** Command description + + + + + + + + + + + + + + + +

Parameter

+

Description

+

port-number

+

Port number used to connect to the device

+

Return Value

+

Description

+

1. Error information

+

2. None

+

1. The operation fails.

+

2. The operation is successful.

+
+ +Example: + +hdc\_std tmode port 8710 + +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>After this command is executed, the remote daemon process exits and restarts, and the TCP connection is enabled by default. If you do not include **port-number** in this command, a random port will be used to connect to the device. + +## File Commands + +The following commands are available: + +### file send _local remote_ + +Sends a file to a remote device. + +**Table 10** Command description + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

local

+

Path of the file to send

+

remote

+

Destination path on the remote device

+

Return Value

+

Description

+

1. Error information

+

2. File transfer result

+

1. The operation fails.

+

2. The operation is successful.

+
+ +Example: + +hdc\_std file send E:\\a.txt /data/local/tmp/a.txt + +### file recv \[-a\] _remote local_ + +Receives a file from a remote device. + +**Table 11** Command description + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

-a

+

File retention timestamp mode

+

local

+

Path on the local device to receive the file

+

remote

+

File path on the remote device

+

Return Value

+

Description

+

1. Error information

+

2. None

+

1. The operation fails.

+

2. The operation is successful.

+
+ +Example: + +hdc\_std file recv /data/local/tmp/a.txt ./a.txt + +## App Commands + +The following commands are available: + +### install \[-r/-d/-g\] _package_ + +Installs the OpenHarmony application. + +**Table 12** Command description + + + + + + + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

package

+

OpenHarmony application installation package

+

-r

+

Replaces an existing application.

+

-d

+

Allows downgraded installation.

+

-g

+

Grants permission dynamically

+

Return Value

+

Description

+

1. Error information

+

2. None

+

1. The operation fails.

+

2. The operation is successful.

+
+ +Example: + +hdc\_std install _hwadmin.hap_ + +### uninstall \[-k\] _package_ + +Uninstalls the OpenHarmony application. + +**Table 13** Command description + + + + + + + + + + + + + + + + + + +

Parameter

+

Description

+

package

+

OpenHarmony application installation package

+

-k

+

Retains /data/cache.

+

Return Value

+

Description

+

1. Error information

+

2. None

+

1. The operation fails.

+

2. The operation is successful.

+
+ +Example: + +hdc\_std uninstall _package_ + +## Debugging Commands + +The following commands are available: + +### hilog + +Obtains logs for debugging. + +**Table 14** Command description + + + + + + + + + + + + + + + +

Parameter

+

Description

+

None

+

None

+

Return Value

+

Description

+

Returned information

+

Obtained logs

+
+ +Example: + +hdc\_std hilog + +### shell \[_command_\] + +Executes a command remotely or enters an interactive command environment. + +**Table 15** Command description + + + + + + + + + + + + + + + +

Parameter

+

Description

+

command

+

Command to be executed

+

Return Value

+

Description

+

Returned information

+

Execution result of the command

+
+ +Examples: + +hdc\_std shell + +## Troubleshooting + +### hdc\_std Fails to Connect to a Device + +- **Symptom** + + **\[Empty\]** is displayed in the output after the **hdc\_std list targets** command is executed. + +- **Solutions** + 1. The device cannot be identified. + + Check whether **HDC Device** exists in the universal serial bus device of the device manager. If **HDC Device** does not exist, the device cannot be connected. In this case, remove and then insert the device or burn the latest image for the device. + + 2. hdc\_std works improperly. + + Run the **hdc kill** or **hdc start -r** command to kill or restart the hdc service. Then, run the **hdc list targets** command to check whether device information can be obtained. + + 3. hdc\_std does not match the device. + + If the latest image is burnt on the device, the latest hdc\_std version must be used. As hdc\_std is updated continuously, obtain hdc\_std of the latest version from the **developtools\_hdc\_standard** repository in the **prebuilt** directory. + + + +## hdc\_std Fails to Run + +- **Symptom** + + The **hdc\_std.exe** file does not run after being clicked. + +- **Solutions** + + **hdc\_std.exe** requires no installation. It can be directly used on a disk or added to environment variables. Open the cmd window and run the **hdc\_std** command to use **hdc\_std.exe**. diff --git a/en/device-dev/subsystems/subsys-toolchain.md b/en/device-dev/subsystems/subsys-toolchain.md index baceec80d1..bf65f5f78a 100644 --- a/en/device-dev/subsystems/subsys-toolchain.md +++ b/en/device-dev/subsystems/subsys-toolchain.md @@ -2,6 +2,6 @@ - **[bytrace Usage Guidelines](subsys-toolchain-bytrace-guide.md)** -- **[hdc\_std Usage Guidelines](subsys_toolchain_hdc_guide.md)** +- **[hdc\_std Usage Guidelines](subsys-toolchain-hdc-guide.md)** diff --git a/en/device-dev/subsystems/subsys_utils_faqs.md b/en/device-dev/subsystems/subsys-utils-faqs.md similarity index 100% rename from en/device-dev/subsystems/subsys_utils_faqs.md rename to en/device-dev/subsystems/subsys-utils-faqs.md diff --git a/en/device-dev/subsystems/subsys_utils_guide.md b/en/device-dev/subsystems/subsys-utils-guide.md similarity index 100% rename from en/device-dev/subsystems/subsys_utils_guide.md rename to en/device-dev/subsystems/subsys-utils-guide.md diff --git a/en/device-dev/subsystems/subsys_utils_overview.md b/en/device-dev/subsystems/subsys-utils-overview.md similarity index 100% rename from en/device-dev/subsystems/subsys_utils_overview.md rename to en/device-dev/subsystems/subsys-utils-overview.md diff --git a/en/device-dev/subsystems/subsys-utils.md b/en/device-dev/subsystems/subsys-utils.md index d9da7eb8e4..1eb9ae9db3 100644 --- a/en/device-dev/subsystems/subsys-utils.md +++ b/en/device-dev/subsystems/subsys-utils.md @@ -1,9 +1,9 @@ # Utils -- **[Utils Overview](subsys_utils_overview.md)** +- **[Utils Overview](subsys-utils-overview.md)** -- **[Utils Development Guidelines](subsys_utils_guide.md)** +- **[Utils Development Guidelines](subsys-utils-guide.md)** -- **[Utils FAQ](subsys_utils_faqs.md)** +- **[Utils FAQ](subsys-utils-faqs.md)** diff --git a/zh-cn/device-dev/faqs/Readme-CN.md b/zh-cn/device-dev/faqs/Readme-CN.md index e6bf2b396f..3cc4b5009f 100644 --- a/zh-cn/device-dev/faqs/Readme-CN.md +++ b/zh-cn/device-dev/faqs/Readme-CN.md @@ -1,11 +1,11 @@ # FAQs - [常见问题概述](faqs-overview.md) -- [环境搭建常见问题](faqs-environment-building.md) +- [环境搭建常见问题](faqs-environment-setup.md) - [编译构建子系统常见问题](faqs-building.md) - [烧录常见问题](faqs-burning.md) - [内核常见问题](faqs-kernel.md) -- [移植常见问题](faqs-planting.md) -- [启动恢复常见问题](faqs-init.md) +- [移植常见问题](faqs-porting.md) +- [启动恢复常见问题](faqs-startup-and-recovery.md) - [系统应用常见问题](faqs-system-applications.md) diff --git a/zh-cn/device-dev/faqs/faqs-environment-building.md b/zh-cn/device-dev/faqs/faqs-environment-setup.md similarity index 100% rename from zh-cn/device-dev/faqs/faqs-environment-building.md rename to zh-cn/device-dev/faqs/faqs-environment-setup.md diff --git a/zh-cn/device-dev/faqs/faqs-init.md b/zh-cn/device-dev/faqs/faqs-startup-and-recovery.md.md similarity index 100% rename from zh-cn/device-dev/faqs/faqs-init.md rename to zh-cn/device-dev/faqs/faqs-startup-and-recovery.md.md -- GitLab