diff --git a/auto-scan.sh b/auto-scan.sh index 68f6f72..2d6e9c0 100755 --- a/auto-scan.sh +++ b/auto-scan.sh @@ -96,11 +96,17 @@ check_dependencies() { # ---------------------------------------------------------------- step 2 wait_for_instrument() { info "Step 2/5: Waiting for i1Pro 2" - while spotread -? 2>&1 | grep -q '\*\* No ports found \*\*'; do + local ports + while true; do + # spotread -? exits 1 (usage), so capture output rather than piping. + ports="$(spotread -? 2>&1 || true)" + if ! grep -q '\*\* No ports found \*\*' <<<"$ports"; then + break + fi echo " No instrument detected. Connect the i1Pro 2 via USB." read -r -p " Press Enter to check again (or Ctrl+C to abort)... " done - spotread -? 2>&1 | grep -E "^\s+[0-9]+ = " | sed 's/^/ Found:/' + grep -E "^\s+[0-9]+ = " <<<"$ports" | sed 's/^/ Found:/' || true } # ---------------------------------------------------------------- step 3+4 diff --git a/measure.sh b/measure.sh index 37c5619..0c8c673 100755 --- a/measure.sh +++ b/measure.sh @@ -18,7 +18,9 @@ if ! command -v spotread >/dev/null 2>&1; then fi echo "Checking for i1Pro..." -if spotread -? 2>&1 | grep -q '\*\* No ports found \*\*'; then +# spotread -? exits 1 (usage), so capture output rather than piping under pipefail. +PORTS="$(spotread -? 2>&1 || true)" +if grep -q '\*\* No ports found \*\*' <<<"$PORTS"; then echo "Error: No USB instrument detected." >&2 echo " 1. Connect the i1Pro 2 via USB" >&2 echo " 2. Run: sudo ./setup-udev.sh" >&2