So I am playing with IOKit and getting input from my PS3 controller. It works and I can read the state of every button and both sticks. Sort of. I only get an integer value of 0 or 1 from the triggers and the dpad. When I test the controller on http://html5gamepad.com/ I see a float value from 0-1 on both. Does anybody know how to get the analog values?
My input value callback looks like:
inputCallback(void * context, IOReturn result, void * sender, IOHIDValueRef valueRef)
{
if (IOHIDValueGetLength(valueRef) > 2) {
return;
}
IOHIDElementRef element = IOHIDValueGetElement(valueRef);
if (CFGetTypeID(element) != IOHIDElementGetTypeID()) {
return;
}
int usagePage = IOHIDElementGetUsagePage(element);
int usage = IOHIDElementGetUsage(element);
CFIndex value = IOHIDValueGetIntegerValue(valueRef);
switch (usagePage)
...
I am on OS X 10.10.
Thanks