extern LightsState g_LightsState;
extern CString g_sInputType;
+// Iow lights thread is disabled for now: causes major, major input problems
+
InputHandler_Linux_Iow::InputHandler_Linux_Iow()
{
m_bShutdown = false;
m_bFoundDevice = true;
InputThread.SetName( "Iow thread" );
- LightsThread.SetName( "Iow lights thread" );
+// LightsThread.SetName( "Iow lights thread" );
InputThread.Create( InputThread_Start, this );
+// LightsThread.Create( LightsThread_Start, this );
g_sInputType = "ITGIO";
}
{
IOBoard.Read( &m_iInputData );
- if( PREFSMAN->m_bITGIOBitFlip )
- m_iInputData = ~m_iInputData;
+ m_iInputData = ~m_iInputData;
HandleInput();
- // give up 0.005 sec for other events -
+// UpdateLights();
+// IOBoard.Write( m_iWriteData );
+
+ // give up 0.008 sec for other events -
// this may need adjusting for lag/offsets
- usleep( 5000 );
+ usleep( 8000 );
}
}
void InputHandler_Linux_Iow::LightsThreadMain()
{
+/*
while( !m_bShutdown )
{
- UpdateLights();
- IOBoard.Write( m_iWriteData );
-
// give up 0.01 sec for other events -
// this may need adjusting for lag/offsets
usleep( 10000 );
}
+*/
}
-/* Thanks, ITG-IO documentation! <3 */
+/* Thanks, ITG-IO documentation. ):< */
void InputHandler_Linux_Iow::HandleInput()
{
- uint16_t i = 1; // convenience hack
+ uint32_t i = 1; // convenience hack
+ static const uint32_t iInputBits[NUM_IO_BUTTONS] = {
+ /* Player 1 - left, right, up, down */
+ (i << 18), (i << 19), (i << 16), (i << 17),
+
+ /* Player 1 - Select (unused), Start, MenuLeft, MenuRight */
+ 0, (i << 20), (i << 21), (i << 22),
+
+ /* Player 2 - left, right, up, down */
+ (i << 25), (i << 26), (i << 23), (i << 24),
+
+ /* Player 2 - Select (unused), Start, MenuLeft, MenuRight */
+ 0, (i << 27), (i << 28), (i << 29),
+
+ /* Service, coin insert */
+ // FIXME: Service is obviously wrong
+ (i << 1), (i << 31) };
- if( PREFSMAN->m_bDebugUSBInput && (m_iInputData != 0) && (m_iInputData != m_iLastInput) )
+ if( (m_iInputData != 0) )
{
if( LOG )
LOG->Info( "Input: %i", m_iInputData );
CString sInputs;
- for( unsigned x = 0; x < 16; x++ )
+ for( unsigned x = 0; x < 32; x++ )
{
/* the bit we expect isn't in the data */
+// if( (m_iInputData & (i << x)) )
if( !(m_iInputData & (i << x)) )
continue;
LOG->Info( sInputs );
}
- static const uint16_t iInputBits[NUM_IO_BUTTONS] = {
- /* Player 1 - left, right, up, down */
- (1 << 13), (1 << 12), (1 << 15), (1 << 14),
-
- /* Player 1 - Select (unused), Start, MenuLeft, MenuRight */
- 0, (1 << 11), (1 << 10), (1 << 9),
-
- /* Player 2 - left, right, up, down */
- (1 << 6), (1 << 5), (1 << 8), (1 << 7),
-
- /* Player 2 - Select (unused), Start, MenuLeft, MenuRight */
- 0, (1 << 4), (1 << 3), (1 << 2),
-
- /* Service, coin insert */
- (1 << 1), (1 << 0) };
-
InputDevice id = DEVICE_ITGIO;
for( int iButton = 0; iButton < NUM_IO_BUTTONS; iButton++ )
/* Requires "LightsDriver=ext" */
void InputHandler_Linux_Iow::UpdateLights()
{
- static const uint16_t iCabinetBits[NUM_CABINET_LIGHTS] = {
+ /* FIXME: none of these are tested, and it's likely none are right. */
+ static const uint32_t iCabinetBits[NUM_CABINET_LIGHTS] = {
/* Upper-left, upper-right, lower-left, lower-right marquee */
- (1 << 8), (1 << 10), (1 << 9), (1 << 11),
+ (1 << 24), (1 << 26), (1 << 25), (1 << 27),
/* P1 select, P2 select, both bass */
- (1 << 13), (1 << 12), (1 << 15), (1 << 15) };
+ (1 << 29), (1 << 28), (1 << 31), (1 << 31) };
- static const uint16_t iPadBits[2][4] =
+ static const uint32_t iPadBits[2][4] =
{
/* Left, right, up, down */
- { (1 << 1), (1 << 0), (1 << 3), (1 << 2) }, /* Player 1 */
- { (1 << 5), (1 << 4), (1 << 7), (1 << 6) } /* Player 2 */
+ { (1 << 17), (1 << 16), (1 << 19), (1 << 18) }, /* Player 1 */
+ { (1 << 21), (1 << 20), (1 << 23), (1 << 22) } /* Player 2 */
};
m_iLastWrite = m_iWriteData;
return false;\r
}\r
\r
-bool ITGIO::Read( uint16_t *pData )\r
+bool ITGIO::Read( uint32_t *pData )\r
{\r
int iResult;\r
\r
while( 1 )\r
{\r
/* XXX: I hate magic values. What do these mean? -- Vyhd */\r
- iResult = usb_control_msg(m_pHandle, 161, 1, 256, 0, (char *)pData, 2, 1000);\r
- if( iResult == 2 ) // all data read\r
+ iResult = usb_control_msg(m_pHandle, 161, 1, 256, 0, (char *)pData, 4, 1000);\r
+ if( iResult == 4 ) // all data read\r
break;\r
\r
// all data not read\r
return true;\r
}\r
\r
-bool ITGIO::Write( uint16_t iData )\r
+bool ITGIO::Write( uint32_t iData )\r
{\r
int iResult;\r
\r
while( 1 )\r
{\r
- iResult = usb_control_msg(m_pHandle, 33, 9, 512, 0, (char *)&iData, 2, 1000 );\r
- \r
- if( iResult == 2 ) // all data read\r
+ iResult = usb_control_msg(m_pHandle, 33, 9, 512, 0, (char *)&iData, 4, 1000 );\r
+ \r
+ if( iResult == 4 ) // all data read\r
break;\r
\r
Reconnect();\r
\r
void ITGIO::Reconnect()\r
{\r
+ LOG->Warn( "Attempting to reconnect ITGIO" );\r
//if( ??? )\r
// m_sInputError = "I/O timeout";\r
\r