aboutsummaryrefslogtreecommitdiff
path: root/metraLine.sh
diff options
context:
space:
mode:
Diffstat (limited to 'metraLine.sh')
-rwxr-xr-xmetraLine.sh16
1 files changed, 16 insertions, 0 deletions
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