HDC Utils
Pure python hdc library for harmony hdc service.
Support querying corresponding hdc commands and documentation via adb command.
Requires
- Python 3.10+
- hdc
Install hdc without DevEco Studio
- Find
command-line-toolsin Download Center, and choose a release version to download. If the path is zh, you need to log in to your Huawei account first. - Unzip the downloaded file to a directory, e.g
~/Library/Harmony/command-line-tools - Set environment variable like:
export HARMONY_HOME=~/Library/Harmony
export PATH=${HARMONY_HOME}/command-line-tools/bin:${HARMONY_HOME}/command-line-tools/sdk/default/openharmony/toolchains:${PATH}
- Run
hdccommand to check if it works:
hdc checkserver
# Client version:Ver: 3.1.0e, server version:Ver: 3.1.0e
Install
pip3 install hdcutils
Usage
Search method & doc via adb command
from hdcutils import adb_mapping
result = adb_mapping.search_cmd(cmd='adb logcat -c')
print(result['example']) # HDCClient().device().hilog.remove_buffer_log
print(result['doc']) # https://developer.huawei.com/consumer/en/doc/harmonyos-guides/hilog#clearing-the-log-buffer
# Print full mapping
print(adb_mapping.mapping)
List all the devices and get device object
from hdcutils import HDCClient
# hdc = HDCClient(hdc='/path/to/hdc')
# If you don't set `hdc` path, it will try to find it in $PATH.
hdc = HDCClient()
for target in hdc.list_targets():
d = hdc.device(connect_key=target)
Run shell command
from hdcutils import HDCClient
hdc = HDCClient()
# d = hdc.device(connect_key='device_connect_key')
# If you only have one device, you can use `hdc.device()` without arguments.
d = hdc.device()
out, err = d.shell(['echo', 'Hello World!'])
print(out)
Restart and wait for the reboot to complete
from hdcutils import HDCClient
d = HDCClient().device()
d.boot()
d.wait()
d.param.wait('bootevent.boot.completed', 'true')
License
Licensed under MIT - see LICENSE file. This is not an official Harmony product.
Metadata
Release files for hdcutils 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hdcutils-0.1.4.tar.gz | 18.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hdcutils-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.8 kB
Release files / hdcutils-0.1.4.tar.gz
| Download URL | hdcutils-0.1.4.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d381d7f4bf698375b6ca990568f3d96c6ab6a3039865e9357122780dd31885aa
|
|
BLAKE2b-256 checksum How to use checksums |
1c190a209a83b1c4f7b86b98f2efee6c87432da11d1e8c0f79ba39264f2d2562
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.21
|
Release files / hdcutils-0.1.4-py3-none-any.whl
| Download URL | hdcutils-0.1.4-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0f325f660e68ebfaca88e0872b61bd17811bdf16c93ebf91cb0ef6df7382527
|
|
BLAKE2b-256 checksum How to use checksums |
2a47ba368bf95474f37c5cb83b6397c3da26433b0492b22d056088300fb3e7b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.21
|
Security for hdcutils 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.