cleanup some osx keyboard code...still can't get mouse or hid transactions to work (although supposedly the kernel caches reports anyways)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5411 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
06f0bc91ee
commit
a4acd0d66c
|
@ -20,7 +20,7 @@ protected:
|
||||||
|
|
||||||
struct State
|
struct State
|
||||||
{
|
{
|
||||||
unsigned char buttons[32];
|
Boolean *keyboard_keys;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Input : public ControllerInterface::Device::Input
|
class Input : public ControllerInterface::Device::Input
|
||||||
|
|
|
@ -34,6 +34,7 @@ static void DeviceMatching_callback(void* inContext,
|
||||||
void* inSender,
|
void* inSender,
|
||||||
IOHIDDeviceRef inIOHIDDeviceRef)
|
IOHIDDeviceRef inIOHIDDeviceRef)
|
||||||
{
|
{
|
||||||
|
NSLog(@"-------------------------");
|
||||||
NSLog(@"Got Device: %@", IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(kIOHIDProductKey)));
|
NSLog(@"Got Device: %@", IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(kIOHIDProductKey)));
|
||||||
|
|
||||||
// Add to the devices vector if it's of a type we want
|
// Add to the devices vector if it's of a type we want
|
||||||
|
@ -44,13 +45,12 @@ static void DeviceMatching_callback(void* inContext,
|
||||||
std::vector<ControllerInterface::Device*> *devices = (std::vector<ControllerInterface::Device*> *)inContext;
|
std::vector<ControllerInterface::Device*> *devices = (std::vector<ControllerInterface::Device*> *)inContext;
|
||||||
devices->push_back(new KeyboardMouse(inIOHIDDeviceRef));
|
devices->push_back(new KeyboardMouse(inIOHIDDeviceRef));
|
||||||
}
|
}
|
||||||
/* else if (IOHIDDeviceConformsTo(inIOHIDDeviceRef, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad))
|
else
|
||||||
{
|
{
|
||||||
}*/
|
|
||||||
else {
|
|
||||||
// Actually, we don't want it
|
// Actually, we don't want it
|
||||||
NSLog(@"Throwing away...");
|
NSLog(@"Throwing away...");
|
||||||
#define shortlog(x) NSLog(@"%s: %@", x, IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(x)));
|
#define shortlog(x)
|
||||||
|
//#define shortlog(x) NSLog(@"%s: %@", x, IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(x)));
|
||||||
shortlog(kIOHIDTransportKey)
|
shortlog(kIOHIDTransportKey)
|
||||||
shortlog(kIOHIDVendorIDKey)
|
shortlog(kIOHIDVendorIDKey)
|
||||||
shortlog(kIOHIDVendorIDSourceKey)
|
shortlog(kIOHIDVendorIDSourceKey)
|
||||||
|
@ -72,19 +72,7 @@ static void DeviceMatching_callback(void* inContext,
|
||||||
shortlog(kIOHIDReportIntervalKey)
|
shortlog(kIOHIDReportIntervalKey)
|
||||||
shortlog(kIOHIDReportDescriptorKey)
|
shortlog(kIOHIDReportDescriptorKey)
|
||||||
#undef shortlog
|
#undef shortlog
|
||||||
NSLog(@"\n\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Will come in handy if we support hotplugging
|
|
||||||
static void DeviceRemoval_callback(void *inContext,
|
|
||||||
IOReturn inResult,
|
|
||||||
void *inSender,
|
|
||||||
IOHIDDeviceRef inIOHIDDeviceRef)
|
|
||||||
{
|
|
||||||
NSLog(@"%s( context: %p, result: %p, sender: %p, device: %p )",
|
|
||||||
__PRETTY_FUNCTION__, inContext, (void *)inResult, inSender, (void *)inIOHIDDeviceRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init( std::vector<ControllerInterface::Device*>& devices )
|
void Init( std::vector<ControllerInterface::Device*>& devices )
|
||||||
|
@ -114,7 +102,6 @@ void Init( std::vector<ControllerInterface::Device*>& devices )
|
||||||
|
|
||||||
// Callbacks for acquisition or loss of a matching device
|
// Callbacks for acquisition or loss of a matching device
|
||||||
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, DeviceMatching_callback, (void *)&devices);
|
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, DeviceMatching_callback, (void *)&devices);
|
||||||
IOHIDManagerRegisterDeviceRemovalCallback(HIDManager, DeviceRemoval_callback, (void *)&devices);
|
|
||||||
|
|
||||||
// Match devices that are plugged right now.
|
// Match devices that are plugged right now.
|
||||||
IOHIDManagerScheduleWithRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
IOHIDManagerScheduleWithRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
||||||
|
@ -125,9 +112,7 @@ void Init( std::vector<ControllerInterface::Device*>& devices )
|
||||||
while (CFRunLoopRunInMode(OurRunLoop,0,TRUE) == kCFRunLoopRunHandledSource);
|
while (CFRunLoopRunInMode(OurRunLoop,0,TRUE) == kCFRunLoopRunHandledSource);
|
||||||
|
|
||||||
// Things should be configured now. Disable hotplugging and other scheduling
|
// Things should be configured now. Disable hotplugging and other scheduling
|
||||||
// TODO: support hotplugging, get rid of the following:
|
|
||||||
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, NULL, NULL);
|
IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, NULL, NULL);
|
||||||
IOHIDManagerRegisterDeviceRemovalCallback(HIDManager, NULL, NULL);
|
|
||||||
IOHIDManagerUnscheduleFromRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
IOHIDManagerUnscheduleFromRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +202,9 @@ KeyboardMouse::KeyboardMouse(IOHIDDeviceRef device)
|
||||||
{
|
{
|
||||||
outputs.push_back(new Light(e));
|
outputs.push_back(new Light(e));
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
DeviceElementDebugPrint((void *)e, NULL);
|
{
|
||||||
|
// DeviceElementDebugPrint(e, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -278,6 +264,7 @@ ControlState KeyboardMouse::Key::GetState( const State* const state )
|
||||||
//NSLog(@"element %x value %x scaled %f", IOHIDElementGetUsage(m_key_element), value, scaled_value);
|
//NSLog(@"element %x value %x scaled %f", IOHIDElementGetUsage(m_key_element), value, scaled_value);
|
||||||
return scaled_value > 0;
|
return scaled_value > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue