Commit f556fb16 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fixed IR Remote HID support

parent 9932d0f9
...@@ -72,18 +72,39 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4; ...@@ -72,18 +72,39 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
hidDeviceInterface = NULL; hidDeviceInterface = NULL;
cookieToButtonMapping = [[NSMutableDictionary alloc] init]; cookieToButtonMapping = [[NSMutableDictionary alloc] init];
/* we're on Leopard and need to use a different set of cookies then we used to on Tiger and earlier */ if( NSAppKitVersionNumber < 1038.13 )
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus] forKey:@"31_29_28_18_"]; {
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus] forKey:@"31_30_28_18_"]; /* Leopard and early Snow Leopard Cookies */
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu] forKey:@"31_20_18_31_20_18_"]; msg_Dbg( VLCIntf, "using Leopard AR cookies" );
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay] forKey:@"31_21_18_31_21_18_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus] forKey:@"31_29_28_18_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight] forKey:@"31_22_18_31_22_18_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus] forKey:@"31_30_28_18_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft] forKey:@"31_23_18_31_23_18_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu] forKey:@"31_20_18_31_20_18_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight_Hold] forKey:@"31_18_4_2_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay] forKey:@"31_21_18_31_21_18_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft_Hold] forKey:@"31_18_3_2_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight] forKey:@"31_22_18_31_22_18_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu_Hold] forKey:@"31_18_31_18_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft] forKey:@"31_23_18_31_23_18_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"35_31_18_35_31_18_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight_Hold] forKey:@"31_18_4_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"]; [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft_Hold] forKey:@"31_18_3_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu_Hold] forKey:@"31_18_31_18_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"35_31_18_35_31_18_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"];
}
else
{
/* current Snow Leopard cookies */
msg_Dbg( VLCIntf, "using Snow Leopard AR cookies" );
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus] forKey:@"33_31_30_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus] forKey:@"33_32_30_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu] forKey:@"33_22_21_20_2_33_22_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay] forKey:@"33_23_21_20_2_33_23_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight] forKey:@"33_24_21_20_2_33_24_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft] forKey:@"33_25_21_20_2_33_25_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight_Hold] forKey:@"33_21_20_14_12_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft_Hold] forKey:@"33_21_20_13_12_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu_Hold] forKey:@"33_21_20_2_33_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"37_33_21_20_2_37_33_21_20_2_"];
[cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"];
}
/* defaults */ /* defaults */
[self setSimulatesPlusMinusHold: YES]; [self setSimulatesPlusMinusHold: YES];
...@@ -451,7 +472,7 @@ static AppleRemote* sharedInstance=nil; ...@@ -451,7 +472,7 @@ static AppleRemote* sharedInstance=nil;
[self handleEventWithCookieString: lastSubCookieString sumOfValues:0]; [self handleEventWithCookieString: lastSubCookieString sumOfValues:0];
} }
if ([cookieString length] > 0) { if ([cookieString length] > 0) {
NSLog(@"Unknown button for cookiestring %@", cookieString); msg_Warn( VLCIntf, "Unknown AR button for cookiestring %s", [cookieString UTF8String]);
} }
} }
} }
...@@ -504,7 +525,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon, ...@@ -504,7 +525,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
ioReturnValue = IOObjectGetClass(hidDevice, className); ioReturnValue = IOObjectGetClass(hidDevice, className);
if (ioReturnValue != kIOReturnSuccess) { if (ioReturnValue != kIOReturnSuccess) {
NSLog(@"Error: Failed to get class name."); msg_Err( VLCIntf, "Failed to get IOKit class name.");
return NULL; return NULL;
} }
...@@ -519,7 +540,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon, ...@@ -519,7 +540,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
plugInResult = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (LPVOID) &hidDeviceInterface); plugInResult = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (LPVOID) &hidDeviceInterface);
if (plugInResult != S_OK) { if (plugInResult != S_OK) {
NSLog(@"Error: Couldn't create HID class device interface"); msg_Err( VLCIntf, "Couldn't create HID class device interface");
} }
// Release // Release
if (plugInInterface) (*plugInInterface)->Release(plugInInterface); if (plugInInterface) (*plugInInterface)->Release(plugInInterface);
...@@ -633,13 +654,13 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon, ...@@ -633,13 +654,13 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
(*queue)->start(queue); (*queue)->start(queue);
return YES; return YES;
} else { } else {
NSLog(@"Error when setting event callout"); msg_Err( VLCIntf, "Error when setting event callout");
} }
} else { } else {
NSLog(@"Error when creating async event source"); msg_Err( VLCIntf, "Error when creating async event source");
} }
} else { } else {
NSLog(@"Error when opening device"); msg_Err( VLCIntf, "Error when opening HUD device");
} }
} }
return NO; return NO;
...@@ -657,7 +678,6 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon, ...@@ -657,7 +678,6 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
} }
- (void) dealloc { - (void) dealloc {
NSLog(@"Dealloc");
[applicationDelegate release]; [applicationDelegate release];
[super dealloc]; [super dealloc];
} }
......
...@@ -361,10 +361,6 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -361,10 +361,6 @@ static VLCMain *_o_sharedMainInstance = nil;
i_lastShownVolume = -1; i_lastShownVolume = -1;
o_remote = [[AppleRemote alloc] init];
[o_remote setClickCountEnabledButtons: kRemoteButtonPlay];
[o_remote setDelegate: _o_sharedMainInstance];
o_eyetv = [[VLCEyeTVController alloc] init]; o_eyetv = [[VLCEyeTVController alloc] init];
/* announce our launch to a potential eyetv plugin */ /* announce our launch to a potential eyetv plugin */
...@@ -555,6 +551,11 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -555,6 +551,11 @@ static VLCMain *_o_sharedMainInstance = nil;
name: NSControlTintDidChangeNotification name: NSControlTintDidChangeNotification
object: nil]; object: nil];
/* init Apple Remote support */
o_remote = [[AppleRemote alloc] init];
[o_remote setClickCountEnabledButtons: kRemoteButtonPlay];
[o_remote setDelegate: _o_sharedMainInstance];
/* yeah, we are done */ /* yeah, we are done */
nib_main_loaded = TRUE; nib_main_loaded = TRUE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment