同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
hdc_std (OpenHarmony Device Connector) is a command line tool provided by OpenHarmony for debugging. With hdc, you can interact with real devices or simulators from a Windows or Linux OS.
This section describes how to build the hdc_std environment, its common commands, and how to use the commands.
hdc_std obtaining method:
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 specified directory on the disk.
If an exception occurs when you are using hdc_std, you can 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.
The following options are globally available:
Obtains the 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 (for obtaining device information)
hdc_std -t key shell (replace key with the obtained device information)
NOTE: You can connect to multiple devices from the device you use for development. Each device has a unique key, which is IP address:Port number for a device that can be connected through a network and the serial number for a device that can be connected through USB.
The following command is available:
list targets[-v]
Queries 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 the 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
Receives a file from a remote device.
Table 11 Command description
Example:
hdc_std file recv /tmp/fileb ./
The following commands are available:
Installs the OpenHarmony application.
Table 12 Command description
Examples:
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。