@@ -0,0 +1,347 @@
+#!/usr/bin/env python%0A# coding=utf8%0A%0A# http://stackoverflow.com/a/15095449/706819%0A%0Aimport os%0Aimport pty%0A%0Adef print_serial():%0A%09master, slave = pty.openpty()%0A%09tty_name = os.ttyname(slave)%0A%0A%09print(%22Write serial data to %7B%7D%5CnCtrl-C to exit%5Cn%5Cn%22.format(tty_name))%0A%0A%09while True:%0A%09%09print(os.read(master, 1024))%0A%0Aif __name__ == '__main__':%0A%09print_serial()%0A

Add debug util to listen on a tty and print input