Skip to main content

Utility to duplicate a tty for logging purposes

Project description

PyPI version Python versions See Build Status on AppVeyor

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

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

python-tty-duplicator-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file python-tty-duplicator-0.1.0.tar.gz.

File metadata

  • Download URL: python-tty-duplicator-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for python-tty-duplicator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ece9e02862f41be03c784baca0bec0ca43c9306c41cf18d57f0b7ce35eff380b
MD5 fa13ce3072fa621beed0f45667d98edf
BLAKE2b-256 a4065c905d83874fd33165277ab5b64a79a37f6c7847dc8bcc35ea8199c585d7

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