blob: 09af9e982b7d3ac02896bd4b85041bb96b256732 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
|