Read the original article:HDC Command Commands
HDC Common Commands
Summary:
HDC (Huawei Device Connect) commands provide a comprehensive set of tools for managing Huawei devices, performing application testing, and troubleshooting. These commands enable developers and device managers to perform essential tasks such as checking device connections, installing or uninstalling apps, viewing and clearing logs, transferring files, and retrieving system information like power status and device model. Additionally, HDC commands facilitate debugging by allowing the viewing of process details, controlling device power settings, and simulating button presses. You can see the most common hdc commands below.
Question:
What are some common HDC (Huawei Device Connect) commands and their usage?
Short Answer:
- Check device connection: hdc list targets
- Specify connected device: hdc -t < device number >
- Install application: hdc app install
- Uninstall application: hdc app uninstall < application package name >
- Start application: hdc shell aa start -a -b < application package name >
- Stop application: hdc shell aa force-stop < application package name >
- Push file: hdc file send < file path ( PC ) > < target path >
- Pull file: hdc file recv < file path > < target path ( PC ) >
- Delete folder: hdc shell rm -rf < file path >
- Get read and write permissions: hdc shell mount -o rw,remount /
- Get device udid: hdc shell bm get -u
- View log: hdc hilog
- Clear cache log: hdc shell hilog -r
- Restart the device: hdc shell reboot (or hdc target boot )
- Clear application cache: hdc shell bm clean -n < application package name > -c
- Clear application data: hdc shell bm clean -n < application package name > -d
- Check the device system version (combination package version number): hdc shell param get const.product.software.version
- Check the device model: hdc shell param get const.product.model
- Check the device SN number: hdc shell param get ohos.boot.sn
- Check the device type (the folding screen will also display phone ): hdc shell param get const.product.devicetype
- Check the physical version number of the base package: hdc shell param get const.comp.hl.product_base_version.real
- Check the physical version number of the pre-installed package: hdc shell param get const.comp.hl.product_preload_version.real
- View the physical version number of the customized package: hdc shell param get const.comp.hl.product_cust_version.real
- View the application configuration information: hdc shell bm dump -n < application package name >
- View the package names of all applications on the device: hdc shell bm dump -a
- View vendor: hdc shell param get const.cust.vendor
- View region: hdc shell param get const.cust.region
- View the current task stack information: hdc shell aa dump -l
- View the process: hdc shell ps -ef | findstr
- Kill the process: hdc shell kill -9 < process id>
- Kill hdc: hdc kill
- Restart hdc: hdc start -r
- Wait for the device to connect: hdc wait-for-device
- Press the power button: hdc shell uinput -K -d 18 -u 18
- Press the home button: hdc shell uinput -K -d 1 -u 1
- Press the return key: hdc shell uinput -K -d 2 -u 2
- Turn on the border information switch of all components on the page: hdc shell param set persist.ace.debug.boundary.enabled true
- Turn off the border information switch of all components on the page: hdc shell param set persist.ace.debug.boundary.enabled false
- Click coordinates: hdc shell uinput -T -dx,y,-u,x,y
Get the installation path according to the application package name: hdc shell "bm dump -n < application package name > | grep -i hapPath | tail -n 1"
Get the version number according to the application package name: hdc shell "bm dump -n < application package name > | grep -i versionName | tail -n 1"
Query the current power: hdc shell cat /sys/class/power_supply/Battery/capacity
Get the current application package name: hdc shell "aa dump -l | grep bundle | tail -n 1"
Set the device to never turn off the screen: hdc shell power-shell setmode 602
Reboot to enter fastboot mode: hdc shell reboot bootloader
Query all system application paths: hdc shell find /system/app/ -name *.hap
Query all pre-installed application paths: hdc shell find /preload/app/ -name *.hap >>BundlePath.txt
Export Hilog log: hdc file recv /data/log/hilog < target path >
Get help: hdc help
Applicable Scenarios:
- Device Management: Useful for managing connected Huawei devices, including checking connections, installing/uninstalling apps, or restarting devices.
- Application Testing: For developers testing Huawei apps, commands for starting, stopping, and clearing app data or logs can be essential.
- File Transfer: Commands for pushing and pulling files between a PC and the connected Huawei device.
- Debugging: Viewing logs or checking system status (e.g., power, system version) to troubleshoot device issues.
Top comments (0)