diff --git a/macos/QMK Toolbox.xcodeproj/project.pbxproj b/macos/QMK Toolbox.xcodeproj/project.pbxproj index 3961abd8dd..5748a70e58 100644 --- a/macos/QMK Toolbox.xcodeproj/project.pbxproj +++ b/macos/QMK Toolbox.xcodeproj/project.pbxproj @@ -23,10 +23,12 @@ 09D79CBC1FB8A64B0086ABF6 /* libusb-0.1.4.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 09D79CBB1FB8A6490086ABF6 /* libusb-0.1.4.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3A1AF21126FA31D700AC977B /* KeyTesterWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A1AF21026FA31D700AC977B /* KeyTesterWindow.m */; }; 3A245407270817DF001F4AE0 /* MicrocontrollerSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A245406270817DF001F4AE0 /* MicrocontrollerSelector.m */; }; + 3A3B4E2E27D9FBF800526FBF /* LUFAHIDDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A3B4E2D27D9FBF800526FBF /* LUFAHIDDevice.m */; }; 3A5166BC26E07F0000EBE3DC /* KeyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A5166BB26E07F0000EBE3DC /* KeyView.m */; }; 3A5863112725A99D00354E07 /* APM32DFUDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A5863102725A99D00354E07 /* APM32DFUDevice.m */; }; 3A62C86526A96AED001C655A /* reset_right.eep in Resources */ = {isa = PBXBuildFile; fileRef = 3A62C86326A96AED001C655A /* reset_right.eep */; }; 3A62C86626A96AED001C655A /* reset_left.eep in Resources */ = {isa = PBXBuildFile; fileRef = 3A62C86426A96AED001C655A /* reset_left.eep */; }; + 3A7492CC27DF96BF0073A5A0 /* hid_bootloader_cli in Resources */ = {isa = PBXBuildFile; fileRef = 3A7492CB27DF96BF0073A5A0 /* hid_bootloader_cli */; }; 3A7770DA22BD3BA300398C40 /* libftdi.1.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3A7770D822BD3B8200398C40 /* libftdi.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 3A8F9EFF26E75012007480A7 /* KeyTesterWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A8F9F0126E75012007480A7 /* KeyTesterWindow.xib */; }; 3A8F9F0226E7501E007480A7 /* KeyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A8F9F0426E7501E007480A7 /* KeyView.xib */; }; @@ -93,12 +95,15 @@ 3A1AF21026FA31D700AC977B /* KeyTesterWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyTesterWindow.m; sourceTree = ""; }; 3A245405270817DF001F4AE0 /* MicrocontrollerSelector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicrocontrollerSelector.h; sourceTree = ""; }; 3A245406270817DF001F4AE0 /* MicrocontrollerSelector.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicrocontrollerSelector.m; sourceTree = ""; }; + 3A3B4E2C27D9FBF800526FBF /* LUFAHIDDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LUFAHIDDevice.h; sourceTree = ""; }; + 3A3B4E2D27D9FBF800526FBF /* LUFAHIDDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LUFAHIDDevice.m; sourceTree = ""; }; 3A5166BA26E07F0000EBE3DC /* KeyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyView.h; sourceTree = ""; }; 3A5166BB26E07F0000EBE3DC /* KeyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyView.m; sourceTree = ""; }; 3A58630F2725A99D00354E07 /* APM32DFUDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APM32DFUDevice.h; sourceTree = ""; }; 3A5863102725A99D00354E07 /* APM32DFUDevice.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = APM32DFUDevice.m; sourceTree = ""; }; 3A62C86326A96AED001C655A /* reset_right.eep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = reset_right.eep; path = ../../../common/reset_right.eep; sourceTree = ""; }; 3A62C86426A96AED001C655A /* reset_left.eep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = reset_left.eep; path = ../../../common/reset_left.eep; sourceTree = ""; }; + 3A7492CB27DF96BF0073A5A0 /* hid_bootloader_cli */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = hid_bootloader_cli; sourceTree = ""; }; 3A7770D822BD3B8200398C40 /* libftdi.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libftdi.1.dylib; sourceTree = ""; }; 3A8F9F0026E75012007480A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/KeyTesterWindow.xib; sourceTree = ""; }; 3A8F9F0326E7501E007480A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/KeyView.xib; sourceTree = ""; }; @@ -230,6 +235,7 @@ 3AB4BC9C2495540A00204A3F /* bootloadHID */, 0929640C1F5E403C004F2D3F /* dfu-programmer */, 098AEDFA1F5E45C300CA054D /* dfu-util */, + 3A7492CB27DF96BF0073A5A0 /* hid_bootloader_cli */, C9A09B5622EE6826008C3CF3 /* mdloader */, 0929640E1F5E4068004F2D3F /* teensy_loader_cli */, 3A7770D822BD3B8200398C40 /* libftdi.1.dylib */, @@ -286,6 +292,8 @@ 3AE6D9F02726C9B500CECA21 /* HalfKayDevice.m */, 3AE6D9F22726C9EC00CECA21 /* KiibohdDFUDevice.h */, 3AE6D9F32726C9EC00CECA21 /* KiibohdDFUDevice.m */, + 3A3B4E2C27D9FBF800526FBF /* LUFAHIDDevice.h */, + 3A3B4E2D27D9FBF800526FBF /* LUFAHIDDevice.m */, 3AE6D9F52726CA1C00CECA21 /* LUFAMSDevice.h */, 3AE6D9F62726CA1C00CECA21 /* LUFAMSDevice.m */, 3AE6D9FB2726CAF900CECA21 /* STM32DFUDevice.h */, @@ -372,6 +380,7 @@ 3AB4BC9D2495540A00204A3F /* bootloadHID in Resources */, 0929640D1F5E403C004F2D3F /* dfu-programmer in Resources */, 098AEDFB1F5E45C300CA054D /* dfu-util in Resources */, + 3A7492CC27DF96BF0073A5A0 /* hid_bootloader_cli in Resources */, C9A09B5722EE6826008C3CF3 /* mdloader in Resources */, 0929640F1F5E4068004F2D3F /* teensy_loader_cli in Resources */, ); @@ -404,6 +413,7 @@ 3AE6D9EE2726C95C00CECA21 /* CaterinaDevice.m in Sources */, 3AE6D9F12726C9B500CECA21 /* HalfKayDevice.m in Sources */, 3AE6D9F42726C9EC00CECA21 /* KiibohdDFUDevice.m in Sources */, + 3A3B4E2E27D9FBF800526FBF /* LUFAHIDDevice.m in Sources */, 3AE6D9F72726CA1C00CECA21 /* LUFAMSDevice.m in Sources */, 3AE6D9FD2726CAF900CECA21 /* STM32DFUDevice.m in Sources */, 3AE6DA002726CB2600CECA21 /* STM32DuinoDevice.m in Sources */, diff --git a/macos/QMK Toolbox/AppDelegate.m b/macos/QMK Toolbox/AppDelegate.m index 8d4086574f..8b7e990ab8 100644 --- a/macos/QMK Toolbox/AppDelegate.m +++ b/macos/QMK Toolbox/AppDelegate.m @@ -61,6 +61,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [self.logTextView logInfo:@" - BootloadHID (Atmel, PS2AVRGB) via bootloadHID (https://www.obdev.at/products/vusb/bootloadhid.html)"]; [self.logTextView logInfo:@" - Caterina (Arduino, Pro Micro) via avrdude (http://nongnu.org/avrdude/)"]; [self.logTextView logInfo:@" - HalfKay (Teensy, Ergodox EZ) via Teensy Loader (https://pjrc.com/teensy/loader_cli.html)"]; + [self.logTextView logInfo:@" - LUFA/QMK HID via hid_bootloader_cli (/~https://github.com/abcminiuser/lufa)"]; [self.logTextView logInfo:@" - LUFA Mass Storage"]; [self.logTextView logInfo:@"Supported ISP flashers:"]; [self.logTextView logInfo:@" - AVRISP (Arduino ISP)"]; diff --git a/macos/QMK Toolbox/Resources/hid_bootloader_cli b/macos/QMK Toolbox/Resources/hid_bootloader_cli new file mode 100755 index 0000000000..c8575b11e4 Binary files /dev/null and b/macos/QMK Toolbox/Resources/hid_bootloader_cli differ diff --git a/macos/QMK Toolbox/USB/Bootloader/BootloaderType.h b/macos/QMK Toolbox/USB/Bootloader/BootloaderType.h index 33b39c2ec0..6ec33b4846 100644 --- a/macos/QMK Toolbox/USB/Bootloader/BootloaderType.h +++ b/macos/QMK Toolbox/USB/Bootloader/BootloaderType.h @@ -7,8 +7,10 @@ typedef enum BootloaderType : NSUInteger { BootloaderTypeCaterina, BootloaderTypeHalfKay, BootloaderTypeKiibohdDFU, + BootloaderTypeLUFAHID, BootloaderTypeLUFAMS, BootloaderTypeQMKDFU, + BootloaderTypeQMKHID, BootloaderTypeSTM32DFU, BootloaderTypeSTM32Duino, BootloaderTypeUSBAsp, diff --git a/macos/QMK Toolbox/USB/Bootloader/LUFAHIDDevice.h b/macos/QMK Toolbox/USB/Bootloader/LUFAHIDDevice.h new file mode 100644 index 0000000000..081c9b2c18 --- /dev/null +++ b/macos/QMK Toolbox/USB/Bootloader/LUFAHIDDevice.h @@ -0,0 +1,4 @@ +#import "BootloaderDevice.h" + +@interface LUFAHIDDevice : BootloaderDevice +@end diff --git a/macos/QMK Toolbox/USB/Bootloader/LUFAHIDDevice.m b/macos/QMK Toolbox/USB/Bootloader/LUFAHIDDevice.m new file mode 100644 index 0000000000..60de271f29 --- /dev/null +++ b/macos/QMK Toolbox/USB/Bootloader/LUFAHIDDevice.m @@ -0,0 +1,28 @@ +#import "LUFAHIDDevice.h" + +@implementation LUFAHIDDevice + +- (id)initWithUSBDevice:(USBDevice *)usbDevice { + if (self = [super initWithUSBDevice:usbDevice]) { + if ([self revisionBCD] == 0x0936) { + self.name = @"QMK HID"; + self.type = BootloaderTypeQMKHID; + } else { + self.name = @"LUFA HID"; + self.type = BootloaderTypeLUFAHID; + } + } + return self; +} + +-(void)flashWithMCU:(NSString *)mcu file:(NSString *)file { + [self runProcess:@"hid_bootloader_cli" withArgs:@[[NSString stringWithFormat:@"-mmcu=%@", mcu], file, @"-v"]]; +} + +// hid_bootloader_cli 210130 lacks -b flag +// Next LUFA release should have it thanks to abcminiuser/lufa#173 +//-(void)resetWithMCU:(NSString *)mcu { +// [self runProcess:@"hid_bootloader_cli" withArgs:@[[NSString stringWithFormat:@"-mmcu=%@", mcu], @"-bv"]]; +//} + +@end diff --git a/macos/QMK Toolbox/USB/USBListener.m b/macos/QMK Toolbox/USB/USBListener.m index 1787bc80ab..a953dd767c 100644 --- a/macos/QMK Toolbox/USB/USBListener.m +++ b/macos/QMK Toolbox/USB/USBListener.m @@ -11,6 +11,7 @@ #import "CaterinaDevice.h" #import "HalfKayDevice.h" #import "KiibohdDFUDevice.h" +#import "LUFAHIDDevice.h" #import "LUFAMSDevice.h" #import "STM32DFUDevice.h" #import "STM32DuinoDevice.h" @@ -144,6 +145,9 @@ - (void)stop { return [[HalfKayDevice alloc] initWithUSBDevice:usbDevice]; case BootloaderTypeKiibohdDFU: return [[KiibohdDFUDevice alloc] initWithUSBDevice:usbDevice]; + case BootloaderTypeLUFAHID: + case BootloaderTypeQMKHID: + return [[LUFAHIDDevice alloc] initWithUSBDevice:usbDevice]; case BootloaderTypeLUFAMS: return [[LUFAMSDevice alloc] initWithUSBDevice:usbDevice]; case BootloaderTypeSTM32DFU: @@ -166,6 +170,11 @@ - (BootloaderType)deviceTypeForVendorID:(ushort)vendorID productID:(ushort)produ switch (productID) { case 0x2045: return BootloaderTypeLUFAMS; + case 0x2067: + if (revisionBCD == 0x0936) { // Unicode Ψ + return BootloaderTypeQMKHID; + } + return BootloaderTypeLUFAHID; case 0x2FEF: // ATmega16U2 case 0x2FF0: // ATmega32U2 case 0x2FF3: // ATmega16U4