From c98dfda4d5ede04a5a821e0127585bc0ad564ab4 Mon Sep 17 00:00:00 2001 From: Neville Dalal Date: Wed, 31 Oct 2018 20:37:36 +0000 Subject: [PATCH] Detect OS and use appropriate device and tooling Signed-off-by: Neville Dalal --- bin/focus-test | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/bin/focus-test b/bin/focus-test index dc8cef81..c235c154 100755 --- a/bin/focus-test +++ b/bin/focus-test @@ -15,9 +15,23 @@ set -e -DEVICE="${DEVICE:-/dev/ttyACM0}" +OS=$(uname -s) + +case ${OS} in + Linux) + DEVICE="${DEVICE:-/dev/ttyACM0}" + stty -F "${DEVICE}" 9600 raw -echo + ;; + Darwin) + DEVICE="${DEVICE:-/dev/cu.usbmodemCkbio01E}" + stty -f "${DEVICE}" 9600 raw -echo + ;; + *) + echo "Error Unknown OS : ${OS}" >&2 + exit 1 + ;; +esac -stty -F "${DEVICE}" 9600 raw -echo exec 3<"${DEVICE}" echo "$@" >"${DEVICE}"