From c99aac3a2d4073b44a30034099f9f5cfa44be70e Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Fri, 30 Oct 2015 05:09:06 -0700 Subject: [PATCH] Missed adding adtpro-start to source tree --- setup/adtpro-start.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 setup/adtpro-start.txt diff --git a/setup/adtpro-start.txt b/setup/adtpro-start.txt new file mode 100644 index 0000000..2996a1c --- /dev/null +++ b/setup/adtpro-start.txt @@ -0,0 +1,33 @@ +#!/bin/bash + +# don't do anything if ADTPro is already running +if [[ $(ps aux | grep [A]DTPro) ]]; then + + 1&>2 echo "ADTPro server is already running." + +else + + # look for eligible USB-to-serial adapter + ttyUSB= + # if lower USB port + if [[ -c /dev/ttyUSBlower ]]; then + ttyUSB=ttyUSBlower + # if hub in lower port, use lowest numbered port on hub + elif [[ $(ls -1 /dev/ttyUSBlower_hub* 2> /dev/null | wc -l) -gt 0 ]]; then + ttyUSB=$(ls -1 /dev/ttyUSBlower_hub* 2> /dev/null | head -1 | cut -c 6-) + # if hub in upper port with multiple adapters, use lowest numbered port on hub + elif [[ $(ls -1 /dev/ttyUSBupper_hub* 2> /dev/null | wc -l) -gt 1 ]]; then + ttyUSB=$(ls -1 /dev/ttyUSBupper_hub* 2> /dev/null | head -1 | cut -c 6-) + fi + + if [[ $ttyUSB ]]; then + echo -n "Please wait..." + sudo nohup adtpro.sh headless serial &> /dev/null + echo "ok." + else + 1>&2 echo "No USB-to-serial adapter found in the lower USB port, or" + 1>&2 echo " a hub on the lower USB port, or the lowest-numbered port" + 1>&2 echo " of a hub on the upper USB port. Not starting ADTPro server." + fi + +fi \ No newline at end of file