同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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.
Obtaining hdc_std:
Obtain hdc_std from the developtools_hdc_standard repository in the prebuilt directory.
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.
The following commands are available:
Obtains hdc help and version information.
Table 1 Command description
Examples:
hdc_std -h / hdc_std help
hdc_std -v / hdc_std version
Connects to a device with a specified key.
Table 2 Command description
Key that identifies the device. The value is in the IP address:Port number format or is a USB serial number. |
|
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)
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.
The following command is used to query the device list:
Displays all the connected devices.
Table 3 Command description
Examples:
hdc_std list targets
hdc_std list targets -v
The following commands are available:
Mounts a partition, such as /system, with the read and write permissions.
Table 4 Command description
Example:
hdc_std target mount
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
Stops a service process.
Table 5 Command description
Example:
hdc_std kill
Starts a service process.
Table 6 Command description
Examples:
hdc_std start
The following commands are available:
Connects to a device with a specified IP address and port number.
Table 7 Command description
Example:
hdc_std tconn 192.168.0.100:8710
Restarts the daemon process and connects to the device using USB.
Table 8 Command description
Example:
hdc_std tmode usb
Restarts the daemon process and connects to the device over TCP.
Table 9 Command description
Example:
hdc_std tmode port 8710
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.
The following commands are available:
Sends a file to a remote device.
Table 10 Command description
Example:
hdc_std file send E:\a.txt /data/local/tmp/a.txt
Receives a file from a remote device.
Table 11 Command description
Example:
hdc_std file recv /data/local/tmp/a.txt ./a.txt
The following commands are available:
Installs the OpenHarmony application.
Table 12 Command description
Example:
hdc_std install hwadmin.hap
Uninstalls the OpenHarmony application.
Table 13 Command description
Example:
hdc_std uninstall package
The following commands are available:
Obtains logs for debugging.
Table 14 Command description
Example:
hdc_std hilog
Executes a command remotely or enters an interactive command environment.
Table 15 Command description
Examples:
hdc_std shell
Symptom
[Empty] is displayed in the output after the hdc_std list targets command is executed.
Solutions
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.
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.
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.
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.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。