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
@@ -137,6 +137,14 @@ void MemoryCardDriverThreaded_Linux::MountThreadMain()
vector<UsbStorageDeviceEx> vDevicesLastSeen; vector<UsbStorageDeviceEx> vDevicesLastSeen;
while( !m_bShutdown ) while( !m_bShutdown )
{
if( m_bReset )
{
// force all to be re-detected
vDevicesLastSeen.clear();
m_bReset = false;
}
else
{ {
pollfd pfd = { fd, POLLIN, 0 }; pollfd pfd = { fd, POLLIN, 0 };
int ret = poll( &pfd, 1, 100 ); int ret = poll( &pfd, 1, 100 );
@@ -151,6 +159,7 @@ void MemoryCardDriverThreaded_Linux::MountThreadMain()
LOG->Warn( "Error polling" ); LOG->Warn( "Error polling" );
continue; 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
// the usb-storage descriptors take a bit longer to update. It's more convenient to wait // the usb-storage descriptors take a bit longer to update. It's more convenient to wait
@@ -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