我正在使用带有填充传感器的OpenNi来获取深度图像。 NiViwer 示例工作正常,但如果在Linux启动之前连接传感器,当我使用 OpenNi 运行 NiViewer 或任何其他程序时,它会退出这个错误:
打开失败:设备处于安全模式。无法启动任何流!
这是完整的日志:
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 . . .
拔下并重新插件解决问题,但我需要它才能在没有这个技巧的情况下工作。
我想这个问题是关于usb模块的。我用内核2.6.39和3.0.6
测试了这个错误似乎发生在这里: 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!");
}