diff --git a/JoyKit/ControllerConfiguration.inc b/JoyKit/ControllerConfiguration.inc index cdbdce3..cf327f9 100644 --- a/JoyKit/ControllerConfiguration.inc +++ b/JoyKit/ControllerConfiguration.inc @@ -120,6 +120,8 @@ hacksByName = @{ JOYConnectedUsage: @2, JOYConnectedUsagePage: @0xFF00, + + JOYActivationReport: [NSData dataWithBytes:(uint8_t[]){0x13} length:1], JOYSubElementStructs: @{ diff --git a/JoyKit/JOYController.m b/JoyKit/JOYController.m index c18fbdb..b4810ab 100644 --- a/JoyKit/JOYController.m +++ b/JoyKit/JOYController.m @@ -19,7 +19,7 @@ static NSString const *JOYConnectedUsagePage = @"JOYConnectedUsagePage"; static NSString const *JOYRumbleMin = @"JOYRumbleMin"; static NSString const *JOYRumbleMax = @"JOYRumbleMax"; static NSString const *JOYSwapZRz = @"JOYSwapZRz"; - +static NSString const *JOYActivationReport = @"JOYActivationReport"; static NSMutableDictionary *controllers; // Physical controllers static NSMutableArray *exposedControllers; // Logical controllers @@ -691,15 +691,25 @@ typedef struct __attribute__((packed)) { { NSString *name = (__bridge NSString *)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey)); NSDictionary *hacks = hacksByName[name]; + if (!hacks) { + hacks = hacksByManufacturer[(__bridge NSNumber *)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey))]; + } NSArray *filters = hacks[JOYReportIDFilters]; + JOYController *controller = nil; if (filters) { - JOYController *controller = [[JOYMultiplayerController alloc] initWithDevice:device - reportIDFilters:filters]; - [controllers setObject:controller forKey:[NSValue valueWithPointer:device]]; + controller = [[JOYMultiplayerController alloc] initWithDevice:device + reportIDFilters:filters]; } else { - [controllers setObject:[[JOYController alloc] initWithDevice:device] forKey:[NSValue valueWithPointer:device]]; + controller = [[JOYController alloc] initWithDevice:device]; } + + if (hacks[JOYActivationReport]) { + [controller sendReport:hacks[JOYActivationReport]]; + } + [controllers setObject:controller forKey:[NSValue valueWithPointer:device]]; + + } + (void)controllerRemoved:(IOHIDDeviceRef) device