summaryrefslogtreecommitdiffstats
path: root/lib/python/qmk/flashers.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/flashers.py')
-rw-r--r--lib/python/qmk/flashers.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/python/qmk/flashers.py b/lib/python/qmk/flashers.py
index f83665d9ac..9ecb5e4b9c 100644
--- a/lib/python/qmk/flashers.py
+++ b/lib/python/qmk/flashers.py
@@ -96,7 +96,7 @@ def _find_bootloader():
details = 'halfkay'
else:
details = 'qmk-hid'
- elif bl == 'stm32-dfu' or bl == 'apm32-dfu' or bl == 'gd32v-dfu' or bl == 'kiibohd':
+ elif bl in {'apm32-dfu', 'gd32v-dfu', 'kiibohd', 'stm32-dfu'}:
details = (vid, pid)
else:
details = None
@@ -181,9 +181,18 @@ def _flash_dfu_util(details, file):
cli.run(['dfu-util', '-a', '0', '-d', f'{details[0]}:{details[1]}', '-s', '0x08000000:leave', '-D', file], capture_output=False)
+def _flash_wb32_dfu_updater(file):
+ if shutil.which('wb32-dfu-updater_cli'):
+ cmd = 'wb32-dfu-updater_cli'
+ else:
+ return True
+
+ cli.run([cmd, '-t', '-s', '0x08000000', '-D', file], capture_output=False)
+
+
def _flash_isp(mcu, programmer, file):
programmer = 'usbasp' if programmer == 'usbasploader' else 'usbtiny'
- # Check if the provide mcu has an avrdude-specific name, otherwise pass on what the user provided
+ # Check if the provided mcu has an avrdude-specific name, otherwise pass on what the user provided
mcu = AVRDUDE_MCU.get(mcu, mcu)
cli.run(['avrdude', '-p', mcu, '-c', programmer, '-U', f'flash:w:{file}:i'], capture_output=False)
@@ -211,8 +220,11 @@ def flasher(mcu, file):
return (True, "Please make sure 'teensy_loader_cli' or 'hid_bootloader_cli' is available on your system.")
else:
return (True, "Specifying the MCU with '-m' is necessary for HalfKay/HID bootloaders!")
- elif bl == 'stm32-dfu' or bl == 'apm32-dfu' or bl == 'gd32v-dfu' or bl == 'kiibohd':
+ elif bl in {'apm32-dfu', 'gd32v-dfu', 'kiibohd', 'stm32-dfu'}:
_flash_dfu_util(details, file)
+ elif bl == 'wb32-dfu':
+ if _flash_wb32_dfu_updater(file):
+ return (True, "Please make sure 'wb32-dfu-updater_cli' is available on your system.")
elif bl == 'usbasploader' or bl == 'usbtinyisp':
if mcu:
_flash_isp(mcu, bl, file)