Open
Description
Describe the bug
When closing libsurvive by stopping Unitys playmode it freezes during survive_vive_close()
call.
The survive_vive_close()
function is stuck in an infinite loop as it is waiting for survive_handle_close_request_flag()
to close the USB connection which it never does because usbInfo->request_close
is never true.
Desktop (please complete the following information):
- OS: Windows
- Version 11
Additional context
I tried to figure out where the request_close
is supposed to be set to true but I could not figure it out yet.
I guess it is supposed to be set from another thread?
int survive_vive_close(SurviveContext *ctx, void *driver) {
SurviveViveData *sv = driver;
#ifndef HIDAPI
libusb_hotplug_deregister_callback(sv->usbctx, sv->callback_handle);
#endif
for (int i = 0; i < sv->udev_cnt; i++) {
survive_close_usb_device(sv->udev[i]);
}
while (sv->udev_cnt) { // never gets to 0
#ifndef HIDAPI
survive_release_ctx_lock(ctx);
libusb_handle_events(sv->usbctx);
survive_get_ctx_lock(ctx);
#endif
for (int i = 0; i < sv->udev_cnt; i++) {
struct SurviveUSBInfo *usbInfo = sv->udev[i];
if (survive_handle_close_request_flag(usbInfo)) { //never returns true as 'usbInfo->request_close' is always false
i--;
}
}
}
survive_vive_usb_close(sv);
free(sv);
return 0;
}
Metadata
Metadata
Assignees
Labels
No labels