diff --git a/readme.md b/readme.md index a0ac0be8ef..fd50b9fb4e 100644 --- a/readme.md +++ b/readme.md @@ -23,6 +23,7 @@ QMK Toolbox supports the following bootloaders: - BootloadHID (Atmel, PS2AVRGB) via [bootloadHID](https://www.obdev.at/products/vusb/bootloadhid.html) - 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) - 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 482a4f12bd..7a7b18e6c5 100644 --- a/windows/QMK Toolbox/Helpers/EmbeddedResourceHelper.cs +++ b/windows/QMK Toolbox/Helpers/EmbeddedResourceHelper.cs @@ -17,6 +17,7 @@ public static class EmbeddedResourceHelper "bootloadHID.exe", "dfu-programmer.exe", "dfu-util.exe", + "hid_bootloader_cli.exe", "mdloader.exe", "teensy_loader_cli.exe", "libftdi1.dll", diff --git a/windows/QMK Toolbox/MainWindow.cs b/windows/QMK Toolbox/MainWindow.cs index 4d6ebc5f8b..3d996a5d50 100644 --- a/windows/QMK Toolbox/MainWindow.cs +++ b/windows/QMK Toolbox/MainWindow.cs @@ -72,6 +72,7 @@ private void MainWindow_Load(object sender, EventArgs e) logTextBox.LogInfo(" - BootloadHID (Atmel, PS2AVRGB) via bootloadHID (https://www.obdev.at/products/vusb/bootloadhid.html)"); 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(" - 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 883fed7c25..76623d2c09 100644 --- a/windows/QMK Toolbox/QMK Toolbox.csproj +++ b/windows/QMK Toolbox/QMK Toolbox.csproj @@ -118,6 +118,7 @@ + @@ -185,6 +186,7 @@ + diff --git a/windows/QMK Toolbox/Resources/hid_bootloader_cli.exe b/windows/QMK Toolbox/Resources/hid_bootloader_cli.exe new file mode 100644 index 0000000000..f8d62229e4 Binary files /dev/null and b/windows/QMK Toolbox/Resources/hid_bootloader_cli.exe differ diff --git a/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs b/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs index bda27b413a..253e2a56bd 100644 --- a/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs +++ b/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs @@ -10,8 +10,10 @@ public enum BootloaderType Caterina, HalfKay, KiibohdDfu, + LufaHid, LufaMs, QmkDfu, + QmkHid, Stm32Dfu, Stm32Duino, UsbAsp, diff --git a/windows/QMK Toolbox/Usb/Bootloader/LufaHidDevice.cs b/windows/QMK Toolbox/Usb/Bootloader/LufaHidDevice.cs new file mode 100644 index 0000000000..d425d46e4b --- /dev/null +++ b/windows/QMK Toolbox/Usb/Bootloader/LufaHidDevice.cs @@ -0,0 +1,29 @@ +using System.Threading.Tasks; + +namespace QMK_Toolbox.Usb.Bootloader +{ + class LufaHidDevice : BootloaderDevice + { + public LufaHidDevice(UsbDevice d) : base(d) + { + if (d.RevisionBcd == 0x0936) + { + Type = BootloaderType.QmkHid; + Name = "QMK HID"; + } + else + { + Type = BootloaderType.LufaHid; + Name = "LUFA HID"; + } + PreferredDriver = "HidUsb"; + //IsResettable = true; + } + + public async override Task Flash(string mcu, string file) => await RunProcessAsync("hid_bootloader_cli.exe", $"-mmcu={mcu} \"{file}\" -v"); + + // hid_bootloader_cli 210130 lacks -b flag + // Next LUFA release should have it thanks to abcminiuser/lufa#173 + //public async override Task Reset(string mcu) => await RunProcessAsync("hid_bootloader_cli.exe", $"-mmcu={mcu} -bv"); + } +} diff --git a/windows/QMK Toolbox/Usb/UsbListener.cs b/windows/QMK Toolbox/Usb/UsbListener.cs index e2d52ef241..f2a0d92be7 100644 --- a/windows/QMK Toolbox/Usb/UsbListener.cs +++ b/windows/QMK Toolbox/Usb/UsbListener.cs @@ -170,6 +170,9 @@ private static IUsbDevice CreateDevice(ManagementBaseObject d) return new HalfKayDevice(usbDevice); case BootloaderType.KiibohdDfu: return new KiibohdDfuDevice(usbDevice); + case BootloaderType.LufaHid: + case BootloaderType.QmkHid: + return new LufaHidDevice(usbDevice); case BootloaderType.LufaMs: return new LufaMsDevice(usbDevice); case BootloaderType.Stm32Dfu: @@ -194,6 +197,13 @@ private static BootloaderType GetDeviceType(ushort vendorId, ushort productId, u { case 0x2045: return BootloaderType.LufaMs; + case 0x2067: + if (revisionBcd == 0x0936) // Unicode Ψ + { + return BootloaderType.QmkHid; + } + + return BootloaderType.LufaHid; case 0x2FEF: // ATmega16U2 case 0x2FF0: // ATmega32U2 case 0x2FF3: // ATmega16U4