From 0c210558587be138fc40c9b2e38a28731c557cba Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Tue, 28 Nov 2006 17:57:16 +0000 Subject: [PATCH] Nothing returns false. --- stepmania/src/archutils/Darwin/HIDDevice.cpp | 7 +------ stepmania/src/archutils/Darwin/HIDDevice.h | 4 ++-- stepmania/src/archutils/Darwin/JoystickDevice.cpp | 6 +++--- stepmania/src/archutils/Darwin/JoystickDevice.h | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/stepmania/src/archutils/Darwin/HIDDevice.cpp b/stepmania/src/archutils/Darwin/HIDDevice.cpp index 8a2844c8f2..f2ce3d713d 100644 --- a/stepmania/src/archutils/Darwin/HIDDevice.cpp +++ b/stepmania/src/archutils/Darwin/HIDDevice.cpp @@ -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() ); diff --git a/stepmania/src/archutils/Darwin/HIDDevice.h b/stepmania/src/archutils/Darwin/HIDDevice.h index 5bd6fe10af..6724beccf6 100644 --- a/stepmania/src/archutils/Darwin/HIDDevice.h +++ b/stepmania/src/archutils/Darwin/HIDDevice.h @@ -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 ) diff --git a/stepmania/src/archutils/Darwin/JoystickDevice.cpp b/stepmania/src/archutils/Darwin/JoystickDevice.cpp index 3fc559d166..7f229be235 100644 --- a/stepmania/src/archutils/Darwin/JoystickDevice.cpp +++ b/stepmania/src/archutils/Darwin/JoystickDevice.cpp @@ -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& vPresses, int cookie, int value, const RageTimer& now ) const diff --git a/stepmania/src/archutils/Darwin/JoystickDevice.h b/stepmania/src/archutils/Darwin/JoystickDevice.h index 6a7b75a4d4..c30738b991 100644 --- a/stepmania/src/archutils/Darwin/JoystickDevice.h +++ b/stepmania/src/archutils/Darwin/JoystickDevice.h @@ -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& vPresses, int cookie, int value, const RageTimer& now ) const;