diff --git a/tools/xiao_serial_dfu.sh b/tools/xiao_serial_dfu.sh index 3d526646..325399c5 100755 --- a/tools/xiao_serial_dfu.sh +++ b/tools/xiao_serial_dfu.sh @@ -7,7 +7,8 @@ # # firmware.zip the DFU package (.pio/build//firmware.zip, or a release # asset *.zip) -# usb-serial the board's USB serial number (matched in /dev/serial/by-id) +# usb-serial the board's USB serial number (matched in /dev/serial/by-id), +# or its name/alias in the local config # board its name for serial_cli.py (local config, tools/mctools_config.py) # # NRF= directory holding tool-adafruit-nrfutil @@ -34,6 +35,8 @@ esac exit 2 } ZIP=$1 SN=$2 BOARD=$3 +# a board name/alias of the local config -> its USB serial; a serial passes through +SN="$(python3 "$(dirname "$0")/mctools_config.py" serial "$SN" 2>/dev/null || echo "$SN")" WHY="$(python3 "$(dirname "$0")/mctools_config.py" get "$SN" refuse 2>/dev/null || true)" [ -z "$WHY" ] || { echo "refused: $WHY" >&2