Skip to content

Commit

Permalink
Ensure qmk flash rejects invalid files for uf2 compatible bootloade…
Browse files Browse the repository at this point in the history
…rs (#24802)

Ensure 'qmk flash' rejects invalid files for uf2 compatible bootloaders
  • Loading branch information
zvecr authored Jan 10, 2025
1 parent 9332439 commit f9430e5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/python/qmk/flashers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -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!")

Expand Down

0 comments on commit f9430e5

Please sign in to comment.