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
@@ -133,23 +133,32 @@ void MemoryCardDriverThreaded_Linux::MountThreadMain()
LOG->Warn( "Failed to open \"%s\": %s", USB_DEVICE_LIST_FILE, strerror(errno) );
return;
}
vector<UsbStorageDeviceEx> vDevicesLastSeen;
while( !m_bShutdown )
{
pollfd pfd = { fd, POLLIN, 0 };
int ret = poll( &pfd, 1, 100 );
switch( ret )
if( m_bReset )
{
case 1:
// file changed. Fall through.
break;
case 0: // no change. Poll again.
continue;
case -1:
LOG->Warn( "Error polling" );
continue;
// force all to be re-detected
vDevicesLastSeen.clear();
m_bReset = false;
}
else
{
pollfd pfd = { fd, POLLIN, 0 };
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
@@ -245,6 +254,7 @@ void MemoryCardDriverThreaded_Linux::MountThreadMain()
MemoryCardDriverThreaded_Linux::MemoryCardDriverThreaded_Linux()
{
m_bReset = false;
this->StartThread();
}
@@ -650,6 +660,8 @@ void MemoryCardDriverThreaded_Linux::ResetUsbStorage()
ExecuteCommand( "rmmod usb-storage" );
ExecuteCommand( "modprobe usb-storage" );
m_bReset = true;
// let the mounting thread re-mount everything
}
@@ -14,6 +14,8 @@ public:
protected:
virtual void MountThreadMain();
virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint );
bool m_bReset;
};
#endif