aboutsummaryrefslogtreecommitdiffhomepage
path: root/osdep/ar
diff options
context:
space:
mode:
authorGravatar Michael Vetter <g.bluehut@gmail.com>2015-05-15 10:34:39 +0200
committerGravatar wm4 <wm4@nowhere>2015-05-15 11:02:44 +0200
commit9251fa125f6ebc0f485c93af1809efb7b6da19bd (patch)
tree5c5fb05ef692115083a28cb42718a01447150b1a /osdep/ar
parent24f98d1aaf347119b8b3a48e2736755d82a0f508 (diff)
Remove trailing whitespaces
Diffstat (limited to 'osdep/ar')
-rw-r--r--osdep/ar/HIDRemote.h44
-rw-r--r--osdep/ar/HIDRemote.m356
2 files changed, 200 insertions, 200 deletions
diff --git a/osdep/ar/HIDRemote.h b/osdep/ar/HIDRemote.h
index 33f59f322d..9ea01d1fc2 100644
--- a/osdep/ar/HIDRemote.h
+++ b/osdep/ar/HIDRemote.h
@@ -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
@@ -166,7 +166,7 @@ typedef enum
newID:(SInt32)newID
forHardwareWithAttributes:(NSMutableDictionary *)attributes;
-// Notification about hardware additions/removals
+// Notification about hardware additions/removals
- (void)hidRemote:(HIDRemote *)hidRemote // Invoked when new hardware was found / added to HIDRemote's pool
foundNewHardwareWithAttributes:(NSMutableDictionary *)attributes;
@@ -180,7 +180,7 @@ typedef enum
// Matching of newly found receiver hardware
- (BOOL)hidRemote:(HIDRemote *)hidRemote // Invoked when new hardware is inspected
- inspectNewHardwareWithService:(io_service_t)service //
+ inspectNewHardwareWithService:(io_service_t)service //
prematchResult:(BOOL)prematchResult; // Return YES if HIDRemote should go on with this hardware and try
// to use it, or NO if it should not be persued further.
@@ -194,7 +194,7 @@ typedef enum
- (BOOL)hidRemote:(HIDRemote *)hidRemote
shouldRetryExclusiveLockWithInfo:(NSDictionary *)applicationInfo;
-@end
+@end
#pragma mark -- Actual header file for class --
@@ -207,55 +207,55 @@ typedef enum
// Notification ports
IONotificationPortRef _notifyPort;
CFRunLoopSourceRef _notifyRLSource;
-
+
// Matching iterator
io_iterator_t _matchingServicesIterator;
-
+
// SecureInput notification
io_object_t _secureInputNotification;
-
+
// Service attributes
NSMutableDictionary *_serviceAttribMap;
-
+
// Mode
HIDRemoteMode _mode;
BOOL _autoRecover;
NSTimer *_autoRecoveryTimer;
-
+
// Delegate
NSObject <HIDRemoteDelegate> *_delegate;
-
+
// Last seen ID and remote model
SInt32 _lastSeenRemoteID;
HIDRemoteModel _lastSeenModel;
SInt32 _lastSeenModelRemoteID;
-
+
// Unused button codes
NSArray *_unusedButtonCodes;
-
+
// Simulate Plus/Minus Hold
BOOL _simulateHoldEvents;
-
+
// SecureEventInput workaround
BOOL _secureEventInputWorkAround;
UInt64 _lastSecureEventInputPIDSum;
uid_t _lastFrontUserSession;
-
+
// Exclusive lock lending
BOOL _exclusiveLockLending;
BOOL _sendExclusiveResourceReuseNotification;
NSNumber *_waitForReturnByPID;
NSNumber *_returnToPID;
BOOL _isRestarting;
-
+
// Status notifications
BOOL _sendStatusNotifications;
NSString *_pidString;
-
+
// Status
BOOL _applicationIsTerminating;
BOOL _isStopping;
-
+
// Thread safety
#ifdef HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING /* #define HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING if you're running your HIDRemote instance on a background thread (requires OS X 10.5 or later) */
NSThread *_runOnThread;
@@ -271,7 +271,7 @@ typedef enum
- (HIDRemoteAluminumRemoteSupportLevel)aluminiumRemoteSystemSupportLevel;
#pragma mark -- PUBLIC: Interface / API --
-- (BOOL)startRemoteControl:(HIDRemoteMode)hidRemoteMode;
+- (BOOL)startRemoteControl:(HIDRemoteMode)hidRemoteMode;
- (void)stopRemoteControl;
- (BOOL)isStarted;
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;
{
supportLevel = (HIDRemoteAluminumRemoteSupportLevel) [(NSNumber *)aluSupport intValue];
}
-
+
CFRelease(aluSupport);
}
else
{
CFStringRef ioKitClassName;
-
+
if ((ioKitClassName = IORegistryEntryCreateCFProperty( (io_registry_entry_t)service,
CFSTR(kIOClassKey),
kCFAllocatorDefault,
@@ -1380,7 +1380,7 @@ static HIDRemote *sHIDRemote = nil;
{
supportLevel = kHIDRemoteAluminumRemoteSupportLevelNative;
}
-
+
CFRelease(ioKitClassName);
}
}
@@ -1388,24 +1388,24 @@ static HIDRemote *sHIDRemote = nil;
[hidAttribsDict setObject:(NSNumber *)[NSNumber numberWithInt:(int)supportLevel] forKey:kHIDRemoteAluminumRemoteSupportLevel];
}
-
+
// Add it to the serviceAttribMap
[_serviceAttribMap setObject:hidAttribsDict forKey:[NSNumber numberWithUnsignedInt:(unsigned int)service]];
-
+
// And we're done with setup ..
if (([self delegate]!=nil) &&
([[self delegate] respondsToSelector:@selector(hidRemote:foundNewHardwareWithAttributes:)]))
{
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self foundNewHardwareWithAttributes:hidAttribsDict];
}
-
+
[hidAttribsDict release];
hidAttribsDict = nil;
-
+
return(YES);
}while(0);
-
+
cleanUp:
if (([self delegate]!=nil) &&
@@ -1413,7 +1413,7 @@ static HIDRemote *sHIDRemote = nil;
{
if (error!=nil)
{
- error = [NSError errorWithDomain:[error domain]
+ error = [NSError errorWithDomain:[error domain]
code:[error code]
userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:errorCode] forKey:@"InternalErrorCode"]
];
@@ -1421,7 +1421,7 @@ static HIDRemote *sHIDRemote = nil;
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self failedNewHardwareWithError:error];
}
-
+
// An error occured or this device is not of interest .. cleanup ..
if (serviceNotification!=0)
{
@@ -1434,7 +1434,7 @@ static HIDRemote *sHIDRemote = nil;
CFRunLoopSourceInvalidate(queueEventSource);
queueEventSource=NULL;
}
-
+
if (hidQueueInterface!=NULL)
{
if (queueStarted)
@@ -1451,13 +1451,13 @@ static HIDRemote *sHIDRemote = nil;
[hidAttribsDict release];
hidAttribsDict = nil;
}
-
+
if (hidElements!=NULL)
{
CFRelease(hidElements);
hidElements = NULL;
}
-
+
if (hidDeviceInterface!=NULL)
{
if (opened)
@@ -1468,13 +1468,13 @@ static HIDRemote *sHIDRemote = nil;
// opened = NO;
hidDeviceInterface = NULL;
}
-
+
if (cfPluginInterface!=NULL)
{
IODestroyPlugInInterface(cfPluginInterface);
cfPluginInterface = NULL;
}
-
+
return (NO);
}
@@ -1482,14 +1482,14 @@ static HIDRemote *sHIDRemote = nil;
{
NSNumber *serviceValue;
NSMutableDictionary *serviceDict = NULL;
-
+
if ((serviceValue = [NSNumber numberWithUnsignedInt:(unsigned int)service]) == nil)
{
return;
}
-
+
serviceDict = [_serviceAttribMap objectForKey:serviceValue];
-
+
if (serviceDict!=nil)
{
IOHIDDeviceInterface122 **hidDeviceInterface = NULL;
@@ -1509,7 +1509,7 @@ static HIDRemote *sHIDRemote = nil;
cfPluginInterface = (IOCFPlugInInterface **) ([serviceDict objectForKey:kHIDRemoteCFPluginInterface] ? [[serviceDict objectForKey:kHIDRemoteCFPluginInterface] pointerValue] : NULL);
cookieButtonMap = (NSMutableDictionary *) [serviceDict objectForKey:kHIDRemoteCookieButtonCodeLUT];
simulateHoldTimer = (NSTimer *) [serviceDict objectForKey:kHIDRemoteSimulateHoldEventsTimer];
-
+
[serviceDict retain];
[_serviceAttribMap removeObjectForKey:serviceValue];
@@ -1529,7 +1529,7 @@ static HIDRemote *sHIDRemote = nil;
{
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self releasedHardwareWithAttributes:serviceDict];
}
-
+
if (simulateHoldTimer!=nil)
{
[simulateHoldTimer invalidate];
@@ -1546,12 +1546,12 @@ static HIDRemote *sHIDRemote = nil;
queueEventSource,
kCFRunLoopCommonModes);
}
-
+
if ((hidQueueInterface!=NULL) && (cookieButtonMap!=nil))
{
NSEnumerator *cookieEnum = [cookieButtonMap keyEnumerator];
NSNumber *cookie;
-
+
while ((cookie = [cookieEnum nextObject]) != nil)
{
if ((*hidQueueInterface)->hasElement(hidQueueInterface, (IOHIDElementCookie) [cookie unsignedIntValue]))
@@ -1561,25 +1561,25 @@ static HIDRemote *sHIDRemote = nil;
}
};
}
-
+
if (hidQueueInterface!=NULL)
{
(*hidQueueInterface)->stop(hidQueueInterface);
(*hidQueueInterface)->dispose(hidQueueInterface);
(*hidQueueInterface)->Release(hidQueueInterface);
}
-
+
if (hidDeviceInterface!=NULL)
{
(*hidDeviceInterface)->close(hidDeviceInterface);
(*hidDeviceInterface)->Release(hidDeviceInterface);
}
-
+
if (cfPluginInterface!=NULL)
{
IODestroyPlugInInterface(cfPluginInterface);
}
-
+
if (theService!=0)
{
IOObjectRelease(theService);
@@ -1596,11 +1596,11 @@ static HIDRemote *sHIDRemote = nil;
NSMutableDictionary *hidAttribsDict;
NSTimer *shTimer;
NSNumber *shButtonCode;
-
+
if ((hidAttribsDict = (NSMutableDictionary *)[aTimer userInfo]) != nil)
{
if (((shTimer = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsTimer]) != nil) &&
- ((shButtonCode = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode]) != nil))
+ ((shButtonCode = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode]) != nil))
{
[shTimer invalidate];
[hidAttribsDict removeObjectForKey:kHIDRemoteSimulateHoldEventsTimer];
@@ -1630,16 +1630,16 @@ static HIDRemote *sHIDRemote = nil;
if (isPressed)
{
[hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:buttonCode] forKey:kHIDRemoteSimulateHoldEventsOriginButtonCode];
-
+
if ((shTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:0.7] interval:0.1 target:self selector:@selector(_simulateHoldEvent:) userInfo:hidAttribsDict repeats:NO]) != nil)
{
[hidAttribsDict setObject:shTimer forKey:kHIDRemoteSimulateHoldEventsTimer];
-
+
// Using CFRunLoopAddTimer instead of [[NSRunLoop currentRunLoop] addTimer:.. for consistency with run loop modes.
// The kCFRunLoopCommonModes counterpart NSRunLoopCommonModes is only available in 10.5 and later, whereas this code
// is designed to be also compatible with 10.4. CFRunLoopTimerRef is "toll-free-bridged" with NSTimer since 10.0.
CFRunLoopAddTimer(CFRunLoopGetCurrent(), (CFRunLoopTimerRef)shTimer, kCFRunLoopCommonModes);
-
+
[shTimer release];
break;
@@ -1649,7 +1649,7 @@ static HIDRemote *sHIDRemote = nil;
{
shTimer = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsTimer];
shButtonCode = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode];
-
+
if ((shTimer!=nil) && (shButtonCode!=nil))
{
[self _sendButtonCode:(HIDRemoteButtonCode)[shButtonCode unsignedIntValue] isPressed:YES hidAttribsDict:hidAttribsDict];
@@ -1666,10 +1666,10 @@ static HIDRemote *sHIDRemote = nil;
[hidAttribsDict removeObjectForKey:kHIDRemoteSimulateHoldEventsTimer];
[hidAttribsDict removeObjectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode];
-
+
break;
}
-
+
default:
[self _sendButtonCode:buttonCode isPressed:isPressed hidAttribsDict:hidAttribsDict];
break;
@@ -1711,14 +1711,14 @@ static HIDRemote *sHIDRemote = nil;
}
break;
}
-
+
// As soon as we have received a code that's unique to the Aluminum Remote, we can tell kHIDRemoteButtonCodePlayHold and kHIDRemoteButtonCodeCenterHold apart.
// Prior to that, a long press of the new "Play" button will be submitted as a "kHIDRemoteButtonCodeCenterHold", not a "kHIDRemoteButtonCodePlayHold" code.
if ((buttonCode == kHIDRemoteButtonCodeCenterHold) && (_lastSeenModel == kHIDRemoteModelAluminum))
{
buttonCode = kHIDRemoteButtonCodePlayHold;
}
-
+
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self eventWithButton:(buttonCode & (~kHIDRemoteButtonCodeAluminumMask)) isPressed:isPressed fromHardwareWithAttributes:hidAttribsDict];
}
}
@@ -1726,19 +1726,19 @@ static HIDRemote *sHIDRemote = nil;
- (void)_hidEventFor:(io_service_t)hidDevice from:(IOHIDQueueInterface **)interface withResult:(IOReturn)result
{
NSMutableDictionary *hidAttribsDict = [[[_serviceAttribMap objectForKey:[NSNumber numberWithUnsignedInt:(unsigned int)hidDevice]] retain] autorelease];
-
+
if (hidAttribsDict!=nil)
{
IOHIDQueueInterface **queueInterface = NULL;
-
+
queueInterface = [[hidAttribsDict objectForKey:kHIDRemoteHIDQueueInterface] pointerValue];
-
+
if (interface == queueInterface)
{
NSNumber *lastButtonPressedNumber = nil;
HIDRemoteButtonCode lastButtonPressed = kHIDRemoteButtonCodeNone;
NSMutableDictionary *cookieButtonMap = nil;
-
+
cookieButtonMap = [hidAttribsDict objectForKey:kHIDRemoteCookieButtonCodeLUT];
if ((lastButtonPressedNumber = [hidAttribsDict objectForKey:kHIDRemoteLastButtonPressed]) != nil)
@@ -1750,27 +1750,27 @@ static HIDRemote *sHIDRemote = nil;
{
IOHIDEventStruct hidEvent;
AbsoluteTime supportedTime = { 0,0 };
-
+
result = (*queueInterface)->getNextEvent( queueInterface,
&hidEvent,
supportedTime,
0);
-
+
if (result == kIOReturnSuccess)
{
NSNumber *buttonCodeNumber = [cookieButtonMap objectForKey:[NSNumber numberWithUnsignedInt:(unsigned int) hidEvent.elementCookie]];
-
+
#ifdef _HIDREMOTE_EXTENSIONS
// Debug logging code
#define _HIDREMOTE_EXTENSIONS_SECTION 5
#include "HIDRemoteAdditions.h"
#undef _HIDREMOTE_EXTENSIONS_SECTION
#endif /* _HIDREMOTE_EXTENSIONS */
-
+
if (buttonCodeNumber!=nil)
{
HIDRemoteButtonCode buttonCode = [buttonCodeNumber unsignedIntValue];
-
+
if (hidEvent.value == 0)
{
if (buttonCode == lastButtonPressed)
@@ -1795,21 +1795,21 @@ static HIDRemote *sHIDRemote = nil;
{
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self remoteIDChangedOldID:_lastSeenRemoteID newID:hidEvent.value forHardwareWithAttributes:hidAttribsDict];
}
-
+
_lastSeenRemoteID = hidEvent.value;
_lastSeenModel = kHIDRemoteModelUndetermined;
}
-
+
[self _handleButtonCode:buttonCode isPressed:YES hidAttribsDict:hidAttribsDict];
lastButtonPressed = buttonCode;
}
}
}
};
-
+
[hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:lastButtonPressed] forKey:kHIDRemoteLastButtonPressed];
}
-
+
#ifdef _HIDREMOTE_EXTENSIONS
// Debug logging code
#define _HIDREMOTE_EXTENSIONS_SECTION 6
@@ -1844,9 +1844,9 @@ static HIDRemote *sHIDRemote = nil;
{
NSArray *consoleUsersArray;
io_service_t rootService;
-
+
if (_masterPort==0) { return; }
-
+
if ((rootService = IORegistryGetRootEntry(_masterPort)) != 0)
{
if ((consoleUsersArray = (NSArray *)IORegistryEntryCreateCFProperty((io_registry_entry_t)rootService, CFSTR("IOConsoleUsers"), kCFAllocatorDefault, 0)) != nil)
@@ -1854,13 +1854,13 @@ static HIDRemote *sHIDRemote = nil;
if ([consoleUsersArray isKindOfClass:[NSArray class]]) // Be careful - ensure this really is an array
{
NSEnumerator *consoleUsersEnum; // I *love* Obj-C2's fast enumerators, but we need to stay compatible with 10.4 :-/
-
+
if ((consoleUsersEnum = [consoleUsersArray objectEnumerator]) != nil)
{
UInt64 secureEventInputPIDSum = 0;
uid_t frontUserSession = 0;
NSDictionary *consoleUserDict;
-
+
while ((consoleUserDict = [consoleUsersEnum nextObject]) != nil)
{
if ([consoleUserDict isKindOfClass:[NSDictionary class]]) // Be careful - ensure this really is a dictionary
@@ -1868,7 +1868,7 @@ static HIDRemote *sHIDRemote = nil;
NSNumber *secureInputPID;
NSNumber *onConsole;
NSNumber *userID;
-
+
if ((secureInputPID = [consoleUserDict objectForKey:@"kCGSSessionSecureInputPID"]) != nil)
{
if ([secureInputPID isKindOfClass:[NSNumber class]])
@@ -1876,7 +1876,7 @@ static HIDRemote *sHIDRemote = nil;
secureEventInputPIDSum += ((UInt64) [secureInputPID intValue]);
}
}
-
+
if (((onConsole = [consoleUserDict objectForKey:@"kCGSSessionOnConsoleKey"]) != nil) &&
((userID = [consoleUserDict objectForKey:@"kCGSSessionUserIDKey"]) != nil))
{
@@ -1895,10 +1895,10 @@ static HIDRemote *sHIDRemote = nil;
_lastFrontUserSession = frontUserSession;
}
}
-
+
CFRelease((CFTypeRef)consoleUsersArray);
}
-
+
IOObjectRelease((io_object_t) rootService);
}
}
@@ -1909,15 +1909,15 @@ static HIDRemote *sHIDRemote = nil;
{
UInt64 old_lastSecureEventInputPIDSum = _lastSecureEventInputPIDSum;
uid_t old_lastFrontUserSession = _lastFrontUserSession;
-
+
[self _updateSessionInformation];
-
+
if (((old_lastSecureEventInputPIDSum != _lastSecureEventInputPIDSum) || (old_lastFrontUserSession != _lastFrontUserSession)) && _secureEventInputWorkAround)
{
if ((_mode == kHIDRemoteModeExclusive) || (_mode == kHIDRemoteModeExclusiveAuto))
{
HIDRemoteMode restartInMode = _mode;
-
+
_isRestarting = YES;
[self stopRemoteControl];
[self startRemoteControl:restartInMode];
@@ -1931,7 +1931,7 @@ static HIDRemote *sHIDRemote = nil;
#pragma mark -- PRIVATE: IOKitLib Callbacks --
-static void HIDEventCallback( void * target,
+static void HIDEventCallback( void * target,
IOReturn result,
void * refCon,
void * sender)
@@ -1963,7 +1963,7 @@ static void ServiceNotificationCallback(void * refCon,
{
HIDRemote *hidRemote = (HIDRemote *)refCon;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
+
[hidRemote _serviceNotificationFor:service
messageType:messageType
messageArgument:messageArgument];
@@ -1978,7 +1978,7 @@ static void SecureInputNotificationCallback( void * refCon,
{
HIDRemote *hidRemote = (HIDRemote *)refCon;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
+
[hidRemote _secureInputNotificationFor:service
messageType:messageType
messageArgument:messageArgument];