Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/qmk/qmk_toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhumbert committed Nov 8, 2017
2 parents b86759a + 113adfd commit 2b975ed
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,6 @@ fastlane/test_output
iOSInjectionProject/

qmk_toolbox.exe
qmk_toolbox_install.exe
qmk_toolbox_install.exe
QMK.Toolbox.app.zip
QMK.Toolbox.pkg
2 changes: 1 addition & 1 deletion osx/QMK Toolbox.pkgproj
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
<key>OVERWRITE_PERMISSIONS</key>
<false/>
<key>VERSION</key>
<string>0.0.7</string>
<string>0.0.8</string>
</dict>
<key>UUID</key>
<string>9890D281-1549-46B1-8075-2C3C14A67FB9</string>
Expand Down
1 change: 1 addition & 0 deletions osx/qmk_toolbox/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];



Expand Down
1 change: 1 addition & 0 deletions osx/qmk_toolbox/Flashing.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ typedef enum {
Halfkay,
Caterina,
STM32,
Kiibohd,
NumberOfChipsets
} Chipset;

Expand Down
6 changes: 6 additions & 0 deletions osx/qmk_toolbox/Flashing.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion osx/qmk_toolbox/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.7</string>
<string>0.0.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
46 changes: 46 additions & 0 deletions osx/qmk_toolbox/USB.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand All @@ -42,6 +44,7 @@ + (void)setupWithPrinter:(Printing *)printer andDelegate:(id<USBDelegate>)d {
CFMutableDictionaryRef CaterinaMatchingDict;
CFMutableDictionaryRef HalfkayMatchingDict;
CFMutableDictionaryRef STM32MatchingDict;
CFMutableDictionaryRef KiibohdMatchingDict;
CFRunLoopSourceRef runLoopSource;
kern_return_t kr;
SInt32 usbVendor;
Expand Down Expand Up @@ -125,6 +128,24 @@ + (void)setupWithPrinter:(Printing *)printer andDelegate:(id<USBDelegate>)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
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions osx/release.command
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2b975ed

Please sign in to comment.