Skip to content

Commit

Permalink
check sensors exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed Sep 23, 2024
1 parent dbf4848 commit 4feb8b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/ds/d500/d500-color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ namespace librealsense

std::vector<platform::uvc_device_info> color_devs_info = filter_by_mi(group.uvc_devices, 3);

if ( color_devs_info.empty() )
{
throw backend_exception("cannot access color sensor", RS2_EXCEPTION_TYPE_BACKEND);
}

std::unique_ptr< frame_timestamp_reader > ds_timestamp_reader_backup( new ds_timestamp_reader() );
std::unique_ptr<frame_timestamp_reader> ds_timestamp_reader_metadata(new ds_timestamp_reader_from_metadata(std::move(ds_timestamp_reader_backup)));

Expand Down
9 changes: 8 additions & 1 deletion src/ds/d500/d500-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,14 @@ namespace librealsense
using namespace ds;

std::vector<std::shared_ptr<platform::uvc_device>> depth_devices;
for( auto & info : filter_by_mi( all_device_infos, 0 ) ) // Filter just mi=0, DEPTH
auto depth_devs_info = filter_by_mi( all_device_infos, 0 );

if ( depth_devs_info.empty() )
{
throw backend_exception("cannot access depth sensor", RS2_EXCEPTION_TYPE_BACKEND);
}

for( auto & info : depth_devs_info ) // Filter just mi=0, DEPTH
depth_devices.push_back( get_backend()->create_uvc_device( info ) );

std::unique_ptr< frame_timestamp_reader > timestamp_reader_backup( new ds_timestamp_reader() );
Expand Down

0 comments on commit 4feb8b1

Please sign in to comment.