Compare commits
2 commits
4fd8bf9bb8
...
64d2566649
Author | SHA1 | Date | |
---|---|---|---|
64d2566649 | |||
f5cac7f6d9 |
2 changed files with 3 additions and 3 deletions
1
main.c
1
main.c
|
@ -38,6 +38,7 @@ int main(int, char**)
|
||||||
struct miix_wlr_state* state = miix_wlr_init();
|
struct miix_wlr_state* state = miix_wlr_init();
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
thrd_sleep(&(struct timespec){0, 10000000UL}, NULL);
|
||||||
if (!monitor->data_is_ready) continue;
|
if (!monitor->data_is_ready) continue;
|
||||||
|
|
||||||
if (base_station_detector && base_station_detector->is_connected) {
|
if (base_station_detector && base_station_detector->is_connected) {
|
||||||
|
|
|
@ -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));
|
struct usb_detector* detector = calloc(1, sizeof(struct usb_detector));
|
||||||
detector->usb_context = usb_context;
|
detector->usb_context = usb_context;
|
||||||
|
detector->is_connected = false;
|
||||||
|
detector->event_handler_should_exit = false;
|
||||||
|
|
||||||
if (libusb_hotplug_register_callback(detector->usb_context,
|
if (libusb_hotplug_register_callback(detector->usb_context,
|
||||||
LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
|
LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
|
||||||
|
@ -66,9 +68,6 @@ struct usb_detector* create_detector(uint16_t vendor_id, uint16_t product_id)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
detector->is_connected = false;
|
|
||||||
detector->event_handler_should_exit = false;
|
|
||||||
|
|
||||||
if (thrd_create(&detector->event_handler_thread,
|
if (thrd_create(&detector->event_handler_thread,
|
||||||
&libusb_event_handler,
|
&libusb_event_handler,
|
||||||
detector) != thrd_success) {
|
detector) != thrd_success) {
|
||||||
|
|
Loading…
Reference in a new issue