diff options
author | Joel Challis <[email protected]> | 2025-01-10 16:21:07 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2025-01-10 16:21:07 +0000 |
commit | f9430e530b1ba61891990d7c23c78c78e6656a6c (patch) | |
tree | 90efc7d409e9aa824d2d83af9b8b0a291ee6a7bf /lib | |
parent | 9332439d5c9b1d9aefb6060fb78775a1e8bc0d28 (diff) | |
download | qmk_firmware-f9430e530b1ba61891990d7c23c78c78e6656a6c.tar.gz qmk_firmware-f9430e530b1ba61891990d7c23c78c78e6656a6c.zip |
Ensure `qmk flash` rejects invalid files for uf2 compatible bootloaders (#24802)
Ensure 'qmk flash' rejects invalid files for uf2 compatible bootloaders
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/qmk/flashers.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/python/qmk/flashers.py b/lib/python/qmk/flashers.py index 7ee1bc8de7..2cca4941d3 100644 --- a/lib/python/qmk/flashers.py +++ b/lib/python/qmk/flashers.py @@ -202,6 +202,10 @@ def _flash_mdloader(file): def _flash_uf2(file): + output = cli.run(['util/uf2conv.py', '--info', file]).stdout + if 'UF2 File' not in output: + return True + cli.run(['util/uf2conv.py', '--deploy', file], capture_output=False) @@ -235,7 +239,8 @@ def flasher(mcu, file): elif bl == 'md-boot': _flash_mdloader(file) elif bl == '_uf2_compatible_': - _flash_uf2(file) + if _flash_uf2(file): + return (True, "Flashing only supports uf2 format files.") else: return (True, "Known bootloader found but flashing not currently supported!") |