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 RTOS console is reachable only through an Android UART device, for example /dev/ttyHS1 on G2 Air style targets.
Requirements
- Linux or another POSIX-like host with Python 3.10+
adbinstalled and available inPATH- An adb-connected Android device where
adb rootis 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 g2air
With multiple adb devices attached, pass the adb serial explicitly:
adbuart -s d7a6340b -n g2air
The command creates /tmp/g2air 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/g2air -b 2000000
# or
python3 -m serial.tools.miniterm /tmp/g2air 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
Important options:
-n, --namecreates/tmp/<name>and is required.-s, --serialselects an adb device. If omitted, exactly one device must be connected.--remote-ttyselects the target UART device path. Default:/dev/ttyHS1.--baudsets the initial remote UART baud rate. Default:2000000.--cmd-beforeruns a remote shell command before bridging. Repeatable.--cmd-afterruns 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file adbuart-0.1.0.tar.gz.
File metadata
- Download URL: adbuart-0.1.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c2997b493b819a0363aa8e255792c7e58cfa5e66708572d088ab32e035a6113
|
|
| MD5 |
4aabe48d907e0786235cd0842c70a99e
|
|
| BLAKE2b-256 |
0593518498a14a18aaa3b075cda146e73108ff254db89a0ca2b0f8a9c421cb3b
|
Provenance
The following attestation bundles were made for adbuart-0.1.0.tar.gz:
Publisher:
publish.yml on XuNeo/adbuart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adbuart-0.1.0.tar.gz -
Subject digest:
5c2997b493b819a0363aa8e255792c7e58cfa5e66708572d088ab32e035a6113 - Sigstore transparency entry: 2206538601
- Sigstore integration time:
-
Permalink:
XuNeo/adbuart@7499ffb55de8597fa9c21527ee4b23890febb704 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/XuNeo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7499ffb55de8597fa9c21527ee4b23890febb704 -
Trigger Event:
push
-
Statement type:
File details
Details for the file adbuart-0.1.0-py3-none-any.whl.
File metadata
- Download URL: adbuart-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1328ea1c38fa1d8d5dfcb9d2a421ee562c3ec568b722b4aded0250bf152e0ca7
|
|
| MD5 |
84e23fa376f714e10a8937790278d062
|
|
| BLAKE2b-256 |
3a2aefbcf23949e28f13bc6649a2885e77c12fe59a32723abeeec4ba014c2f26
|
Provenance
The following attestation bundles were made for adbuart-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on XuNeo/adbuart
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adbuart-0.1.0-py3-none-any.whl -
Subject digest:
1328ea1c38fa1d8d5dfcb9d2a421ee562c3ec568b722b4aded0250bf152e0ca7 - Sigstore transparency entry: 2206539275
- Sigstore integration time:
-
Permalink:
XuNeo/adbuart@7499ffb55de8597fa9c21527ee4b23890febb704 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/XuNeo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7499ffb55de8597fa9c21527ee4b23890febb704 -
Trigger Event:
push
-
Statement type: