Basic support for the USB pump pad. It is not HID-compliant and reports strange values when buttons are pressed and released. In particular, it claims that it's values are in the range [0,1], yet actually returns values in the range [0,3]. Also, there are two instances where releasing two buttons sends the same report (UR and MID, as well as DL and DR).

I suspect this makes it pretty much impossible to use (although the guy with the pad has the glowing report of, "and it seemed to work OK") but without actually having a pad with which to test, it's about all I can do.
This commit is contained in:
Steve Checkoway
2006-02-24 13:29:15 +00:00
parent 1b923c5a14
commit c4fde125e4
5 changed files with 191 additions and 6 deletions
@@ -10,6 +10,7 @@
#include "archutils/Darwin/DarwinThreadHelpers.h"
#include "archutils/Darwin/KeyboardDevice.h"
#include "archutils/Darwin/JoystickDevice.h"
#include "archutils/Darwin/PumpDevice.h"
#include <IOKit/IOMessage.h>
void InputHandler_Carbon::QueueCallBack( void *target, int result, void *refcon, void *sender )
@@ -159,13 +160,15 @@ static HIDDevice *MakeDevice( InputDevice id )
return new KeyboardDevice;
if( id <= DEVICE_JOY16 )
return new JoystickDevice;
if( id <= DEVICE_PUMP2 )
return new PumpDevice;
return NULL;
}
void InputHandler_Carbon::AddDevices( int usage, InputDevice &id )
void InputHandler_Carbon::AddDevices( int usagePage, int usage, InputDevice &id )
{
io_iterator_t iter;
CFDictionaryRef dict = GetMatchingDictionary( kHIDPage_GenericDesktop, usage );
CFDictionaryRef dict = GetMatchingDictionary( usagePage, usage );
kern_return_t ret = IOServiceAddMatchingNotification( m_NotifyPort, kIOFirstMatchNotification, dict,
InputHandler_Carbon::DeviceAdded, this, &iter );
io_object_t device;
@@ -216,10 +219,12 @@ InputHandler_Carbon::InputHandler_Carbon() : m_Sem( "Input thread started" ), m_
m_NotifyPort = IONotificationPortCreate( kIOMasterPortDefault );
// Add devices.
AddDevices( kHIDUsage_GD_Keyboard, id );
AddDevices( kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard, id );
id = DEVICE_JOY1;
AddDevices( kHIDUsage_GD_Joystick, id );
AddDevices( kHIDUsage_GD_GamePad, id );
AddDevices( kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, id );
AddDevices( kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad, id );
id = DEVICE_PUMP1;
AddDevices( 0xFF00, 0x0001, id ); // Pump pads use the first vendor specific usage page.
m_bChanged = false;
if( PREFSMAN->m_bThreadedInput )