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