From 0e879acb54913e7a06480f7d311a7836a7f33e07 Mon Sep 17 00:00:00 2001 From: Roger Clark Date: Tue, 7 Apr 2015 08:06:37 +1000 Subject: [PATCH 1/4] Moved stm32flash source to a separate src folder rather than being inside tools/macosx --- .../stm32flash_serial}/src/AUTHORS | 0 .../stm32flash_serial}/src/Android.mk | 0 .../stm32flash => src/stm32flash_serial}/src/HOWTO | 0 .../stm32flash_serial}/src/I2C.txt | 0 .../stm32flash_serial}/src/Makefile | 0 .../stm32flash => src/stm32flash_serial}/src/TODO | 0 .../stm32flash_serial}/src/dev_table.c | 0 .../stm32flash_serial}/src/dev_table.o | Bin .../stm32flash_serial}/src/gpl-2.0.txt | 0 .../stm32flash => src/stm32flash_serial}/src/i2c.c | 0 .../stm32flash => src/stm32flash_serial}/src/i2c.o | Bin .../stm32flash => src/stm32flash_serial}/src/init.c | 0 .../stm32flash => src/stm32flash_serial}/src/init.h | 0 .../stm32flash => src/stm32flash_serial}/src/init.o | Bin .../stm32flash => src/stm32flash_serial}/src/main.c | 0 .../stm32flash => src/stm32flash_serial}/src/main.o | Bin .../stm32flash_serial}/src/parsers/Android.mk | 0 .../stm32flash_serial}/src/parsers/Makefile | 0 .../stm32flash_serial}/src/parsers/binary.c | 0 .../stm32flash_serial}/src/parsers/binary.h | 0 .../stm32flash_serial}/src/parsers/binary.o | Bin .../stm32flash_serial}/src/parsers/hex.c | 0 .../stm32flash_serial}/src/parsers/hex.h | 0 .../stm32flash_serial}/src/parsers/hex.o | Bin .../stm32flash_serial}/src/parsers/parser.h | 0 .../stm32flash_serial}/src/parsers/parsers.a | Bin .../stm32flash => src/stm32flash_serial}/src/port.c | 0 .../stm32flash => src/stm32flash_serial}/src/port.h | 0 .../stm32flash => src/stm32flash_serial}/src/port.o | Bin .../stm32flash_serial}/src/protocol.txt | 0 .../stm32flash_serial}/src/serial.h | 0 .../stm32flash_serial}/src/serial_common.c | 0 .../stm32flash_serial}/src/serial_common.o | Bin .../stm32flash_serial}/src/serial_platform.c | 0 .../stm32flash_serial}/src/serial_platform.o | Bin .../stm32flash_serial}/src/serial_posix.c | 0 .../stm32flash_serial}/src/serial_w32.c | 0 .../stm32flash_serial}/src/stm32.c | 0 .../stm32flash_serial}/src/stm32.h | 0 .../stm32flash_serial}/src/stm32.o | Bin .../stm32flash_serial}/src/stm32flash | Bin .../stm32flash_serial}/src/stm32flash.1 | 0 .../stm32flash_serial}/src/utils.c | 0 .../stm32flash_serial}/src/utils.h | 0 .../stm32flash_serial}/src/utils.o | Bin 45 files changed, 0 insertions(+), 0 deletions(-) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/AUTHORS (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/Android.mk (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/HOWTO (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/I2C.txt (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/Makefile (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/TODO (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/dev_table.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/dev_table.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/gpl-2.0.txt (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/i2c.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/i2c.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/init.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/init.h (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/init.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/main.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/main.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/Android.mk (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/Makefile (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/binary.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/binary.h (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/binary.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/hex.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/hex.h (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/hex.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/parser.h (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/parsers/parsers.a (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/port.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/port.h (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/port.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/protocol.txt (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/serial.h (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/serial_common.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/serial_common.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/serial_platform.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/serial_platform.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/serial_posix.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/serial_w32.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/stm32.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/stm32.h (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/stm32.o (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/stm32flash (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/stm32flash.1 (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/utils.c (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/utils.h (100%) rename tools/{macosx/stm32flash => src/stm32flash_serial}/src/utils.o (100%) diff --git a/tools/macosx/stm32flash/src/AUTHORS b/tools/src/stm32flash_serial/src/AUTHORS similarity index 100% rename from tools/macosx/stm32flash/src/AUTHORS rename to tools/src/stm32flash_serial/src/AUTHORS diff --git a/tools/macosx/stm32flash/src/Android.mk b/tools/src/stm32flash_serial/src/Android.mk similarity index 100% rename from tools/macosx/stm32flash/src/Android.mk rename to tools/src/stm32flash_serial/src/Android.mk diff --git a/tools/macosx/stm32flash/src/HOWTO b/tools/src/stm32flash_serial/src/HOWTO similarity index 100% rename from tools/macosx/stm32flash/src/HOWTO rename to tools/src/stm32flash_serial/src/HOWTO diff --git a/tools/macosx/stm32flash/src/I2C.txt b/tools/src/stm32flash_serial/src/I2C.txt similarity index 100% rename from tools/macosx/stm32flash/src/I2C.txt rename to tools/src/stm32flash_serial/src/I2C.txt diff --git a/tools/macosx/stm32flash/src/Makefile b/tools/src/stm32flash_serial/src/Makefile similarity index 100% rename from tools/macosx/stm32flash/src/Makefile rename to tools/src/stm32flash_serial/src/Makefile diff --git a/tools/macosx/stm32flash/src/TODO b/tools/src/stm32flash_serial/src/TODO similarity index 100% rename from tools/macosx/stm32flash/src/TODO rename to tools/src/stm32flash_serial/src/TODO diff --git a/tools/macosx/stm32flash/src/dev_table.c b/tools/src/stm32flash_serial/src/dev_table.c similarity index 100% rename from tools/macosx/stm32flash/src/dev_table.c rename to tools/src/stm32flash_serial/src/dev_table.c diff --git a/tools/macosx/stm32flash/src/dev_table.o b/tools/src/stm32flash_serial/src/dev_table.o similarity index 100% rename from tools/macosx/stm32flash/src/dev_table.o rename to tools/src/stm32flash_serial/src/dev_table.o diff --git a/tools/macosx/stm32flash/src/gpl-2.0.txt b/tools/src/stm32flash_serial/src/gpl-2.0.txt similarity index 100% rename from tools/macosx/stm32flash/src/gpl-2.0.txt rename to tools/src/stm32flash_serial/src/gpl-2.0.txt diff --git a/tools/macosx/stm32flash/src/i2c.c b/tools/src/stm32flash_serial/src/i2c.c similarity index 100% rename from tools/macosx/stm32flash/src/i2c.c rename to tools/src/stm32flash_serial/src/i2c.c diff --git a/tools/macosx/stm32flash/src/i2c.o b/tools/src/stm32flash_serial/src/i2c.o similarity index 100% rename from tools/macosx/stm32flash/src/i2c.o rename to tools/src/stm32flash_serial/src/i2c.o diff --git a/tools/macosx/stm32flash/src/init.c b/tools/src/stm32flash_serial/src/init.c similarity index 100% rename from tools/macosx/stm32flash/src/init.c rename to tools/src/stm32flash_serial/src/init.c diff --git a/tools/macosx/stm32flash/src/init.h b/tools/src/stm32flash_serial/src/init.h similarity index 100% rename from tools/macosx/stm32flash/src/init.h rename to tools/src/stm32flash_serial/src/init.h diff --git a/tools/macosx/stm32flash/src/init.o b/tools/src/stm32flash_serial/src/init.o similarity index 100% rename from tools/macosx/stm32flash/src/init.o rename to tools/src/stm32flash_serial/src/init.o diff --git a/tools/macosx/stm32flash/src/main.c b/tools/src/stm32flash_serial/src/main.c similarity index 100% rename from tools/macosx/stm32flash/src/main.c rename to tools/src/stm32flash_serial/src/main.c diff --git a/tools/macosx/stm32flash/src/main.o b/tools/src/stm32flash_serial/src/main.o similarity index 100% rename from tools/macosx/stm32flash/src/main.o rename to tools/src/stm32flash_serial/src/main.o diff --git a/tools/macosx/stm32flash/src/parsers/Android.mk b/tools/src/stm32flash_serial/src/parsers/Android.mk similarity index 100% rename from tools/macosx/stm32flash/src/parsers/Android.mk rename to tools/src/stm32flash_serial/src/parsers/Android.mk diff --git a/tools/macosx/stm32flash/src/parsers/Makefile b/tools/src/stm32flash_serial/src/parsers/Makefile similarity index 100% rename from tools/macosx/stm32flash/src/parsers/Makefile rename to tools/src/stm32flash_serial/src/parsers/Makefile diff --git a/tools/macosx/stm32flash/src/parsers/binary.c b/tools/src/stm32flash_serial/src/parsers/binary.c similarity index 100% rename from tools/macosx/stm32flash/src/parsers/binary.c rename to tools/src/stm32flash_serial/src/parsers/binary.c diff --git a/tools/macosx/stm32flash/src/parsers/binary.h b/tools/src/stm32flash_serial/src/parsers/binary.h similarity index 100% rename from tools/macosx/stm32flash/src/parsers/binary.h rename to tools/src/stm32flash_serial/src/parsers/binary.h diff --git a/tools/macosx/stm32flash/src/parsers/binary.o b/tools/src/stm32flash_serial/src/parsers/binary.o similarity index 100% rename from tools/macosx/stm32flash/src/parsers/binary.o rename to tools/src/stm32flash_serial/src/parsers/binary.o diff --git a/tools/macosx/stm32flash/src/parsers/hex.c b/tools/src/stm32flash_serial/src/parsers/hex.c similarity index 100% rename from tools/macosx/stm32flash/src/parsers/hex.c rename to tools/src/stm32flash_serial/src/parsers/hex.c diff --git a/tools/macosx/stm32flash/src/parsers/hex.h b/tools/src/stm32flash_serial/src/parsers/hex.h similarity index 100% rename from tools/macosx/stm32flash/src/parsers/hex.h rename to tools/src/stm32flash_serial/src/parsers/hex.h diff --git a/tools/macosx/stm32flash/src/parsers/hex.o b/tools/src/stm32flash_serial/src/parsers/hex.o similarity index 100% rename from tools/macosx/stm32flash/src/parsers/hex.o rename to tools/src/stm32flash_serial/src/parsers/hex.o diff --git a/tools/macosx/stm32flash/src/parsers/parser.h b/tools/src/stm32flash_serial/src/parsers/parser.h similarity index 100% rename from tools/macosx/stm32flash/src/parsers/parser.h rename to tools/src/stm32flash_serial/src/parsers/parser.h diff --git a/tools/macosx/stm32flash/src/parsers/parsers.a b/tools/src/stm32flash_serial/src/parsers/parsers.a similarity index 100% rename from tools/macosx/stm32flash/src/parsers/parsers.a rename to tools/src/stm32flash_serial/src/parsers/parsers.a diff --git a/tools/macosx/stm32flash/src/port.c b/tools/src/stm32flash_serial/src/port.c similarity index 100% rename from tools/macosx/stm32flash/src/port.c rename to tools/src/stm32flash_serial/src/port.c diff --git a/tools/macosx/stm32flash/src/port.h b/tools/src/stm32flash_serial/src/port.h similarity index 100% rename from tools/macosx/stm32flash/src/port.h rename to tools/src/stm32flash_serial/src/port.h diff --git a/tools/macosx/stm32flash/src/port.o b/tools/src/stm32flash_serial/src/port.o similarity index 100% rename from tools/macosx/stm32flash/src/port.o rename to tools/src/stm32flash_serial/src/port.o diff --git a/tools/macosx/stm32flash/src/protocol.txt b/tools/src/stm32flash_serial/src/protocol.txt similarity index 100% rename from tools/macosx/stm32flash/src/protocol.txt rename to tools/src/stm32flash_serial/src/protocol.txt diff --git a/tools/macosx/stm32flash/src/serial.h b/tools/src/stm32flash_serial/src/serial.h similarity index 100% rename from tools/macosx/stm32flash/src/serial.h rename to tools/src/stm32flash_serial/src/serial.h diff --git a/tools/macosx/stm32flash/src/serial_common.c b/tools/src/stm32flash_serial/src/serial_common.c similarity index 100% rename from tools/macosx/stm32flash/src/serial_common.c rename to tools/src/stm32flash_serial/src/serial_common.c diff --git a/tools/macosx/stm32flash/src/serial_common.o b/tools/src/stm32flash_serial/src/serial_common.o similarity index 100% rename from tools/macosx/stm32flash/src/serial_common.o rename to tools/src/stm32flash_serial/src/serial_common.o diff --git a/tools/macosx/stm32flash/src/serial_platform.c b/tools/src/stm32flash_serial/src/serial_platform.c similarity index 100% rename from tools/macosx/stm32flash/src/serial_platform.c rename to tools/src/stm32flash_serial/src/serial_platform.c diff --git a/tools/macosx/stm32flash/src/serial_platform.o b/tools/src/stm32flash_serial/src/serial_platform.o similarity index 100% rename from tools/macosx/stm32flash/src/serial_platform.o rename to tools/src/stm32flash_serial/src/serial_platform.o diff --git a/tools/macosx/stm32flash/src/serial_posix.c b/tools/src/stm32flash_serial/src/serial_posix.c similarity index 100% rename from tools/macosx/stm32flash/src/serial_posix.c rename to tools/src/stm32flash_serial/src/serial_posix.c diff --git a/tools/macosx/stm32flash/src/serial_w32.c b/tools/src/stm32flash_serial/src/serial_w32.c similarity index 100% rename from tools/macosx/stm32flash/src/serial_w32.c rename to tools/src/stm32flash_serial/src/serial_w32.c diff --git a/tools/macosx/stm32flash/src/stm32.c b/tools/src/stm32flash_serial/src/stm32.c similarity index 100% rename from tools/macosx/stm32flash/src/stm32.c rename to tools/src/stm32flash_serial/src/stm32.c diff --git a/tools/macosx/stm32flash/src/stm32.h b/tools/src/stm32flash_serial/src/stm32.h similarity index 100% rename from tools/macosx/stm32flash/src/stm32.h rename to tools/src/stm32flash_serial/src/stm32.h diff --git a/tools/macosx/stm32flash/src/stm32.o b/tools/src/stm32flash_serial/src/stm32.o similarity index 100% rename from tools/macosx/stm32flash/src/stm32.o rename to tools/src/stm32flash_serial/src/stm32.o diff --git a/tools/macosx/stm32flash/src/stm32flash b/tools/src/stm32flash_serial/src/stm32flash similarity index 100% rename from tools/macosx/stm32flash/src/stm32flash rename to tools/src/stm32flash_serial/src/stm32flash diff --git a/tools/macosx/stm32flash/src/stm32flash.1 b/tools/src/stm32flash_serial/src/stm32flash.1 similarity index 100% rename from tools/macosx/stm32flash/src/stm32flash.1 rename to tools/src/stm32flash_serial/src/stm32flash.1 diff --git a/tools/macosx/stm32flash/src/utils.c b/tools/src/stm32flash_serial/src/utils.c similarity index 100% rename from tools/macosx/stm32flash/src/utils.c rename to tools/src/stm32flash_serial/src/utils.c diff --git a/tools/macosx/stm32flash/src/utils.h b/tools/src/stm32flash_serial/src/utils.h similarity index 100% rename from tools/macosx/stm32flash/src/utils.h rename to tools/src/stm32flash_serial/src/utils.h diff --git a/tools/macosx/stm32flash/src/utils.o b/tools/src/stm32flash_serial/src/utils.o similarity index 100% rename from tools/macosx/stm32flash/src/utils.o rename to tools/src/stm32flash_serial/src/utils.o From 0e318d746d035593e2cf536b89327ee3c29ca347 Mon Sep 17 00:00:00 2001 From: Roger Clark Date: Tue, 7 Apr 2015 08:15:22 +1000 Subject: [PATCH 2/4] Added texane-stlink to tools src folder. Note. This was easier than moving it from the old location under macosx. I will remove the one under macosx once the new one is definately committed --- .gitmodules | 3 +++ tools/src/texane-stlink | 1 + 2 files changed, 4 insertions(+) create mode 160000 tools/src/texane-stlink diff --git a/.gitmodules b/.gitmodules index a162e99..a7eba26 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "drivers/win/src/pbatard_libwdi"] path = drivers/win/src/pbatard_libwdi url = https://github.com/pbatard/libwdi.git +[submodule "tools/src/texane-stlink"] + path = tools/src/texane-stlink + url = https://github.com/texane/stlink diff --git a/tools/src/texane-stlink b/tools/src/texane-stlink new file mode 160000 index 0000000..1b46200 --- /dev/null +++ b/tools/src/texane-stlink @@ -0,0 +1 @@ +Subproject commit 1b46200b12ff8764a869a7365eb8253622100fed From 8b3b13680e0149f6212280ae640135f48fd43e03 Mon Sep 17 00:00:00 2001 From: Roger Clark Date: Tue, 7 Apr 2015 08:17:21 +1000 Subject: [PATCH 3/4] Attempted to set execut permissions on upload_router on linux, from OSX --- tools/linux/upload_router | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/linux/upload_router diff --git a/tools/linux/upload_router b/tools/linux/upload_router old mode 100644 new mode 100755 From 7abe8ebdbf67cb5149d3779c4d29d3dd0f3544e5 Mon Sep 17 00:00:00 2001 From: Roger Clark Date: Tue, 7 Apr 2015 08:50:06 +1000 Subject: [PATCH 4/4] Updated linux upload router with version from @ahull --- tools/linux/upload_router | 85 +++++++++++++++++++++++++++++---------- 1 file changed, 64 insertions(+), 21 deletions(-) diff --git a/tools/linux/upload_router b/tools/linux/upload_router index dbda037..b74244d 100755 --- a/tools/linux/upload_router +++ b/tools/linux/upload_router @@ -1,4 +1,3 @@ - #!/bin/bash # Translates the windows Arduino IDE upload call - something like.. # @@ -9,6 +8,27 @@ # dfu-util -D ./STM32_Blink.cpp.bin -d 1eaf:0003 --intf 0 --alt 1 # # + +function leaf_status() +{ + +this_leaf_status=$(lsusb |grep "1eaf" | awk '{ print $NF}') +# Find the mode of the leaf bootloader +case $this_leaf_status in + "1eaf:0003") + echo "dfu" + ;; + "1eaf:0004") + echo "ttyACMx" + ;; + *) + #echo "$this_leaf_status" + echo "unknown" + ;; +esac +} + + DEVICE="$3" # Lowercase the 1eaf device name, since in Windows land everybody shouts. DEVICE=${DEVICE,,} @@ -17,30 +37,57 @@ BINFILE="$4.bin" INTERFACE="$6" ALT_INTERFACE="$2" +# You will need the usb-reset code, see https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Using-a-generic-stm32-board-on-linux-with-Maple-bootloader +# USBRESET=$(which usb-reset) || USBRESET="./usb-reset" -echo -e "\n\rPlease unplug and replug the USB cable to the STB device..." + +# Check to see if a maple compatible board is attached +LEAF_STATUS=$(leaf_status) + +# Borard not found, or no boot loader on board. +if [[ $(leaf_status) = "unknown" ]] +then + echo "STM32 Maple Bootloader compatible board not found." + sleep 5 + exit 1 +fi + +# We got this far, so we need to get the board in bootloader mode. +# After the timeout period, the board goes back in to serial mode, we need it in dfu mode, which happens for the first few seconds at power on +# so we ask the user to unplug and re-plug the board. +echo -e "\n\rSTM32 Maple board is in $LEAF_STATUS mode." + +echo "Please unplug and replug the USB cable to the Maple device." sleep 2 -while [[ $(lsusb |grep -i "1eaf") ]] +# On unplugging the board will be "unknown" +while [[ $(leaf_status) != "unknown" ]] +do + echo -n "." + sleep 1 +done +# On re-plugging the board will be "dfu" +while [[ $(leaf_status) != "dfu" ]] +do + echo -n "." + sleep 1 +done + +echo -e "\n\rProgramming STM32 device with dfu-util" +until dfu-util -D "$BINFILE" -d "$DEVICE" --intf "$INTERFACE" --alt "$ALT_INTERFACE" 2>&1 do echo -n "." sleep 1 done -until dfu-util -v -D "$BINFILE" -d "$DEVICE" --intf "$INTERFACE" --alt "$ALT_INTERFACE" -do - echo -n "." - sleep 1 -done - -echo -e "\n\rUnplug and replug the USB cable to the STM board again please...." -while [[ $(lsusb |grep -i "1eaf\:0003") ]] +echo -e "\n\rUnplug and replug the USB cable to the STM32 board again please...." +while [[ $(leaf_status) != "unknown" ]] do echo -n "." sleep 1 done echo -e "\n\rReconnecting" -while [ -z "$(lsusb |grep -i "1eaf\:0003")" ] +while [[ $(leaf_status) = "unknown" ]] do echo -n "." sleep 1 @@ -53,17 +100,13 @@ do sleep 1 done - "$USBRESET" "/dev/bus/usb/$(lsusb |grep "1eaf" |awk '{print $2,$4}'|sed 's/\://g'|sed 's/ /\//g')" >/dev/null 2>&1 -for i in {1..4} + +while [[ $(leaf_status) = "unknown" ]] do echo -n "." sleep 1 done - -echo -e "\n\rSerial port re-created... $(ls "/dev/ttyACM"*)\n\r" -for i in {1..4} -do - echo -n "." - sleep 1 -done \ No newline at end of file +THIS_TTY=$(find /dev/ttyACM* -cmin -2) +echo -e "\n\rSTM32 Maple board serial port re-created..." +echo -e "\n\rSerial port is $THIS_TTY Please allow 15 seconds before attempting to read from serial port."