Skip to content

Conversation

@Peaj
Copy link

@Peaj Peaj commented Sep 12, 2024

Fixes infinite loop during vive driver shutdown.
survive_handle_close_request_flag in drive_vive.c never shutdown the usb connection because usbInfo.requestClose was never true.

I updated survive_close_usb_device to set the requestClose flag to true so survive_handle_close_request_flag can react to it and close the connection.

I am not 100% sure where this flag is supposed to be set but from my understanding survive_close_usb_device should be reasonable and so far the plugin seems to shutdown gracefully.

Fixes #312

@throni3git
Copy link

i am getting into the libusb-side of the implementation, where there is a check for active_transfers before setting request_close. i am still trying to figure out how the whole ecosystem works, so maybe original contributors can give us a better insight on how this was planned...

in driver_vive.libusb.h in survive_close_usb_device at line 300 you'll find (for your considering)

	if (usbInfo->active_transfers == 0) {
		usbInfo->request_close = true;
		SV_VERBOSE(100, "Acking close for %s", survive_colorize_codename(usbInfo->so));
	}

@Peaj
Copy link
Author

Peaj commented Sep 19, 2024

I did not look at libusb yet as I was building with the default setting of HIDAPI.
The libusb implementation could bring insights into how it should be handled though.
But dirver_vive.hidapi.h is not using active_transfers at all.
I am not even sure when to user libusb over hidapi. Is hidapi a windows only thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Infinite loop when shutting down vive driver

2 participants