diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp index 17aa60997..cdb1c1d45 100644 --- a/src/slic3r/GUI/RemovableDriveManager.cpp +++ b/src/slic3r/GUI/RemovableDriveManager.cpp @@ -450,9 +450,14 @@ void RemovableDriveManager::thread_proc() { std::unique_lock<std::mutex> lck(m_thread_stop_mutex); #ifdef _WIN32 - // Wait 30 seconds for the stop signal, wake up time to time to remove those devices that the user ejected in file explorer - // or another application (for example in Cura). This is a workaround, as Windows does not send an event on software eject of a drive. - m_thread_stop_condition.wait_for(lck, std::chrono::seconds(30), [this]{ return m_stop || m_wakeup; }); + // Windows do not send an update on insert / eject of an SD card into an external SD card reader. + // Windows also do not send an update on software eject of a FLASH drive. + // We can likely use the Windows WMI API, but it will be quite time consuming to implement. + // https://www.codeproject.com/Articles/10539/Making-WMI-Queries-In-C + // https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmi-start-page + // https://docs.microsoft.com/en-us/windows/win32/wmisdk/com-api-for-wmi + // https://docs.microsoft.com/en-us/windows/win32/wmisdk/example--receiving-event-notifications-through-wmi- + m_thread_stop_condition.wait_for(lck, std::chrono::seconds(2), [this]{ return m_stop || m_wakeup; }); #else m_thread_stop_condition.wait_for(lck, std::chrono::seconds(2), [this]{ return m_stop; }); #endif