Open
Description
Overview Description:
Version, Platform, and Hardware Bug Found:
- Latest git master version
- Linux ubuntu 4.10.0-9-upboard Remove boost thread dependency #11~16.04.1 SMP Wed Oct 25 17:10:46 IST 2017 x86_64 x86_64 x86_64 GNU/Linux
Steps to Reproduce:
- Connect kinect v2 in such a way that it will be properly enumerated, but not openable
- Try to open it using OpenNI driver
Actual Results:
Segafault:
#0 0x00007fffd9e86ada in Freenect2Driver::Driver::deviceOpen(char const*, char const*) () from /usr/lib/OpenNI2/Drivers/libfreenect2-openni2.so.0
#1 0x00007fffee4fa9f2 in ?? () from /usr/lib/libOpenNI2.so.0
Expected Results:
Returning NULL
from Freenect2Driver::Driver::deviceOpen
Reproducibility:
In my case the problem was that PCI-e and USB3 line was shared in SoC and this caused the Kinect to be properly enumerated on Linux, but not to be actually used.
Additional Information:
The problem is here:
- https://github.com/OpenKinect/libfreenect2/blob/master/src/openni2/DeviceDriver.cpp#L509
- https://github.com/OpenKinect/libfreenect2/blob/master/src/openni2/DeviceDriver.cpp#L192
freenect2.openDevice(id)
reports [Error] [Freenect2Impl] failed to open Kinect v2: @1:5
and returns NULL
as expected.
setFreenect2Device
should handle NULL
being passed as an argument. It might be more convenient to perform NULL
check in deviceOpen
before DeviceImpl
is constructed as setFreenect2Device
is only used there.