1 Reply Latest reply on Mar 19, 2018 5:47 PM by Intel Corporation

    Enumerate/list all RealSense D4xx devices




      I have a question about the query_devices function in the librealsense 2.0 SDK:


      The following code


      rs2::context oContext;

      listDevices = oContext.query_devices();


      will enumerate devices, which are not devices supported by the Librealsense 2.0 SDK. This is very unfortunate. In my case a Logitech 920C Webcam and a ZED stereo cam will also be listed.


      My work around is the following:



      rs2::context oContext;


      std::vector<rs2::device> listDevicesTmp;

      listDevicesTmp = oContext.query_devices(); // Get a snapshot of currently connected devices

      if (listDevicesTmp.size() == 0)

           return 0;


      for (int nI = 0; nI < listDevicesTmp.size(); ++nI)


           rs2::device oCurrentDevice = listDevicesTmp[nI];


           if (oCurrentDevice.supports(RS2_CAMERA_INFO_NAME))


                const char * szCameraName = oCurrentDevice.get_info(RS2_CAMERA_INFO_NAME);

                std::string sName(szCameraName, strlen(szCameraName));

                if (sName.find("RealSense") != std::string::npos && (sName.find("435") != std::string::npos || sName.find("415") != std::string::npos))







      is there something more elegant available? Now, I have to adjust the string.find part of the code whenever the librealsense SDK 2.0 supports more cameras.

        • 1. Re: Enumerate/list all RealSense D4xx devices
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello Svebert, 

          Thanks for posting in the Intel RealSense community. 

          LibrealSense 2.0 was created for the D400 cameras and the SR300. Intel has not tested or validated any other camera from other manufacturers with the Librealsense software. 

          There is no solution or code available from Intel that would help you achieving the Librealsense detecting other cameras. 

          Thanks for your understanding. 

          Best Regards, 
          Juan N.