diff options
Diffstat (limited to 'osdep/ar/HIDRemote.m')
-rw-r--r-- | osdep/ar/HIDRemote.m | 356 |
1 files changed, 178 insertions, 178 deletions
diff --git a/osdep/ar/HIDRemote.m b/osdep/ar/HIDRemote.m index 977b9cbdb9..f62289e23c 100644 --- a/osdep/ar/HIDRemote.m +++ b/osdep/ar/HIDRemote.m @@ -12,21 +12,21 @@ // // Copyright (c) 2007-2011 IOSPIRIT GmbH (http://www.iospirit.com/) // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: -// +// // * Redistributions of source code must retain the above copyright notice, this list // of conditions and the following disclaimer. -// +// // * Redistributions in binary form must reproduce the above copyright notice, this // list of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. -// +// // * Neither the name of IOSPIRIT GmbH nor the names of its contributors may be used to // endorse or promote products derived from this software without specific prior // written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT @@ -52,7 +52,7 @@ #import "HIDRemote.h" // Callback Prototypes -static void HIDEventCallback( void * target, +static void HIDEventCallback( void * target, IOReturn result, void * refcon, void * sender); @@ -83,7 +83,7 @@ static HIDRemote *sHIDRemote = nil; { sHIDRemote = [[HIDRemote alloc] init]; } - + return (sHIDRemote); } @@ -94,7 +94,7 @@ static HIDRemote *sHIDRemote = nil; #ifdef HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING _runOnThread = [[NSThread currentThread] retain]; #endif - + // Detect application becoming active/inactive [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_appStatusChanged:) name:NSApplicationDidBecomeActiveNotification object:NSApp]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_appStatusChanged:) name:NSApplicationWillResignActiveNotification object:NSApp]; @@ -102,18 +102,18 @@ static HIDRemote *sHIDRemote = nil; // Handle distributed notifications _pidString = [[NSString alloc] initWithFormat:@"%d", getpid()]; - + [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemotePing object:nil]; [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemoteRetry object:kHIDRemoteDNHIDRemoteRetryGlobalObject]; [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemoteRetry object:_pidString]; // Enabled by default: simulate hold events for plus/minus _simulateHoldEvents = YES; - + // Enabled by default: work around for a locking issue introduced with Security Update 2008-004 / 10.4.9 and beyond (credit for finding this workaround goes to Martin Kahr) _secureEventInputWorkAround = YES; _secureInputNotification = 0; - + // Initialize instance variables _lastSeenRemoteID = -1; _lastSeenModel = kHIDRemoteModelUndetermined; @@ -121,7 +121,7 @@ static HIDRemote *sHIDRemote = nil; _exclusiveLockLending = NO; _sendExclusiveResourceReuseNotification = YES; _applicationIsTerminating = NO; - + // Send status notifications _sendStatusNotifications = YES; } @@ -139,7 +139,7 @@ static HIDRemote *sHIDRemote = nil; [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kHIDRemoteDNHIDRemoteRetry object:kHIDRemoteDNHIDRemoteRetryGlobalObject]; [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kHIDRemoteDNHIDRemoteRetry object:_pidString]; [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:nil object:nil]; /* As demanded by the documentation for -[NSDistributedNotificationCenter removeObserver:name:object:] */ - + [self stopRemoteControl]; [self setExclusiveLockLendingEnabled:NO]; @@ -195,13 +195,13 @@ static HIDRemote *sHIDRemote = nil; HIDRemoteAluminumRemoteSupportLevel supportLevel = kHIDRemoteAluminumRemoteSupportLevelNone; NSEnumerator *attribDictsEnum; NSDictionary *hidAttribsDict; - + attribDictsEnum = [_serviceAttribMap objectEnumerator]; - + while ((hidAttribsDict = [attribDictsEnum nextObject]) != nil) { NSNumber *deviceSupportLevel; - + if ((deviceSupportLevel = [hidAttribsDict objectForKey:kHIDRemoteAluminumRemoteSupportLevel]) != nil) { if ([deviceSupportLevel intValue] > (int)supportLevel) @@ -210,7 +210,7 @@ static HIDRemote *sHIDRemote = nil; } } } - + return (supportLevel); } @@ -222,16 +222,16 @@ static HIDRemote *sHIDRemote = nil; kern_return_t kernReturn; CFMutableDictionaryRef matchDict=NULL; io_service_t rootService; - + do { // Get IOKit master port kernReturn = IOMasterPort(bootstrap_port, &_masterPort); if ((kernReturn!=kIOReturnSuccess) || (_masterPort==0)) { break; } - + // Setup notification port _notifyPort = IONotificationPortCreate(_masterPort); - + if ((_notifyRLSource = IONotificationPortGetRunLoopSource(_notifyPort)) != NULL) { CFRunLoopAddSource( CFRunLoopGetCurrent(), @@ -242,7 +242,7 @@ static HIDRemote *sHIDRemote = nil; { break; } - + // Setup SecureInput notification if ((hidRemoteMode == kHIDRemoteModeExclusive) || (hidRemoteMode == kHIDRemoteModeExclusiveAuto)) { @@ -255,7 +255,7 @@ static HIDRemote *sHIDRemote = nil; (void *)self, &_secureInputNotification); if (kernReturn != kIOReturnSuccess) { break; } - + [self _updateSessionInformation]; } else @@ -277,32 +277,32 @@ static HIDRemote *sHIDRemote = nil; &_matchingServicesIterator); if (kernReturn != kIOReturnSuccess) { break; } - // Setup serviceAttribMap + // Setup serviceAttribMap _serviceAttribMap = [[NSMutableDictionary alloc] init]; if (_serviceAttribMap==nil) { break; } - + // Phew .. everything went well! _mode = hidRemoteMode; CFRelease(matchDict); - + [self _serviceMatching:_matchingServicesIterator]; - + [self _postStatusWithAction:kHIDRemoteDNStatusActionStart]; - + return (YES); }while(0); - + // An error occured. Do necessary clean up. if (matchDict!=NULL) { CFRelease(matchDict); matchDict = NULL; } - + [self stopRemoteControl]; } - + return (NO); } @@ -312,7 +312,7 @@ static HIDRemote *sHIDRemote = nil; _autoRecover = NO; _isStopping = YES; - + if (_autoRecoveryTimer!=nil) { [_autoRecoveryTimer invalidate]; @@ -323,22 +323,22 @@ static HIDRemote *sHIDRemote = nil; if (_serviceAttribMap!=nil) { NSDictionary *cloneDict = [[NSDictionary alloc] initWithDictionary:_serviceAttribMap]; - + if (cloneDict!=nil) { NSEnumerator *mapKeyEnum = [cloneDict keyEnumerator]; NSNumber *serviceValue; - + while ((serviceValue = [mapKeyEnum nextObject]) != nil) { [self _destructService:(io_object_t)[serviceValue unsignedIntValue]]; serviceCount++; }; - + [cloneDict release]; cloneDict = nil; } - + [_serviceAttribMap release]; _serviceAttribMap = nil; } @@ -348,7 +348,7 @@ static HIDRemote *sHIDRemote = nil; IOObjectRelease((io_object_t) _matchingServicesIterator); _matchingServicesIterator = 0; } - + if (_secureInputNotification!=0) { IOObjectRelease((io_object_t) _secureInputNotification); @@ -390,7 +390,7 @@ static HIDRemote *sHIDRemote = nil; if (((_mode==kHIDRemoteModeExclusive) || (_mode==kHIDRemoteModeExclusiveAuto)) && (_sendExclusiveResourceReuseNotification==YES) && (_exclusiveLockLending==NO) && (serviceCount>0)) { _mode = kHIDRemoteModeNone; - + if (!_isRestarting) { [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kHIDRemoteDNHIDRemoteRetry @@ -404,7 +404,7 @@ static HIDRemote *sHIDRemote = nil; } } } - + _mode = kHIDRemoteModeNone; _isStopping = NO; } @@ -458,7 +458,7 @@ static HIDRemote *sHIDRemote = nil; { [newArrayWithUnusedButtonCodesAsNSNumbers retain]; [_unusedButtonCodes release]; - + _unusedButtonCodes = newArrayWithUnusedButtonCodesAsNSNumbers; [self _postStatusWithAction:kHIDRemoteDNStatusActionUpdate]; @@ -490,7 +490,7 @@ static HIDRemote *sHIDRemote = nil; if (newExclusiveLockLendingEnabled != _exclusiveLockLending) { _exclusiveLockLending = newExclusiveLockLendingEnabled; - + if (_exclusiveLockLending) { [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemoteStatus object:nil]; @@ -498,7 +498,7 @@ static HIDRemote *sHIDRemote = nil; else { [[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kHIDRemoteDNHIDRemoteStatus object:nil]; - + [_waitForReturnByPID release]; _waitForReturnByPID = nil; } @@ -545,7 +545,7 @@ static HIDRemote *sHIDRemote = nil; return; } } - + if ([[notification name] isEqual:NSApplicationWillResignActiveNotification]) { if (_mode != kHIDRemoteModeExclusiveAuto) @@ -553,7 +553,7 @@ static HIDRemote *sHIDRemote = nil; return; } } - + [self performSelector:@selector(_appStatusChanged:) onThread:_runOnThread withObject:notification waitUntilDone:[[notification name] isEqual:NSApplicationWillTerminateNotification]]; return; } @@ -592,11 +592,11 @@ static HIDRemote *sHIDRemote = nil; _autoRecover = YES; } } - + if ([[notification name] isEqual:NSApplicationWillTerminateNotification]) { _applicationIsTerminating = YES; - + if ([self isStarted]) { [self stopRemoteControl]; @@ -668,7 +668,7 @@ static HIDRemote *sHIDRemote = nil; if ([self isStarted]) { BOOL retry = YES; - + // Ignore our own global retry broadcasts if ([[notification object] isEqual:kHIDRemoteDNHIDRemoteRetryGlobalObject]) { @@ -682,7 +682,7 @@ static HIDRemote *sHIDRemote = nil; } } } - + if (retry) { if (([self delegate] != nil) && @@ -691,22 +691,22 @@ static HIDRemote *sHIDRemote = nil; retry = [[self delegate] hidRemote:self shouldRetryExclusiveLockWithInfo:[notification userInfo]]; } } - + if (retry) { HIDRemoteMode restartInMode = _mode; - + if (restartInMode != kHIDRemoteModeNone) { _isRestarting = YES; [self stopRemoteControl]; - + [_returnToPID release]; _returnToPID = nil; - + [self startRemoteControl:restartInMode]; _isRestarting = NO; - + if (restartInMode != kHIDRemoteModeShared) { _returnToPID = [[[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey] retain]; @@ -720,18 +720,18 @@ static HIDRemote *sHIDRemote = nil; _returnToPID = [[[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey] retain]; [self _postStatusWithAction:kHIDRemoteDNStatusActionNoNeed]; [_returnToPID release]; - + _returnToPID = cacheReturnPID; } } } - + if (_exclusiveLockLending) { if ([notificationName isEqual:kHIDRemoteDNHIDRemoteStatus]) { NSString *action; - + if ((action = [[notification userInfo] objectForKey:kHIDRemoteDNStatusActionKey]) != nil) { if ((_mode == kHIDRemoteModeNone) && (_waitForReturnByPID!=nil)) @@ -741,13 +741,13 @@ static HIDRemote *sHIDRemote = nil; if ((pidNumber = [[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey]) != nil) { returnToPIDNumber = [[notification userInfo] objectForKey:kHIDRemoteDNStatusReturnToPIDKey]; - + if ([action isEqual:kHIDRemoteDNStatusActionStart]) { if ([pidNumber isEqual:_waitForReturnByPID]) { NSNumber *startMode; - + if ((startMode = [[notification userInfo] objectForKey:kHIDRemoteDNStatusModeKey]) != nil) { if ([startMode intValue] == kHIDRemoteModeShared) @@ -767,7 +767,7 @@ static HIDRemote *sHIDRemote = nil; { [_waitForReturnByPID release]; _waitForReturnByPID = nil; - + if (([self delegate] != nil) && ([[self delegate] respondsToSelector:@selector(hidRemote:exclusiveLockReleasedByApplicationWithInfo:)])) { @@ -789,7 +789,7 @@ static HIDRemote *sHIDRemote = nil; { NSNumber *originPID = [[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey]; BOOL lendLock = YES; - + if ([originPID intValue] != getpid()) { if (([self delegate] != nil) && @@ -797,16 +797,16 @@ static HIDRemote *sHIDRemote = nil; { lendLock = [[self delegate] hidRemote:self lendExclusiveLockToApplicationWithInfo:[notification userInfo]]; } - + if (lendLock) { [_waitForReturnByPID release]; _waitForReturnByPID = [originPID retain]; - + if (_waitForReturnByPID != nil) { [self stopRemoteControl]; - + [[NSDistributedNotificationCenter defaultCenter] postNotificationName:kHIDRemoteDNHIDRemoteRetry object:[NSString stringWithFormat:@"%d", [_waitForReturnByPID intValue]] userInfo:[NSDictionary dictionaryWithObjectsAndKeys: @@ -841,7 +841,7 @@ static HIDRemote *sHIDRemote = nil; BOOL serviceMatches = NO; NSString *ioClass; NSNumber *candelairHIDRemoteCompatibilityMask; - + if (service != 0) { // IOClass matching @@ -856,14 +856,14 @@ static HIDRemote *sHIDRemote = nil; CFTypeRef candelairHIDRemoteCompatibilityDevice; serviceMatches = YES; - + if ((candelairHIDRemoteCompatibilityDevice = IORegistryEntryCreateCFProperty((io_registry_entry_t)service, CFSTR("CandelairHIDRemoteCompatibilityDevice"), kCFAllocatorDefault, 0)) != NULL) { if (CFEqual(kCFBooleanTrue, candelairHIDRemoteCompatibilityDevice)) { serviceMatches = NO; } - + CFRelease (candelairHIDRemoteCompatibilityDevice); } } @@ -873,7 +873,7 @@ static HIDRemote *sHIDRemote = nil; { serviceMatches = YES; } - + CFRelease((CFTypeRef)ioClass); } @@ -891,7 +891,7 @@ static HIDRemote *sHIDRemote = nil; serviceMatches = NO; } } - + CFRelease((CFTypeRef)candelairHIDRemoteCompatibilityMask); } } @@ -901,7 +901,7 @@ static HIDRemote *sHIDRemote = nil; { serviceMatches = [((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self inspectNewHardwareWithService:service prematchResult:serviceMatches]; } - + return (serviceMatches); } @@ -918,7 +918,7 @@ static HIDRemote *sHIDRemote = nil; // Aluminum Remote: Center buttonCode = (kHIDRemoteButtonCodeCenter|kHIDRemoteButtonCodeAluminumMask); break; - + case kHIDUsage_Csmr_ModeStep: // Aluminium Remote: Center Hold buttonCode = (kHIDRemoteButtonCodeCenterHold|kHIDRemoteButtonCodeAluminumMask); @@ -928,11 +928,11 @@ static HIDRemote *sHIDRemote = nil; // Aluminum Remote: Play/Pause buttonCode = (kHIDRemoteButtonCodePlay|kHIDRemoteButtonCodeAluminumMask); break; - + case kHIDUsage_Csmr_Rewind: buttonCode = kHIDRemoteButtonCodeLeftHold; break; - + case kHIDUsage_Csmr_FastForward: buttonCode = kHIDRemoteButtonCodeRightHold; break; @@ -942,7 +942,7 @@ static HIDRemote *sHIDRemote = nil; break; } break; - + case kHIDPage_GenericDesktop: switch (usage) { @@ -971,7 +971,7 @@ static HIDRemote *sHIDRemote = nil; break; } break; - + case 0x06: /* Reserved */ switch (usage) { @@ -980,7 +980,7 @@ static HIDRemote *sHIDRemote = nil; break; } break; - + case 0xFF01: /* Vendor specific */ switch (usage) { @@ -996,7 +996,7 @@ static HIDRemote *sHIDRemote = nil; } break; } - + return (buttonCode); } @@ -1030,52 +1030,52 @@ static HIDRemote *sHIDRemote = nil; kIOCFPlugInInterfaceID, &cfPluginInterface, &score); - + if (kernResult != kIOReturnSuccess) { error = [NSError errorWithDomain:NSMachErrorDomain code:kernResult userInfo:nil]; errorCode = 1; - break; + break; } - + // .. use it to get the HID interface .. - hResult = (*cfPluginInterface)->QueryInterface( cfPluginInterface, + hResult = (*cfPluginInterface)->QueryInterface( cfPluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID122), (LPVOID)&hidDeviceInterface); - + if ((hResult!=S_OK) || (hidDeviceInterface==NULL)) { error = [NSError errorWithDomain:NSMachErrorDomain code:hResult userInfo:nil]; errorCode = 2; - break; + break; } - + // .. then open it .. switch (_mode) { case kHIDRemoteModeShared: hResult = (*hidDeviceInterface)->open(hidDeviceInterface, kIOHIDOptionsTypeNone); break; - + case kHIDRemoteModeExclusive: case kHIDRemoteModeExclusiveAuto: hResult = (*hidDeviceInterface)->open(hidDeviceInterface, kIOHIDOptionsTypeSeizeDevice); break; - + default: goto cleanUp; // Ugh! But there are no "double breaks" available in C AFAIK .. break; } - + if (hResult!=S_OK) { error = [NSError errorWithDomain:NSMachErrorDomain code:hResult userInfo:nil]; errorCode = 3; break; } - + opened = YES; // .. query the HID elements .. @@ -1086,7 +1086,7 @@ static HIDRemote *sHIDRemote = nil; { error = [NSError errorWithDomain:NSMachErrorDomain code:returnCode userInfo:nil]; errorCode = 4; - + break; } @@ -1121,7 +1121,7 @@ static HIDRemote *sHIDRemote = nil; UInt32 i, hidElementCnt = CFArrayGetCount(hidElements); NSMutableDictionary *cookieButtonCodeLUT = [[NSMutableDictionary alloc] init]; NSMutableDictionary *cookieCount = [[NSMutableDictionary alloc] init]; - + if ((cookieButtonCodeLUT==nil) || (cookieCount==nil)) { [cookieButtonCodeLUT release]; @@ -1135,20 +1135,20 @@ static HIDRemote *sHIDRemote = nil; break; } - + // Analyze the HID elements and find matching elements for (i=0;i<hidElementCnt;i++) { CFDictionaryRef hidDict; NSNumber *usage, *usagePage, *cookie; HIDRemoteButtonCode buttonCode = kHIDRemoteButtonCodeNone; - + hidDict = CFArrayGetValueAtIndex(hidElements, i); - + usage = (NSNumber *) CFDictionaryGetValue(hidDict, CFSTR(kIOHIDElementUsageKey)); usagePage = (NSNumber *) CFDictionaryGetValue(hidDict, CFSTR(kIOHIDElementUsagePageKey)); cookie = (NSNumber *) CFDictionaryGetValue(hidDict, CFSTR(kIOHIDElementCookieKey)); - + if ((usage!=nil) && (usagePage!=nil) && (cookie!=nil)) { // Find the button codes for the ID combos @@ -1160,23 +1160,23 @@ static HIDRemote *sHIDRemote = nil; #include "HIDRemoteAdditions.h" #undef _HIDREMOTE_EXTENSIONS_SECTION #endif /* _HIDREMOTE_EXTENSIONS */ - + // Did record match? if (buttonCode != kHIDRemoteButtonCodeNone) { NSString *pairString = [[NSString alloc] initWithFormat:@"%u_%u", [usagePage unsignedIntValue], [usage unsignedIntValue]]; NSNumber *buttonCodeNumber = [[NSNumber alloc] initWithUnsignedInt:(unsigned int)buttonCode]; - + #ifdef _HIDREMOTE_EXTENSIONS // Debug logging code #define _HIDREMOTE_EXTENSIONS_SECTION 4 #include "HIDRemoteAdditions.h" #undef _HIDREMOTE_EXTENSIONS_SECTION #endif /* _HIDREMOTE_EXTENSIONS */ - + [cookieCount setObject:buttonCodeNumber forKey:pairString]; [cookieButtonCodeLUT setObject:buttonCodeNumber forKey:cookie]; - + (*hidQueueInterface)->addElement(hidQueueInterface, (IOHIDElementCookie) [cookie unsignedIntValue], 0); @@ -1187,13 +1187,13 @@ static HIDRemote *sHIDRemote = nil; #include "HIDRemoteAdditions.h" #undef _HIDREMOTE_EXTENSIONS_SECTION #endif /* _HIDREMOTE_EXTENSIONS */ - + [buttonCodeNumber release]; [pairString release]; } } } - + // Compare number of *unique* matches (thus the cookieCount dictionary) with required minimum if ([cookieCount count] < 10) { @@ -1217,16 +1217,16 @@ static HIDRemote *sHIDRemote = nil; [cookieCount release]; cookieCount = nil; } - + // Finish setup of IOHIDQueueInterface with CFRunLoop returnCode = (*hidQueueInterface)->createAsyncEventSource(hidQueueInterface, &queueEventSource); if ((returnCode != kIOReturnSuccess) || (queueEventSource == NULL)) { error = [NSError errorWithDomain:NSMachErrorDomain code:returnCode userInfo:nil]; errorCode = 9; - break; + break; } - + returnCode = (*hidQueueInterface)->setEventCallout(hidQueueInterface, HIDEventCallback, (void *)((intptr_t)service), (void *)self); if (returnCode != kIOReturnSuccess) { @@ -1234,12 +1234,12 @@ static HIDRemote *sHIDRemote = nil; errorCode = 10; break; } - + CFRunLoopAddSource( CFRunLoopGetCurrent(), queueEventSource, kCFRunLoopCommonModes); [hidAttribsDict setObject:[NSValue valueWithPointer:(const void *)queueEventSource] forKey:kHIDRemoteCFRunLoopSource]; - + returnCode = (*hidQueueInterface)->start(hidQueueInterface); if (returnCode != kIOReturnSuccess) { @@ -1247,7 +1247,7 @@ static HIDRemote *sHIDRemote = nil; errorCode = 11; break; } - + queueStarted = YES; // Setup device notifications @@ -1265,7 +1265,7 @@ static HIDRemote *sHIDRemote = nil; } [hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:(unsigned int)serviceNotification] forKey:kHIDRemoteServiceNotification]; - + // Retain service if (IOObjectRetain(service) != kIOReturnSuccess) { @@ -1273,13 +1273,13 @@ static HIDRemote *sHIDRemote = nil; errorCode = 13; break; } - + [hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:(unsigned int)service] forKey:kHIDRemoteService]; - + // Get some (somewhat optional) infos on the device { CFStringRef product, manufacturer, transport; - + if ((product = IORegistryEntryCreateCFProperty( (io_registry_entry_t)service, (CFStringRef) @"Product", kCFAllocatorDefault, @@ -1289,7 +1289,7 @@ static HIDRemote *sHIDRemote = nil; { [hidAttribsDict setObject:(NSString *)product forKey:kHIDRemoteProduct]; } - + CFRelease(product); } @@ -1302,7 +1302,7 @@ static HIDRemote *sHIDRemote = nil; { [hidAttribsDict setObject:(NSString *)manufacturer forKey:kHIDRemoteManufacturer]; } - + CFRelease(manufacturer); } @@ -1315,16 +1315,16 @@ static HIDRemote *sHIDRemote = nil; { [hidAttribsDict setObject:(NSString *)transport forKey:kHIDRemoteTransport]; } - + CFRelease(transport); } } - + // Determine Aluminum Remote support { CFNumberRef aluSupport; HIDRemoteAluminumRemoteSupportLevel supportLevel = kHIDRemoteAluminumRemoteSupportLevelNone; - + if ((_mode == kHIDRemoteModeExclusive) || (_mode == kHIDRemoteModeExclusiveAuto)) { // Determine if this driver offers on-demand support for the Aluminum Remote (only relevant under OS versions < 10.6.2) @@ -1348,11 +1348,11 @@ static HIDRemote *sHIDRemote = nil; [hidAttribsDict setObject:[NSNumber numberWithBool:YES] forKey:kHIDRemoteAluminumRemoteSupportOnDemand]; } - + CFRelease(aluSupport); } } - + if (supportLevel == kHIDRemoteAluminumRemoteSupportLevelNone) { if ((aluSupport = IORegistryEntryCreateCFProperty((io_registry_entry_t)service, @@ -1364,13 +1364,13 @@ static HIDRemote *sHIDRemote = nil; { |