Actually check that PumpDevices have the correct vid/pid.
This commit is contained in:
@@ -55,7 +55,11 @@ bool HIDDevice::Open( io_object_t device )
|
||||
vid = 0;
|
||||
if( !IntValue(pidRef, pid) )
|
||||
pid = 0;
|
||||
InitDevice( vid, pid );
|
||||
if( !InitDevice(vid, pid) )
|
||||
{
|
||||
CFRelease( properties );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( object && CFGetTypeID(object) == CFStringGetTypeID() )
|
||||
m_sDescription = CFStringGetCStringPtr( CFStringRef(object), CFStringGetSystemEncoding() );
|
||||
|
||||
@@ -75,7 +75,7 @@ protected:
|
||||
/*
|
||||
* Optional. Subclasses can initialize the device, if required.
|
||||
*/
|
||||
virtual void InitDevice( int vid, int pid ) { }
|
||||
virtual bool InitDevice( int vid, int pid ) { return true; }
|
||||
|
||||
// This adds the element with the given cookie to the queue to be notified of state changes.
|
||||
inline void AddElementToQueue( int cookie )
|
||||
|
||||
@@ -121,16 +121,17 @@ void JoystickDevice::Open()
|
||||
}
|
||||
}
|
||||
|
||||
void JoystickDevice::InitDevice( int vid, int pid )
|
||||
bool JoystickDevice::InitDevice( int vid, int pid )
|
||||
{
|
||||
if( vid != 0x0507 || pid != 0x0011 )
|
||||
return;
|
||||
return true;
|
||||
// It's a Para controller so try to power it on.
|
||||
uint8_t powerOn = 1;
|
||||
IOReturn ret = SetReport( kIOHIDReportTypeFeature, 0, &powerOn, 1, 10 );
|
||||
|
||||
if( ret )
|
||||
LOG->Warn( "Failed to power on the Para controller: %#08x", ret );
|
||||
return ret == kIOReturnSuccess;
|
||||
}
|
||||
|
||||
void JoystickDevice::GetButtonPresses( vector<DeviceInput>& vPresses, int cookie, int value, const RageTimer& now ) const
|
||||
|
||||
@@ -28,7 +28,7 @@ protected:
|
||||
bool AddLogicalDevice( int usagePage, int usage );
|
||||
void AddElement( int usagePage, int usage, int cookie, const CFDictionaryRef properties );
|
||||
void Open();
|
||||
void InitDevice( int vid, int pid );
|
||||
bool InitDevice( int vid, int pid );
|
||||
|
||||
public:
|
||||
void GetButtonPresses( vector<DeviceInput>& vPresses, int cookie, int value, const RageTimer& now ) const;
|
||||
|
||||
@@ -13,7 +13,7 @@ protected:
|
||||
void AddElement( int usagePage, int usage, int cookie,
|
||||
const CFDictionaryRef properties ) { }
|
||||
void Open();
|
||||
bool SupportsVidPid( int vid, int pid ) { return vid == 0x0d2f && pid == 0x0001; }
|
||||
bool InitDevice( int vid, int pid ) { return vid == 0x0d2f && pid == 0x0001; }
|
||||
|
||||
public:
|
||||
void GetButtonPresses( vector<DeviceInput>& vPresses, int cookie, int value, const RageTimer& now ) const;
|
||||
|
||||
Reference in New Issue
Block a user