Neocon simple (multi-)serial console utility

If you ever got bugged by the fact of lost traces from a starting bootloader’s serial output or a missing last Arduino’s will before deep sleep, you might consider using this handy serial console tool. Despite of having been developed for/during Neo (by OpenMoko) ten years ago, it remains a universal serial tool with a precious developer feature. Thanks, Werner Almesberger.

About

“neocon” is a simple serial console utility that tries to open a “ttys” device that may exist on a system until one such open succeeds.

It then passes terminal input and output, until there is a read or write failure on the tty, in which case it disconnects, and the process restarts.

This is mainly intended for serial over USB interfaces that disappear when the Neo or debug board is restarted. E.g., neocon /dev/ttyUSB0 /dev/ttyUSB1

[…]

http://svn.openmoko.org/developers/werner/neocon/

Usage

neocon [-b bps] [-e escape] [-l logfile [-a] [-T]] [-t delay_ms] tty ...

  -a           append to the log file if it already exists
  -b bps       set the TTY to the specified bit rate
  -e escape    set the escape character (default: ~)
  -l logfile   log all output to the specified file
  -t delay_ms  wait the specified amount of time between input characters
  -T           add timestamps to the log file

default escape: ~.
if multiple serials or a range is issued (explicit or glob), switch to next: ~n

Usage examples

  • trivial:

    neocon -b 19200 /dev/ttyUSB5

  • use sysfs paths for improved re-enumeration behaviour and a glob for multiple devices:

    neocon -b 115200 /dev/serial/by-path/pci-0000:00:12.0-usb-0:4.1.2.{2,3,5,6}:1.2-port0

Recent repository

Some more baud rates have been added meanwhile, but still a single c file and a 16-lines Makefile.