Skip to main content

Expose an Android device UART as a local PTY over adb.

Project description

adbuart

Expose an Android-device UART as a local PTY over adb, so host serial tools such as minicom, picocom, or pyserial can talk to it like a normal serial port.

This is useful when a device has no host-side USB serial adapter and the console is reachable only through an Android UART device.

Requirements

  • Linux or another POSIX-like host with Python 3.10+
  • adb installed and available in PATH
  • An adb-connected Android device where adb root is allowed
  • Target-side UART device access, defaulting to /dev/ttyHS1

Install

python3 -m pip install adbuart

Usage

Start the bridge in one terminal:

adbuart -n uart-console

With multiple adb devices attached, pass the adb serial explicitly:

adbuart -s SERIAL -n uart-console

The command creates /tmp/uart-console and keeps running in the foreground. It prints a minicom command when the PTY is ready.

Open the PTY from another terminal:

minicom -D /tmp/uart-console -b 2000000
# or
python3 -m serial.tools.miniterm /tmp/uart-console 2000000

Stop the bridge with Ctrl-C in the bridge terminal. Clean shutdown restores RTOS logging when it was enabled before startup.

Options

Run:

adbuart --help
adbuart --version

Important options:

  • -n, --name creates /tmp/<name> and is required.
  • -s, --serial selects an adb device. If omitted, exactly one device must be connected.
  • --remote-tty selects the target UART device path. Default: /dev/ttyHS1.
  • --baud sets the initial remote UART baud rate. Default: 2000000.
  • --cmd-before runs a remote shell command before bridging. Repeatable.
  • --cmd-after runs a remote shell command during teardown. Repeatable.

By default the tool sets persist.rtoslogd.uart to 0 before bridging so Android log collection releases the UART. During teardown it restores the property to 1 only when it was 1 at startup.

Operating notes

  • The bridge owns the target UART exclusively while it is running. Stop it before flashing, resetting, or opening the same UART through another tool.
  • The local node is protected with a lock file, but unrelated tools can still collide at the device UART level.
  • Avoid kill -9; it skips teardown and can leave RTOS logging disabled or a stale /tmp/<name> symlink.
  • Serial disconnects during target reset are normal. Restart the bridge after the adb UART stream closes.

Development

python3 -m pip install -e '.[dev]'
pytest -q
python3 -m build

License

MIT

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

adbuart-0.1.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

adbuart-0.1.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file adbuart-0.1.1.tar.gz.

File metadata

  • Download URL: adbuart-0.1.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for adbuart-0.1.1.tar.gz
Algorithm Hash digest
SHA256 eb9f2a6af188d97db4eebcfcae1e3e4fd1137e2697bf14f19bfa695e94b94964
MD5 a730bcbef687bccb943e5f292680fe87
BLAKE2b-256 2d95ec12c181e0466e752ca407780c50fcccf8bb4d4ff8541b87beba49b95439

See more details on using hashes here.

Provenance

The following attestation bundles were made for adbuart-0.1.1.tar.gz:

Publisher: publish.yml on XuNeo/adbuart

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adbuart-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: adbuart-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for adbuart-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfacec425a9e242393647397838740b1ae023c625ca61a403fc291c7efbd3a7f
MD5 98d6376c6e092cafabdfa21dc9187d3c
BLAKE2b-256 a36a3a271445e9b3cc307ce6340f365f93ca1b17963fe3bee5f09f97e587cd83

See more details on using hashes here.

Provenance

The following attestation bundles were made for adbuart-0.1.1-py3-none-any.whl:

Publisher: publish.yml on XuNeo/adbuart

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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