Nothing returns false.

This commit is contained in:
Steve Checkoway
2006-11-28 17:57:16 +00:00
parent 73832dfafd
commit 0c21055858
4 changed files with 7 additions and 12 deletions
+1 -6
View File
@@ -55,12 +55,7 @@ bool HIDDevice::Open( io_object_t device )
vid = 0;
if( !IntValue(pidRef, pid) )
pid = 0;
if( !SupportsVidPid(vid, pid) )
{
CFRelease( properties );
return false;
}
InitDevice( vid, pid );
if( object && CFGetTypeID(object) == CFStringGetTypeID() )
m_sDescription = CFStringGetCStringPtr( CFStringRef(object), CFStringGetSystemEncoding() );
+2 -2
View File
@@ -73,9 +73,9 @@ protected:
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.
inline void AddElementToQueue( int cookie )
@@ -120,17 +120,17 @@ void JoystickDevice::Open()
AddElementToQueue( j->first );
}
}
bool JoystickDevice::SupportsVidPid( int vid, int pid )
void JoystickDevice::InitDevice( int vid, int pid )
{
if( vid != 0x0507 || pid != 0x0011 )
return true;
return;
// 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 true;
}
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();
bool SupportsVidPid( int vid, int pid );
void InitDevice( int vid, int pid );
public:
void GetButtonPresses( vector<DeviceInput>& vPresses, int cookie, int value, const RageTimer& now ) const;