Utility that duplicates a serial port tty.
The main reason for using this tool is to log what is going through the tty.
Why create a “dummy” tty just to log ? Well, a tty can only be read by ONE process. If two processes read the tty, each will read partial data from the tty. Also, you can’t read the data going into the tty this way.
So this utility reads / writes to the real TTY, bridges it to a dummy tty, and logs everything going via the dummy tty.
Requirements
Python >=3.6
socat
Installation
You can install “python-tty-duplicator” via pip from PyPI:
$ pip install python-tty-duplicator
Usage
from tty_duplicator import TTYDuplicator
duplicator = TTYDuplicator(“/dev/ttyUSB0”, “serial_data.log”) print(duplicator.fake_tty)
duplicator.start()
# Now you can interact with the “fake tty” and everything will be logged! # e.g use picocom, tio, or pyserial
# Optional: will be called when python exits gracefully duplicator.stop()
License
Distributed under the terms of the MIT license, “python-tty-duplicator” is free and open source software
Release files for python-tty-duplicator 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-tty-duplicator-0.1.0.tar.gz | 3.8 kB | Details |
Release files / python-tty-duplicator-0.1.0.tar.gz
| Download URL | python-tty-duplicator-0.1.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ece9e02862f41be03c784baca0bec0ca43c9306c41cf18d57f0b7ce35eff380b
|
|
BLAKE2b-256 checksum How to use checksums |
a4065c905d83874fd33165277ab5b64a79a37f6c7847dc8bcc35ea8199c585d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9
|