summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLess/Rikki <86894501+lesshonor@users.noreply.github.com>2023-07-07 10:48:45 -0400
committerGitHub <noreply@github.com>2023-07-08 00:48:45 +1000
commita0ea7a6b17026dc15a535053b3f0728dabf6d710 (patch)
tree7539dcf2c74d94f16f54be885d0ca023569b7a23 /lib
parenta8a87a0922a33d38ed80165ee62f9dc35bd08a3d (diff)
feat, docs: WB32 flashing (#21217)
Diffstat (limited to 'lib')
-rw-r--r--lib/python/qmk/constants.py1
-rw-r--r--lib/python/qmk/flashers.py18
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/python/qmk/constants.py b/lib/python/qmk/constants.py
index d987ebaae7..97bd84aa23 100644
--- a/lib/python/qmk/constants.py
+++ b/lib/python/qmk/constants.py
@@ -84,6 +84,7 @@ BOOTLOADER_VIDS_PIDS = {
},
'apm32-dfu': {("314b", "0106")},
'gd32v-dfu': {("28e9", "0189")},
+ 'wb32-dfu': {("342d", "dfa0")},
'bootloadhid': {("16c0", "05df")},
'usbasploader': {("16c0", "05dc")},
'usbtinyisp': {("1782", "0c9f")},
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)