Index: components/usb_service/usb_context.cc |
diff --git a/components/usb_service/usb_context.cc b/components/usb_service/usb_context.cc |
index be8313e6a86b65f5e5beed873e061f735b814871..67403c83e518bbfb49bcc36040eac1ce5de76603 100644 |
--- a/components/usb_service/usb_context.cc |
+++ b/components/usb_service/usb_context.cc |
@@ -7,6 +7,7 @@ |
#include "base/logging.h" |
#include "base/synchronization/waitable_event.h" |
#include "base/threading/platform_thread.h" |
+#include "components/usb_service/usb_error.h" |
#include "third_party/libusb/src/libusb/interrupt.h" |
#include "third_party/libusb/src/libusb/libusb.h" |
@@ -54,10 +55,13 @@ void UsbContext::UsbEventHandler::ThreadMain() { |
VLOG(1) << "UsbEventHandler started."; |
if (running_) { |
start_polling_.Signal(); |
- libusb_handle_events(context_); |
} |
- while (running_) |
- libusb_handle_events(context_); |
+ while (running_) { |
+ const int rv = libusb_handle_events(context_); |
+ if (rv != LIBUSB_SUCCESS) { |
+ LOG(WARNING) << "Failed to handle events: " << ConvertErrorToString(rv); |
+ } |
+ } |
VLOG(1) << "UsbEventHandler shutting down."; |
} |