From 7088c0eb28ab75eaf726aabd650a1bb8fa58ef72 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 27 Mar 2004 03:05:12 +0000 Subject: [PATCH] fix Linux memcard flushing --- .../src/arch/MemoryCard/MemoryCardDriver_Linux.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriver_Linux.cpp b/stepmania/src/arch/MemoryCard/MemoryCardDriver_Linux.cpp index 407e373684..20fe453616 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriver_Linux.cpp +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriver_Linux.cpp @@ -119,7 +119,7 @@ MemoryCardDriver_Linux::MemoryCardDriver_Linux() : m_bStorageDevicesChanged = false; MountThread.SetName("MemCard Mount thread"); - MountThread.Create( MountThread_Start, this ); + MountThread.Create( MountThread_Start, this ); } MemoryCardDriver_Linux::~MemoryCardDriver_Linux() @@ -377,17 +377,18 @@ void MemoryCardDriver_Linux::Flush( UsbStorageDevice* pDevice ) if( pDevice->sOsMountDir.empty() ) return; - // unmount and mount again. Is there a better way to flush? // "sync" will only flush all file systems at the same time. -Chris // I don't think so. Also, sync() merely queues a flush; it doesn't guarantee // that the flush is completed on return. However, we can mount the filesystem // with the flag "-o sync", which forces synchronous access (but that's probably // very slow.) -glenn - CString sCommand = "umount " + pDevice->sOsMountDir; + // Strangely, "-o sync" doesn't seem to force the data to be written to a USB + // pen drive. I see can see that SM wrote the files correctly, but if I unplug + // without sync'ing or umount'ing, then the files are lost. Maybe usb-strorage + // doesn't play nicely with -o sync? + CString sCommand = "sync"; LOG->Trace( "executing '%s'", sCommand.c_str() ); system( sCommand ); - sCommand = "mount " + pDevice->sOsMountDir; - system( sCommand ); } void MemoryCardDriver_Linux::ResetUsbStorage()