fix name update logic

This commit is contained in:
Chris Danford
2004-05-03 00:35:53 +00:00
parent bfd7b1930c
commit 47cda9c92a
2 changed files with 26 additions and 12 deletions
@@ -138,18 +138,27 @@ void MemoryCardDriverThreaded_Linux::MountThreadMain()
while( !m_bShutdown ) while( !m_bShutdown )
{ {
pollfd pfd = { fd, POLLIN, 0 }; if( m_bReset )
int ret = poll( &pfd, 1, 100 );
switch( ret )
{ {
case 1: // force all to be re-detected
// file changed. Fall through. vDevicesLastSeen.clear();
break; m_bReset = false;
case 0: // no change. Poll again. }
continue; else
case -1: {
LOG->Warn( "Error polling" ); pollfd pfd = { fd, POLLIN, 0 };
continue; int ret = poll( &pfd, 1, 100 );
switch( ret )
{
case 1:
// file changed. Fall through.
break;
case 0: // no change. Poll again.
continue;
case -1:
LOG->Warn( "Error polling" );
continue;
}
} }
// TRICKY: We're waiting for a change in the USB device list, but // TRICKY: We're waiting for a change in the USB device list, but
@@ -245,6 +254,7 @@ void MemoryCardDriverThreaded_Linux::MountThreadMain()
MemoryCardDriverThreaded_Linux::MemoryCardDriverThreaded_Linux() MemoryCardDriverThreaded_Linux::MemoryCardDriverThreaded_Linux()
{ {
m_bReset = false;
this->StartThread(); this->StartThread();
} }
@@ -650,6 +660,8 @@ void MemoryCardDriverThreaded_Linux::ResetUsbStorage()
ExecuteCommand( "rmmod usb-storage" ); ExecuteCommand( "rmmod usb-storage" );
ExecuteCommand( "modprobe usb-storage" ); ExecuteCommand( "modprobe usb-storage" );
m_bReset = true;
// let the mounting thread re-mount everything // let the mounting thread re-mount everything
} }
@@ -14,6 +14,8 @@ public:
protected: protected:
virtual void MountThreadMain(); virtual void MountThreadMain();
virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint ); virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint );
bool m_bReset;
}; };
#endif #endif