#!/bin/sh # A minimal UNIX terminal interface to Metratec devices # Requirements: socat, rlwrap # To connect using a FTDI serial device node # (requires the `ftdi_sio` driver or a native COM/UART port), e.g.: metraLine /dev/ttyUSB0 # To connect to a product with builtin ethernet via TCP, e.g.: metraLine 192.168.2.239 if [ -c $1 ]; then # Assume $1 to be a serial device node ADDRESS=FILE:$1,nonblock,raw,echo=0,b115200,cs8 else # Assume $1 to be an IP and $2 to be an optional port ADDRESS=TCP:$1:${2:-10001} fi rlwrap -rS "> " socat $ADDRESS,cr STDOUT