Skip to content

Commit 9c80ccd

Browse files
hanyazouxlz
authored andcommitted
usb: Issue reboot command on Mac OS X
Without the ShutdownCommand, the Kinect still disappears randomly on Mac OS X. Painstaking effort did not determine the cause. So take the suboptimal way and shut it down explicitly. Fixed #539.
1 parent 352443e commit 9c80ccd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/libfreenect2.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,16 @@ bool Freenect2DeviceImpl::close()
832832
/* This command actually reboots the device and makes it disappear for 3 seconds.
833833
* Protonect can restart instantly without it.
834834
*/
835-
//command_tx_.execute(ShutdownCommand(nextCommandSeq()), result);
835+
#ifdef __APPLE__
836+
/* Kinect will disappear on Mac OS X regardless during close().
837+
* Painstaking effort could not determine the root cause.
838+
* See https://github.com/OpenKinect/libfreenect2/issues/539
839+
*
840+
* Shut down Kinect explicitly on Mac and wait a fixed time.
841+
*/
842+
command_tx_.execute(ShutdownCommand(nextCommandSeq()), result);
843+
libfreenect2::this_thread::sleep_for(libfreenect2::chrono::milliseconds(4*1000));
844+
#endif
836845

837846
if(pipeline_->getRgbPacketProcessor() != 0)
838847
pipeline_->getRgbPacketProcessor()->setFrameListener(0);

0 commit comments

Comments
 (0)