From e0bdb49537021656c1a5344c587c7a786b0424a4 Mon Sep 17 00:00:00 2001 From: Mark Cannon Date: Wed, 13 Feb 2008 14:32:00 +0000 Subject: [PATCH] git-svn-id: https://openitg.svn.sourceforge.net/svnroot/openitg@16 83fadc84-e282-4d84-a09a-c4228d6ae7e5 --- src/USBDevice.h | 50 ---------------------- src/USBDriver.cpp | 15 ------- src/USBDriver.h | 50 ---------------------- src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp | 37 ++++++++++++++-- src/arch/InputHandler/InputHandler_Linux_PIUIO.h | 10 ++++- 5 files changed, 41 insertions(+), 121 deletions(-) delete mode 100644 src/USBDevice.h delete mode 100644 src/USBDriver.cpp delete mode 100644 src/USBDriver.h diff --git a/src/USBDevice.h b/src/USBDevice.h deleted file mode 100644 index 80b8f63d..00000000 --- a/src/USBDevice.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef INPUT_HANDLER_USBDRIVER_H -#define INPUT_HANDLER_USBDRIVER_H - -#include -#include "InputHandler.h" - -class USBDevice -{ -public: - USBDevice(); - ~USBDevice(); - - bool Load(); - - CString GetDeviceProperty( CString sProperty ); - CString GetInterfaceProperty( CString sProperty, int iInterface ); - CString GetClassDescription( int iClass ); - CString GetDescription(); - - bool IsHub(); - bool IsITGIO(); - bool IsPIUIO(); -}; - -#endif - -/* - * (c) 2008 BoXoRRoXoRs - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ diff --git a/src/USBDriver.cpp b/src/USBDriver.cpp deleted file mode 100644 index e406cb42..00000000 --- a/src/USBDriver.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "global.h" -#include - -CString USBDevice::GetClassDescription( int iClass ) -{ - return "not implemented"; -} - -CString USBDevice::GetDescription() -{ - if( IsITGIO() || IsPIUIO() ) - return "Input/lights controller"; - - return "Description not implemented"; -} diff --git a/src/USBDriver.h b/src/USBDriver.h deleted file mode 100644 index 80b8f63d..00000000 --- a/src/USBDriver.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef INPUT_HANDLER_USBDRIVER_H -#define INPUT_HANDLER_USBDRIVER_H - -#include -#include "InputHandler.h" - -class USBDevice -{ -public: - USBDevice(); - ~USBDevice(); - - bool Load(); - - CString GetDeviceProperty( CString sProperty ); - CString GetInterfaceProperty( CString sProperty, int iInterface ); - CString GetClassDescription( int iClass ); - CString GetDescription(); - - bool IsHub(); - bool IsITGIO(); - bool IsPIUIO(); -}; - -#endif - -/* - * (c) 2008 BoXoRRoXoRs - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ diff --git a/src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp b/src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp index d1d936ef..797f726f 100644 --- a/src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp +++ b/src/arch/InputHandler/InputHandler_Linux_PIUIO.cpp @@ -9,11 +9,13 @@ InputHandler_Linux_PIUIO::InputHandler_Linux_PIUIO() { m_bShutdown = false; - // initialise m_pDevice +// IOBoard.FindDevice - // device found and opened - if( m_pDevice.Open() ) + // device found and set + if( IOBoard.Open() ) { + m_iLightData = 0; // initialise + InputThread.SetName( "PIUIO thread" ); InputThread.Create( InputThread_Start, this ); } @@ -102,11 +104,38 @@ int InputHandler_Linux_PIUIO::InputThread_Start( void *p ) void InputHandler_Linux_PIUIO::InputThreadMain() { - + UpdateLights(); } void InputHandler_Linux_PIUIO::UpdateLights() { // XXX: need to check LightsDriver somehow ASSERT( g_LightsState ); + + // lighting needs cleaned up - vector/array map? + // currently, I just want to get all this outlined. + // it might even be completely wrong, but at least + // we'll know what we're doing. + + // probably marquee lights + if( g_LightsState[0] ) m_iLightData += (1 << 22); + if( g_LightsState[1] ) m_iLightData += (1 << 25); + if( g_LightsState[2] ) m_iLightData += (1 << 24); + if( g_LightsState[3] ) m_iLightData += (1 << 23); + + // probably bass neons + if( g_LightsState[6] || g_LightsState[7] ) + m_iLightData += (1 << 10); + + // pad lighting P1 + if( g_LightsState[08] ) m_iLightData += (1 << 19); + if( g_LightsState[09] ) m_iLightData += (1 << 20); + if( g_LightsState[10] ) m_iLightData += (1 << 17); + if( g_LightsState[11] ) m_iLightData += (1 << 18); + + // pad lighting P2 + if( g_LightsState[28] ) m_iLightData += (1 << 4); + if( g_LightsState[29] ) m_iLightData += (1 << 5); + if( g_LightsState[30] ) m_iLightData += (1 << 2); + if( g_LightsState[31] ) m_iLightData += (1 << 3); } diff --git a/src/arch/InputHandler/InputHandler_Linux_PIUIO.h b/src/arch/InputHandler/InputHandler_Linux_PIUIO.h index f2cc2e71..8bbe5a59 100644 --- a/src/arch/InputHandler/InputHandler_Linux_PIUIO.h +++ b/src/arch/InputHandler/InputHandler_Linux_PIUIO.h @@ -1,10 +1,14 @@ #ifndef INPUT_HANDLER_LINUX_PIUIO_H #define INPUT_HANDLER_LINUX_PIUIO_H +/* I've heard bad things about portability relating to stdint. / +/ If you run into any problems, let me know. - Vyhd */ +#include + #include "InputHandler.h" #include "RageThreads.h" #include "InputHandler_USBDriver.h" -#include "USBDevice.h" +#include "io/PIUIO.h" class InputHandler_Linux_PIUIO: public InputHandler { @@ -14,9 +18,11 @@ public: void Update( float fDeltaTime ); private: -// USBDevice *m_pDevice; + PIUIO IOBoard; RageThread InputThread; + bool m_bShutdown; + uint32_t m_iLightData; static int InputThread_Start( void *p ); -- 2.11.0