Skip to content

Salamandar/python-tty-duplicator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-tty-duplicator

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

About

TTY duplicator that allows logging (socat wrapper)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages