From 64d2566649ac15b2f763f975aae47b3a3dabf04b Mon Sep 17 00:00:00 2001 From: Yuki Joou Date: Tue, 11 Jul 2023 21:16:47 +0200 Subject: [PATCH] usb_device_detection: Don't assume basestation is unplugged by default --- usb_device_detection.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/usb_device_detection.c b/usb_device_detection.c index 762d622..f719d85 100644 --- a/usb_device_detection.c +++ b/usb_device_detection.c @@ -46,6 +46,8 @@ struct usb_detector* create_detector(uint16_t vendor_id, uint16_t product_id) struct usb_detector* detector = calloc(1, sizeof(struct usb_detector)); detector->usb_context = usb_context; + detector->is_connected = false; + detector->event_handler_should_exit = false; if (libusb_hotplug_register_callback(detector->usb_context, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | @@ -66,9 +68,6 @@ struct usb_detector* create_detector(uint16_t vendor_id, uint16_t product_id) return 0; } - detector->is_connected = false; - detector->event_handler_should_exit = false; - if (thrd_create(&detector->event_handler_thread, &libusb_event_handler, detector) != thrd_success) {