mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 21:58:03 -06:00
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, therefore we lower the polling interval back to two seconds. 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-
This commit is contained in:
parent
d3236f5e70
commit
3234823a1a
1 changed files with 8 additions and 3 deletions
|
@ -450,9 +450,14 @@ void RemovableDriveManager::thread_proc()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lck(m_thread_stop_mutex);
|
std::unique_lock<std::mutex> lck(m_thread_stop_mutex);
|
||||||
#ifdef _WIN32
|
#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
|
// Windows do not send an update on insert / eject of an SD card into an external SD card reader.
|
||||||
// or another application (for example in Cura). This is a workaround, as Windows does not send an event on software eject of a drive.
|
// Windows also do not send an update on software eject of a FLASH drive.
|
||||||
m_thread_stop_condition.wait_for(lck, std::chrono::seconds(30), [this]{ return m_stop || m_wakeup; });
|
// 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
|
#else
|
||||||
m_thread_stop_condition.wait_for(lck, std::chrono::seconds(2), [this]{ return m_stop; });
|
m_thread_stop_condition.wait_for(lck, std::chrono::seconds(2), [this]{ return m_stop; });
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue