From d51fd416b5c2784b03ae50bda59cd01a881bf7df Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 27 Jul 2016 21:46:37 +0200 Subject: [PATCH] Set libusb timeout to one second, to help shutdown if the thread is started with zero cards active. --- bmusb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bmusb.cpp b/bmusb.cpp index e9a9125..cd4e59c 100644 --- a/bmusb.cpp +++ b/bmusb.cpp @@ -878,7 +878,8 @@ void BMUSBCapture::usb_thread_func() printf("couldn't set realtime priority for USB thread: %s\n", strerror(errno)); } while (!should_quit) { - int rc = libusb_handle_events(nullptr); + timeval sec { 1, 0 }; + int rc = libusb_handle_events_timeout(nullptr, &sec); if (rc != LIBUSB_SUCCESS) break; } -- 2.39.2