Question

I'm using OpenNi with a primesense sensor to get depth image. NiViwer sample works fine, but if the sensor is connected before Linux booting, when I run NiViewer or any other program using OpenNi, it exits with this error:

Open failed: Device is in safe mode. Cannot start any stream!

This is the ful log:

      522 INFO       OpenNI version is 1.2.0 (Build 7)-Linux-x86 (May 15 2011 10:29:37)
      572 INFO       Filter Info - minimum severity: VERBOSE, masks: ALL
      704 VERBOSE    Found exported production node. Script: OpenNI/OpenNI/1.2.0.7
      983 VERBOSE    Checking /opt/OpenNI/lib/libnimMockNodes.so...
     3240 VERBOSE    Found exported production node. ProductionNode: OpenNI/Mock/1.2.0.7
     3297 VERBOSE    Found exported production node. Generator: OpenNI/Mock/1.2.0.7
     3375 VERBOSE    Found exported production node. MapGenerator: OpenNI/Mock/1.2.0.7
     3414 VERBOSE    Found exported production node. Device: OpenNI/Mock/1.2.0.7
     3447 VERBOSE    Found exported production node. Depth: OpenNI/Mock/1.2.0.7
     3483 VERBOSE    Found exported production node. IR: OpenNI/Mock/1.2.0.7
     3518 VERBOSE    Found exported production node. Image: OpenNI/Mock/1.2.0.7
     3551 VERBOSE    Found exported production node. Audio: OpenNI/Mock/1.2.0.7
     3589 VERBOSE    Checking /opt/OpenNI/lib/libnimCodecs.so...
     5219 VERBOSE    Found exported production node. Codec: OpenNI/16zP/1.2.0.7
     5270 VERBOSE    Found exported production node. Codec: OpenNI/16zT/1.2.0.7
     5299 VERBOSE    Found exported production node. Codec: OpenNI/Im8z/1.2.0.7
     5372 VERBOSE    Found exported production node. Codec: OpenNI/JPEG/1.2.0.7
     5402 VERBOSE    Found exported production node. Codec: OpenNI/NONE/1.2.0.7
     5434 VERBOSE    Checking /opt/OpenNI/lib/libnimRecorder.so...
     6910 VERBOSE    Found exported production node. Recorder: OpenNI/Recorder/1.2.0.7
     6964 VERBOSE    Found exported production node. Player: OpenNI/Player/1.2.0.7
     6994 VERBOSE    Checking /opt/OpenNI/lib/libXnCore.so...
     8106 VERBOSE    Found exported production node. Script: OpenNI/OpenNI/1.2.0.7
     8135 WARNING    A Generator with the same description already exists!
     8148 WARNING    Failed to add generator 0 from module '/opt/OpenNI/lib/libXnCore.so'
     8163 VERBOSE    Checking /opt/OpenNI/lib/libXnDDK.so...
    13802 VERBOSE    Found exported production node. Script: OpenNI/OpenNI/1.2.0.7
    13836 WARNING    A Generator with the same description already exists!
    13850 WARNING    Failed to add generator 0 from module '/opt/OpenNI/lib/libXnDDK.so'
    13865 VERBOSE    Checking /opt/OpenNI/lib/libXnDeviceFile.so...
    16408 VERBOSE    Found exported production node. Player: PrimeSense/File/5.0.2.3
    16460 VERBOSE    Checking /opt/OpenNI/lib/libXnDeviceSensorV2.so...
    20778 VERBOSE    Found exported production node. Device: PrimeSense/SensorV2/5.0.2.3
    20833 VERBOSE    Found exported production node. Depth: PrimeSense/SensorV2/5.0.2.3
    20870 VERBOSE    Found exported production node. Image: PrimeSense/SensorV2/5.0.2.3
    20902 VERBOSE    Found exported production node. IR: PrimeSense/SensorV2/5.0.2.3
    20934 VERBOSE    Found exported production node. Audio: PrimeSense/SensorV2/5.0.2.3
    20963 VERBOSE    Checking /opt/OpenNI/lib/libXnFormats.so...
    21066 VERBOSE    Found exported production node. Script: OpenNI/OpenNI/1.2.0.7
    21082 WARNING    A Generator with the same description already exists!
    21093 WARNING    Failed to add generator 0 from module '/opt/OpenNI/lib/libXnFormats.so'
    21410 INFO       Creating node 'Script1' of type Script: OpenNI/OpenNI/1.2.0.7...
    21741 VERBOSE    Requested to create a node of type Depth...
    21875 VERBOSE    Initializing USB...
    22046 INFO       USB is initialized.
    34087 INFO       Creating node 'Device1' of type Device: PrimeSense/SensorV2/5.0.2.3...
    57436 WARNING    Server returned an error: Device is in safe mode. Cannot start any stream!
    58380 INFO       Destroying node 'Script1'
Open failed: Device is in safe mode. Cannot start any stream!
Press any key to continue . . .

Unplug and re-plug solves the problem, but I need it to work without this trick.

I suppose this problem is about usb module. I've tested this with kernel 2.6.39 and 3.0.6

The error seems to happen here: libXnDeviceSensorV2.so XnSensorFirmware.cpp

XnStatus XnSensorFirmware::Init(XnBool bReset)
{
    XnStatus nRetVal = XN_STATUS_OK;

    // check current mode
    XnUInt16 nMode;
    nRetVal = XnHostProtocolGetMode(m_pDevicePrivateData, nMode);
    XN_IS_STATUS_OK(nRetVal);

    if (bReset)
    {
        // check if safe mode
        if (nMode == XN_HOST_PROTOCOL_MODE_SAFE_MODE)
        {
            XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_SAFE_MODE, XN_MASK_DEVICE_SENSOR, "Device is in safe mode. Cannot start any stream!");
        }
Was it helpful?

Solution

Solved updating firmware to V1.06: http://www.openni.org/Downloads/OpenNIModules.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top