From b576c4d8d52b61e2547a5b9942ea050fa0eece0c Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Mon, 7 Nov 2022 12:24:04 +0900 Subject: [PATCH] tools/flash.sh: Support /dev/ttyUSBX on WSL environment The WSL environment can have "/dev/ttyUSBX" for USB device. So, Use Windows .exe only when UART port is Windows COM port. --- sdk/tools/flash.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sdk/tools/flash.sh b/sdk/tools/flash.sh index 724e0833e..83415be4c 100755 --- a/sdk/tools/flash.sh +++ b/sdk/tools/flash.sh @@ -80,16 +80,6 @@ esac # Exec file extension postfix EXEEXT="" -# WSL/WSL2 detection -if [ "${PLATFORM}" == "linux" ]; then - if [ "$(uname -r | grep -i microsoft)" != "" ]; then - # WSL/WSL2 is a linux but USB related SDK tools - # should use windows binary. - PLATFORM=windows - EXEEXT=".exe" - fi -fi - # Option handler # -b: UART Baudrate (default: 115200) # -c: UART Port (default: /dev/ttyUSB0) @@ -120,6 +110,18 @@ if [ "${UPDATE_ZIP}" != "" ]; then exit fi +# WSL/WSL2 detection +if [ "${PLATFORM}" == "linux" ]; then + if [ "$(uname -r | grep -i microsoft)" != "" ]; then + if [[ "$UART_PORT" == COM* ]]; then + # WSL/WSL2 is a linux but USB related SDK tools + # should use windows binary. + PLATFORM=windows + EXEEXT=".exe" + fi + fi +fi + # Check loader version ${SCRIPT_DIR}/bootloader.py -c