Please sign in to comment.
Behave sanely when the Kinect is unplugged.
libusb_handle_events is thread-safe, but not reentrant. Which means that we can't call fnusb_stop_iso which calls libusb_handle_events from inside the isochronous callback function. Instead, we add a member to fnusb_dev that tracks if the device is permanently dead, and set it to true when we get a LIBUSB_TRANSFER_NO_DEVICE (or on resubmission, LIBUSB_ERROR_NO_DEVICE). Then, in freenect_process_events, after calling libusb_handle_events internally, we check to see if any of the devices in the context have this flag set. If they do, then we should return some nonzero error value, which is currently -1. In the future, we intend to provide callbacks so that clients can receive explicit notifications when a device has disappeared, so the code can robustly handle that situation. Future work. Fixes #229 (I think) Signed-off-by: Drew Fisher <firstname.lastname@example.org>
- Loading branch information...
Showing with 53 additions and 9 deletions.