diff --git a/readme.md b/readme.md index f389454f56..44b548de88 100644 --- a/readme.md +++ b/readme.md @@ -24,6 +24,7 @@ QMK Toolbox supports the following bootloaders: - Caterina (Arduino, Pro Micro) via [avrdude](http://nongnu.org/avrdude/) - HalfKay (Teensy, Ergodox EZ) via [Teensy Loader](https://pjrc.com/teensy/loader_cli.html) - LUFA/QMK HID via [hid_bootloader_cli](https://github.com/abcminiuser/lufa) + - WB32 DFU (WB32) via [wb32-dfu-updater_cli](https://github.com/WestberryTech/wb32-dfu-updater) - LUFA Mass Storage And the following ISP flashers: diff --git a/windows/QMK Toolbox/Helpers/EmbeddedResourceHelper.cs b/windows/QMK Toolbox/Helpers/EmbeddedResourceHelper.cs index 7a7b18e6c5..360d8c530c 100644 --- a/windows/QMK Toolbox/Helpers/EmbeddedResourceHelper.cs +++ b/windows/QMK Toolbox/Helpers/EmbeddedResourceHelper.cs @@ -20,6 +20,7 @@ public static class EmbeddedResourceHelper "hid_bootloader_cli.exe", "mdloader.exe", "teensy_loader_cli.exe", + "wb32-dfu-updater_cli.exe", "libftdi1.dll", "libusb0.dll", "libusb-0-1-4.dll", diff --git a/windows/QMK Toolbox/MainWindow.cs b/windows/QMK Toolbox/MainWindow.cs index 17d4706e6b..5e9de5c2f8 100644 --- a/windows/QMK Toolbox/MainWindow.cs +++ b/windows/QMK Toolbox/MainWindow.cs @@ -70,6 +70,7 @@ private void MainWindow_Load(object sender, EventArgs e) logTextBox.LogInfo(" - Caterina (Arduino, Pro Micro) via avrdude (http://nongnu.org/avrdude/)"); logTextBox.LogInfo(" - HalfKay (Teensy, Ergodox EZ) via Teensy Loader (https://pjrc.com/teensy/loader_cli.html)"); logTextBox.LogInfo(" - LUFA/QMK HID via hid_bootloader_cli (https://github.com/abcminiuser/lufa)"); + logTextBox.LogInfo(" - WB32 DFU via wb32-dfu-updater_cli (https://github.com/WestberryTech/wb32-dfu-updater)"); logTextBox.LogInfo(" - LUFA Mass Storage"); logTextBox.LogInfo("Supported ISP flashers:"); logTextBox.LogInfo(" - AVRISP (Arduino ISP)"); diff --git a/windows/QMK Toolbox/QMK Toolbox.csproj b/windows/QMK Toolbox/QMK Toolbox.csproj index 1f34a744b4..cbf45f2113 100644 --- a/windows/QMK Toolbox/QMK Toolbox.csproj +++ b/windows/QMK Toolbox/QMK Toolbox.csproj @@ -123,6 +123,7 @@ + @@ -189,6 +190,7 @@ + diff --git a/windows/QMK Toolbox/Resources/drivers.txt b/windows/QMK Toolbox/Resources/drivers.txt index 1f6c67c4c5..be579f9ca3 100644 --- a/windows/QMK Toolbox/Resources/drivers.txt +++ b/windows/QMK Toolbox/Resources/drivers.txt @@ -5,6 +5,7 @@ # Use Windows Powershell and type [guid]::NewGuid() to generate guids winusb,STM32 Bootloader,0483,DF11,6d98a87f-4ecf-464d-89ed-8c684d857a75 winusb,APM32 Bootloader,314B,0106,9ff3cc31-6772-4a3f-a492-a80d91f7a853 +winusb,WB32 Bootloader,342D,DFA0,89b0fdf0-3d22-4408-8393-32147ba508ce winusb,STM32duino Bootloader,1EAF,0003,746915ec-99d8-4a90-a722-3c85ba31e4fe libusbk,USBaspLoader,16C0,05DC,e69affdc-0ef0-427c-aefb-4e593c9d2724 winusb,Kiibohd DFU Bootloader,1C11,B007,aa5a3f86-b81e-4416-89ad-0c1ea1ed63af diff --git a/windows/QMK Toolbox/Resources/wb32-dfu-updater_cli.exe b/windows/QMK Toolbox/Resources/wb32-dfu-updater_cli.exe new file mode 100644 index 0000000000..ecf330f418 Binary files /dev/null and b/windows/QMK Toolbox/Resources/wb32-dfu-updater_cli.exe differ diff --git a/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs b/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs index 253e2a56bd..7f946e1e13 100644 --- a/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs +++ b/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs @@ -18,6 +18,7 @@ public enum BootloaderType Stm32Duino, UsbAsp, UsbTinyIsp, + Wb32Dfu, None } } diff --git a/windows/QMK Toolbox/Usb/Bootloader/Wb32DfuDevice.cs b/windows/QMK Toolbox/Usb/Bootloader/Wb32DfuDevice.cs new file mode 100644 index 0000000000..c7322c4272 --- /dev/null +++ b/windows/QMK Toolbox/Usb/Bootloader/Wb32DfuDevice.cs @@ -0,0 +1,34 @@ +using System.IO; +using System.Threading.Tasks; + +namespace QMK_Toolbox.Usb.Bootloader +{ + class Wb32DfuDevice : BootloaderDevice + { + public Wb32DfuDevice(UsbDevice d) : base(d) + { + Type = BootloaderType.Wb32Dfu; + Name = "WB32 DFU"; + PreferredDriver = "WinUSB"; + IsResettable = true; + } + + public async override Task Flash(string mcu, string file) + { + if (Path.GetExtension(file)?.ToLower() == ".bin") + { + await RunProcessAsync("wb32-dfu-updater_cli.exe", $"--toolbox-mode --dfuse-address 0x08000000 --download \"{file}\""); + } + else if (Path.GetExtension(file)?.ToLower() == ".hex") + { + await RunProcessAsync("wb32-dfu-updater_cli.exe", $"--toolbox-mode --download \"{file}\""); + } + else + { + PrintMessage("Only firmware files in .bin or .hex format can be flashed with wb32-dfu-updater_cli!", MessageType.Error); + } + } + + public async override Task Reset(string mcu) => await RunProcessAsync("wb32-dfu-updater_cli.exe", $"--reset"); + } +} diff --git a/windows/QMK Toolbox/Usb/UsbListener.cs b/windows/QMK Toolbox/Usb/UsbListener.cs index f2a0d92be7..0dcf5ee9bd 100644 --- a/windows/QMK Toolbox/Usb/UsbListener.cs +++ b/windows/QMK Toolbox/Usb/UsbListener.cs @@ -183,6 +183,8 @@ private static IUsbDevice CreateDevice(ManagementBaseObject d) return new UsbAspDevice(usbDevice); case BootloaderType.UsbTinyIsp: return new UsbTinyIspDevice(usbDevice); + case BootloaderType.Wb32Dfu: + return new Wb32DfuDevice(usbDevice); } return usbDevice; @@ -303,6 +305,12 @@ private static BootloaderType GetDeviceType(ushort vendorId, ushort productId, u return BootloaderType.Apm32Dfu; } break; + case 0x342D: // WestBerryTech + if (productId == 0xDFA0) + { + return BootloaderType.Wb32Dfu; + } + break; } return BootloaderType.None;