LibusbUtils: Log warnings when libusb_set_option or libusb_handle_events_timeout_completed fail
This commit is contained in:
parent
d74fb444f4
commit
91a7c4bdf2
|
@ -28,7 +28,9 @@ public:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
libusb_set_option(m_context, LIBUSB_OPTION_USE_USBDK);
|
const int usbdk_ret = libusb_set_option(m_context, LIBUSB_OPTION_USE_USBDK);
|
||||||
|
if (usbdk_ret != LIBUSB_SUCCESS && usbdk_ret != LIBUSB_ERROR_NOT_FOUND)
|
||||||
|
WARN_LOG_FMT(IOS_USB, "Failed to set LIBUSB_OPTION_USE_USBDK: {}", ErrorWrap(usbdk_ret));
|
||||||
#endif
|
#endif
|
||||||
m_event_thread_running.Set();
|
m_event_thread_running.Set();
|
||||||
m_event_thread = std::thread(&Impl::EventThread, this);
|
m_event_thread = std::thread(&Impl::EventThread, this);
|
||||||
|
@ -71,7 +73,11 @@ private:
|
||||||
Common::SetCurrentThreadName("libusb thread");
|
Common::SetCurrentThreadName("libusb thread");
|
||||||
timeval tv{5, 0};
|
timeval tv{5, 0};
|
||||||
while (m_event_thread_running.IsSet())
|
while (m_event_thread_running.IsSet())
|
||||||
libusb_handle_events_timeout_completed(m_context, &tv, nullptr);
|
{
|
||||||
|
const int ret = libusb_handle_events_timeout_completed(m_context, &tv, nullptr);
|
||||||
|
if (ret != LIBUSB_SUCCESS)
|
||||||
|
WARN_LOG_FMT(IOS_USB, "libusb_handle_events_timeout_completed failed: {}", ErrorWrap(ret));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_context* m_context = nullptr;
|
libusb_context* m_context = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue