Created
January 13, 2016 16:36
-
-
Save rhaberkorn/beec3f40f0c5883a86a6 to your computer and use it in GitHub Desktop.
metraLine: A minimal UNIX terminal interface to metraTec devices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment