diff --git a/.gitignore b/.gitignore index 3a0285ad81..637ecdeee9 100644 --- a/.gitignore +++ b/.gitignore @@ -307,4 +307,6 @@ fastlane/test_output iOSInjectionProject/ qmk_toolbox.exe -qmk_toolbox_install.exe \ No newline at end of file +qmk_toolbox_install.exe +QMK.Toolbox.app.zip +QMK.Toolbox.pkg \ No newline at end of file diff --git a/osx/QMK Toolbox.pkgproj b/osx/QMK Toolbox.pkgproj index bffb9cb1da..0de0c816ab 100755 --- a/osx/QMK Toolbox.pkgproj +++ b/osx/QMK Toolbox.pkgproj @@ -453,7 +453,7 @@ OVERWRITE_PERMISSIONS VERSION - 0.0.7 + 0.0.8 UUID 9890D281-1549-46B1-8075-2C3C14A67FB9 diff --git a/osx/qmk_toolbox/AppDelegate.m b/osx/qmk_toolbox/AppDelegate.m index e979b6372b..05bb75185b 100644 --- a/osx/qmk_toolbox/AppDelegate.m +++ b/osx/qmk_toolbox/AppDelegate.m @@ -212,6 +212,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [_printer printResponse:@" - Caterina (Arduino, Pro Micro) via avrdude (http://nongnu.org/avrdude/)\n" withType:MessageType_Info]; [_printer printResponse:@" - Halfkay (Teensy, Ergodox EZ) via teensy_loader_cli (https://pjrc.com/teensy/loader_cli.html)\n" withType:MessageType_Info]; [_printer printResponse:@" - STM32 (ARM) via dfu-util (http://dfu-util.sourceforge.net/)\n" withType:MessageType_Info]; + [_printer printResponse:@" - Kiibohd (ARM) via dfu-util (http://dfu-util.sourceforge.net/)\n" withType:MessageType_Info]; diff --git a/osx/qmk_toolbox/Flashing.h b/osx/qmk_toolbox/Flashing.h index 5479624717..c0fcb946ab 100644 --- a/osx/qmk_toolbox/Flashing.h +++ b/osx/qmk_toolbox/Flashing.h @@ -15,6 +15,7 @@ typedef enum { Halfkay, Caterina, STM32, + Kiibohd, NumberOfChipsets } Chipset; diff --git a/osx/qmk_toolbox/Flashing.m b/osx/qmk_toolbox/Flashing.m index e9f1fe7219..38280926ce 100644 --- a/osx/qmk_toolbox/Flashing.m +++ b/osx/qmk_toolbox/Flashing.m @@ -60,6 +60,8 @@ - (void)flash:(NSString *)mcu withFile:(NSString *)file { [self flashHalfkay:mcu withFile:file]; if ([delegate canFlash:STM32]) [self flashSTM32WithFile:file]; + if ([delegate canFlash:Kiibohd]) + [self flashKiibohdWithFile:file]; } - (void)reset:(NSString *)mcu { @@ -121,4 +123,8 @@ - (void)flashSTM32WithFile:(NSString *)file { [self runProcess:@"dfu-util" withArgs:@[@"-a", @"0", @"-d", @"0482:df11", @"-s", @"0x8000000", @"-D", file]]; } +- (void)flashKiibohdWithFile:(NSString *)file { + [self runProcess:@"dfu-util" withArgs:@[@"-D", file]]; +} + @end \ No newline at end of file diff --git a/osx/qmk_toolbox/Info.plist b/osx/qmk_toolbox/Info.plist index 759be55f69..db64e54487 100644 --- a/osx/qmk_toolbox/Info.plist +++ b/osx/qmk_toolbox/Info.plist @@ -68,7 +68,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.0.7 + 0.0.8 CFBundleSignature ???? CFBundleURLTypes diff --git a/osx/qmk_toolbox/USB.m b/osx/qmk_toolbox/USB.m index 4abf5401af..75cfde9b92 100644 --- a/osx/qmk_toolbox/USB.m +++ b/osx/qmk_toolbox/USB.m @@ -22,6 +22,8 @@ static io_iterator_t gHalfkayRemovedIter; static io_iterator_t gSTM32AddedIter; static io_iterator_t gSTM32RemovedIter; +static io_iterator_t gKiibohdAddedIter; +static io_iterator_t gKiibohdRemovedIter; static Printing * _printer; @interface USB () @@ -42,6 +44,7 @@ + (void)setupWithPrinter:(Printing *)printer andDelegate:(id)d { CFMutableDictionaryRef CaterinaMatchingDict; CFMutableDictionaryRef HalfkayMatchingDict; CFMutableDictionaryRef STM32MatchingDict; + CFMutableDictionaryRef KiibohdMatchingDict; CFRunLoopSourceRef runLoopSource; kern_return_t kr; SInt32 usbVendor; @@ -125,6 +128,24 @@ + (void)setupWithPrinter:(Printing *)printer andDelegate:(id)d { STM32DeviceRemoved(NULL, gSTM32RemovedIter); + // Kiibohd + + usbVendor = 0x1C11; + usbProduct = 0xB007; + + KiibohdMatchingDict = IOServiceMatching(kIOUSBDeviceClassName); + KiibohdMatchingDict = (CFMutableDictionaryRef) CFRetain(KiibohdMatchingDict); + KiibohdMatchingDict = (CFMutableDictionaryRef) CFRetain(KiibohdMatchingDict); + + CFDictionarySetValue(KiibohdMatchingDict, CFSTR(kUSBVendorID), CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &usbVendor)); + CFDictionarySetValue(KiibohdMatchingDict, CFSTR(kUSBProductID), CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &usbProduct)); + + kr = IOServiceAddMatchingNotification(gNotifyPort, kIOFirstMatchNotification, KiibohdMatchingDict, KiibohdDeviceAdded, NULL, &gKiibohdAddedIter); + STM32DeviceAdded(NULL, gSTM32AddedIter); + + kr = IOServiceAddMatchingNotification(gNotifyPort, kIOTerminatedNotification, KiibohdMatchingDict, KiibohdDeviceRemoved, NULL, &gKiibohdRemovedIter); + STM32DeviceRemoved(NULL, gSTM32RemovedIter); + //Finished with master port @@ -252,6 +273,31 @@ static void STM32DeviceRemoved(void *refCon, io_iterator_t iterator) { } } +static void KiibohdDeviceAdded(void *refCon, io_iterator_t iterator) { + io_service_t object; + while ((object = IOIteratorNext(iterator))) { + [_printer print:@"Kiibohd device connected" withType:MessageType_Bootloader]; + [delegate deviceConnected:STM32]; + } +} + +static void KiibohdDeviceRemoved(void *refCon, io_iterator_t iterator) { + kern_return_t kr; + io_service_t object; + + while ((object = IOIteratorNext(iterator))) + { + [_printer print:@"Kiibohd device disconnected" withType:MessageType_Bootloader]; + [delegate deviceDisconnected:STM32]; + kr = IOObjectRelease(object); + if (kr != kIOReturnSuccess) + { + printf("Couldn’t release raw device object: %08x\n", kr); + continue; + } + } +} + static kern_return_t MyFindModems(io_iterator_t *matchingServices) { kern_return_t kernResult; diff --git a/osx/release.command b/osx/release.command new file mode 100755 index 0000000000..3ef46f1d58 --- /dev/null +++ b/osx/release.command @@ -0,0 +1,5 @@ +#!/bin/bash +here="`dirname \"$0\"`" +cd "$here" || exit 1 +cp "Build/Products/Release/QMK Toolbox.app.zip" QMK.Toolbox.app.zip +cp "Build/QMK Toolbox.pkg" QMK.Toolbox.pkg \ No newline at end of file