From 585e0bcb012a6008af7d4a5ce6c694f78b936092 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Sun, 12 Jun 2016 06:37:30 +0200 Subject: better lufa detect and reset --- tools/reset_lufa_cdc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'tools/reset_lufa_cdc') diff --git a/tools/reset_lufa_cdc b/tools/reset_lufa_cdc index 09cc8cb..6529884 100755 --- a/tools/reset_lufa_cdc +++ b/tools/reset_lufa_cdc @@ -1,15 +1,16 @@ -#!/bin/bash +#!/bin/zsh --multios +#(c) Bernhard Tittelbach -DEVICE_FILE="/dev/ttyACM0" +LUFA_CDC_DEVS=($(${0:h}/detect_lufa_cdc)) -if [ -c $DEVICE_FILE ]; then - echo "resetting device .." - echo $1 > /dev/ttyACM0 +if [[ ${#LUFA_CDC_DEVS} -gt 0 ]]; then + echo "resetting device(s) $LUFA_CDC_DEVS ..." + echo $1 > ${LUFA_CDC_DEVS} - echo "waiting for device to enumerate .." - sleep 4 + echo "waiting for device to enumerate .." + sleep 3 else - echo "'$DEVICE_FILE' not found ... device is probably already in bootloader mode - doing nothing" + echo "LUFA ttyACMs not found ... device is probably already in bootloader mode - doing nothing" fi exit 0 -- cgit v1.2.3