Skip to main content

Pure python hdc library for harmony hdc service.

Project description

HDC Utils

Pure python hdc library for harmony hdc service.

Support querying corresponding hdc commands and documentation via adb command.

Screenshot 2025-07-09 at 17 02 36

Requires

  • Python 3.11+
  • hdc

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)

License

Licensed under MIT - see LICENSE file. This is not an official Harmony product.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hdcutils-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hdcutils-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file hdcutils-0.1.0.tar.gz.

File metadata

  • Download URL: hdcutils-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for hdcutils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3a8d0b5f7518db96fc896931428eb5805b8a02a3258e455f90f8185e5598dca1
MD5 3754d16c0c35bf3617e92883a0c348b3
BLAKE2b-256 81bcf7ac6af8ff00f1e7782c96530c38f0b8d207adc25e6d1b4e6d858a6cb04d

See more details on using hashes here.

File details

Details for the file hdcutils-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hdcutils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for hdcutils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84b1ef08b429e3618d2b3563b9420120df531142464b92d8436b5da206b865dc
MD5 e1ae23327f1425acd113207c065516a7
BLAKE2b-256 95651cf4ad010c40003b6d524f59ea1da484e1f77987e29e1ff250c526a30b2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page