Skip to content

Commit

Permalink
tools/flash.sh: Support /dev/ttyUSBX on WSL environment
Browse files Browse the repository at this point in the history
The WSL environment can have "/dev/ttyUSBX" for USB device.
So, Use Windows .exe only when UART port is Windows COM port.
  • Loading branch information
SPRESENSE committed Nov 15, 2022
1 parent edc96e9 commit b576c4d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions sdk/tools/flash.sh
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit b576c4d

Please sign in to comment.