From 269768f856b39fd4c141c373af2efe35343af1b0 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 9 Oct 2004 09:34:30 +0000 Subject: [PATCH] HACK: Don't do the temp mount and the write test in the mount thread. --- .../MemoryCard/MemoryCardDriverThreaded.cpp | 2 +- .../MemoryCardDriverThreaded_Linux.cpp | 25 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded.cpp b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded.cpp index fd5392f82d..20adf1da42 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded.cpp +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded.cpp @@ -124,7 +124,7 @@ bool MemoryCardDriverThreaded::MountAndTestWrite( UsbStorageDevice* pDevice, CSt return false; this->Mount( pDevice, sMountPoint ); - return true; + return pDevice->bWriteTestSucceeded; } diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp index df88fc6270..b58fe23470 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp @@ -220,7 +220,10 @@ void MemoryCardDriverThreaded_Linux::MountThreadDoOneUpdate() else { if( !UsbStorageDevicesChanged() ) - return; + { + usleep(1000*300); // 300 ms + return; + } } // TRICKY: We're waiting for a change in the USB device list, but @@ -272,7 +275,15 @@ void MemoryCardDriverThreaded_Linux::MountThreadDoOneUpdate() bool bDidAnyMounts = false; // unmount all disconnects - if( ShouldDoOsMount() ) + //if( ShouldDoOsMount() ) + for( unsigned i=0; iTrace( "WriteTest: %s, Name: %s", d.bWriteTestSucceeded ? "succeeded" : "failed", d.sName.c_str() ); } } @@ -770,7 +783,11 @@ void MemoryCardDriverThreaded_Linux::Mount( UsbStorageDevice* pDevice, CString s // HACK: Do OS mount for m_bMemoryCardsMountOnlyWhenNecessary CString sCommand = "mount " + pDevice->sOsMountDir; LOG->Trace( "hack mount (%s)", sCommand.c_str() ); - ExecuteCommand( sCommand ); + bool bMountedSuccessfully = ExecuteCommand( sCommand ); + + pDevice->bWriteTestSucceeded = bMountedSuccessfully && TestWrite( pDevice->sOsMountDir ); + + LOG->Trace( "WriteTest: %s, Name: %s", pDevice->bWriteTestSucceeded ? "succeeded" : "failed", pDevice->sName.c_str() ); } void MemoryCardDriverThreaded_Linux::Unmount( UsbStorageDevice* pDevice, CString sMountPoint )