From ad9e7cd5117c965222aae708f660e56d537914fc Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 6 Oct 2025 00:48:48 +0300 Subject: imported all of my Github gists from https://gist.github.com/rhaberkorn --- metraLine.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 metraLine.sh (limited to 'metraLine.sh') diff --git a/metraLine.sh b/metraLine.sh new file mode 100755 index 0000000..09af9e9 --- /dev/null +++ b/metraLine.sh @@ -0,0 +1,16 @@ +#!/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 -- cgit v1.2.3