diff --git a/common/device-model.cpp b/common/device-model.cpp index f06677a7f4..a9b04a1bef 100644 --- a/common/device-model.cpp +++ b/common/device-model.cpp @@ -2246,42 +2246,32 @@ namespace rs2 else { ImGui::Text(" %s", ss.str().c_str()); - - if (dev.supports(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR)) - { - std::string desc = dev.get_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR); - ss.str(""); - ss << " " << textual_icons::usb_type << " " << desc; - ImGui::SameLine(); - if (!starts_with(desc, "3.")) ImGui::PushStyleColor(ImGuiCol_Text, yellow); - else ImGui::PushStyleColor(ImGuiCol_Text, light_grey); - ImGui::Text(" %s", ss.str().c_str()); - ImGui::PopStyleColor(); - ss.str(""); - ss << "The camera was detected by the OS as connected to a USB " << desc << " port"; - ImGui::PushFont(window.get_font()); - ImGui::PushStyleColor(ImGuiCol_Text, light_grey); - if (ImGui::IsItemHovered()) - ImGui::SetTooltip(" %s", ss.str().c_str()); - ImGui::PopStyleColor(); - ImGui::PopFont(); - } - else if(dev.supports(RS2_CAMERA_INFO_PRODUCT_ID)) + if (dev.supports(RS2_CAMERA_INFO_CONNECTION_TYPE)) { - std::string device_pid = dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID); - if(device_pid == "ABCD")// Specific for D457 + auto connection_type = dev.get_info(RS2_CAMERA_INFO_CONNECTION_TYPE); + if (connection_type == std::string("USB") && dev.supports(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR)) { - ss.str( "" ); - ss << " " << "GMSL"; + std::string desc = dev.get_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR); + ss.str(""); + ss << " " << textual_icons::usb_type << " " << desc; ImGui::SameLine(); - ImGui::PushStyleColor(ImGuiCol_Text, white); + if (!starts_with(desc, "3.")) ImGui::PushStyleColor(ImGuiCol_Text, yellow); + else ImGui::PushStyleColor(ImGuiCol_Text, light_grey); ImGui::Text(" %s", ss.str().c_str()); ImGui::PopStyleColor(); + ss.str(""); + ss << "The camera was detected by the OS as connected to a USB " << desc << " port"; + ImGui::PushFont(window.get_font()); + ImGui::PushStyleColor(ImGuiCol_Text, light_grey); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip(" %s", ss.str().c_str()); + ImGui::PopStyleColor(); + ImGui::PopFont(); } - else if(device_pid == "DDS") + else { - ss.str( "" ); - ss << " " << "DDS"; + ss.str(""); + ss << " " << connection_type; ImGui::SameLine(); ImGui::PushStyleColor(ImGuiCol_Text, white); ImGui::Text(" %s", ss.str().c_str()); diff --git a/include/librealsense2/h/rs_sensor.h b/include/librealsense2/h/rs_sensor.h index e766eadb9a..30f54ea1ef 100644 --- a/include/librealsense2/h/rs_sensor.h +++ b/include/librealsense2/h/rs_sensor.h @@ -35,6 +35,7 @@ typedef enum rs2_camera_info { RS2_CAMERA_INFO_FIRMWARE_UPDATE_ID , /**< Firmware update ID */ RS2_CAMERA_INFO_IP_ADDRESS , /**< IP address for remote camera. */ RS2_CAMERA_INFO_DFU_DEVICE_PATH , /**< DFU Device node path */ + RS2_CAMERA_INFO_CONNECTION_TYPE , /**< Connection type, for example USB, GMSL, DDS */ RS2_CAMERA_INFO_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */ } rs2_camera_info; const char* rs2_camera_info_to_string(rs2_camera_info info); diff --git a/include/librealsense2/hpp/rs_device.hpp b/include/librealsense2/hpp/rs_device.hpp index bc7af22454..f0a7d97721 100644 --- a/include/librealsense2/hpp/rs_device.hpp +++ b/include/librealsense2/hpp/rs_device.hpp @@ -54,17 +54,8 @@ namespace rs2 */ std::string get_type() const { - if( supports( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR ) ) - return "USB"; - if( supports( RS2_CAMERA_INFO_PRODUCT_ID ) ) - { - std::string pid = get_info( RS2_CAMERA_INFO_PRODUCT_ID ); - if( pid == "ABCD" ) // Specific for D457 - return "GMSL"; - if( pid == "BBCD" ) // Specific for D457 Recovery DFU - return "GMSL"; - return pid; // for DDS devices, this will be "DDS" - } + if( supports( RS2_CAMERA_INFO_CONNECTION_TYPE ) ) + return get_info(RS2_CAMERA_INFO_CONNECTION_TYPE); return {}; } diff --git a/src/dds/rs-dds-device-proxy.cpp b/src/dds/rs-dds-device-proxy.cpp index bc01659712..89a1bbe805 100644 --- a/src/dds/rs-dds-device-proxy.cpp +++ b/src/dds/rs-dds-device-proxy.cpp @@ -170,6 +170,7 @@ dds_device_proxy::dds_device_proxy( std::shared_ptr< const device_info > const & if( j.nested( "product-line" ).get_ex( str ) ) register_info( RS2_CAMERA_INFO_PRODUCT_LINE, str ); register_info( RS2_CAMERA_INFO_CAMERA_LOCKED, j.nested( "locked" ).default_value( true ) ? "YES" : "NO" ); + register_info(RS2_CAMERA_INFO_CONNECTION_TYPE, "DDS" ); // Assumes dds_device initialization finished struct sensor_info diff --git a/src/ds/d400/d400-device.cpp b/src/ds/d400/d400-device.cpp index b390e9aac8..853cce9a09 100644 --- a/src/ds/d400/d400-device.cpp +++ b/src/ds/d400/d400-device.cpp @@ -964,7 +964,12 @@ namespace librealsense register_info(RS2_CAMERA_INFO_DFU_DEVICE_PATH, group.uvc_devices.front().dfu_device_path); if (usb_modality) + { + register_info(RS2_CAMERA_INFO_CONNECTION_TYPE, "USB"); register_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR, usb_type_str); + } + else + register_info(RS2_CAMERA_INFO_CONNECTION_TYPE, "GMSL"); std::string curr_version= _fw_version; diff --git a/src/ds/d500/d500-device.cpp b/src/ds/d500/d500-device.cpp index e33c9b144c..ba79e6b91c 100644 --- a/src/ds/d500/d500-device.cpp +++ b/src/ds/d500/d500-device.cpp @@ -700,7 +700,10 @@ namespace librealsense register_info(RS2_CAMERA_INFO_CAMERA_LOCKED, _is_locked ? "YES" : "NO"); if (usb_modality) + { + register_info(RS2_CAMERA_INFO_CONNECTION_TYPE, "USB"); register_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR, usb_type_str); + } register_features(); diff --git a/src/platform-camera.cpp b/src/platform-camera.cpp index e53ffb7cdf..d67410d759 100644 --- a/src/platform-camera.cpp +++ b/src/platform-camera.cpp @@ -97,6 +97,7 @@ platform_camera::platform_camera( std::shared_ptr< const device_info > const & d if( usb_spec_names.count( usb_mode ) && ( usb_undefined != usb_mode ) ) usb_type_str = usb_spec_names.at( usb_mode ); + register_info(RS2_CAMERA_INFO_CONNECTION_TYPE, "USB"); register_info( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR, usb_type_str ); register_info( RS2_CAMERA_INFO_SERIAL_NUMBER, uvc_infos.front().unique_id ); register_info( RS2_CAMERA_INFO_PHYSICAL_PORT, uvc_infos.front().device_path ); diff --git a/src/to-string.cpp b/src/to-string.cpp index 7bc1d95bf4..17a659b32b 100644 --- a/src/to-string.cpp +++ b/src/to-string.cpp @@ -591,6 +591,7 @@ const char * get_string( rs2_camera_info value ) CASE( FIRMWARE_UPDATE_ID ) CASE( IP_ADDRESS ) CASE( DFU_DEVICE_PATH ) + CASE( CONNECTION_TYPE ) default: assert( ! is_valid( value ) ); return UNKNOWN_VALUE; diff --git a/tools/data-collect/rs-data-collect.cpp b/tools/data-collect/rs-data-collect.cpp index fe892e709f..08686b2269 100644 --- a/tools/data-collect/rs-data-collect.cpp +++ b/tools/data-collect/rs-data-collect.cpp @@ -82,9 +82,15 @@ void data_collector::parse_and_configure(cli::value& config_file) configure_sensors(); // Report results + std::string connection_type = _dev->supports(RS2_CAMERA_INFO_CONNECTION_TYPE) ? + std::string(_dev->get_info(RS2_CAMERA_INFO_CONNECTION_TYPE)) : std::string(" "); + if (connection_type == "USB" && _dev->supports(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR)) + { + connection_type += " Type: "; + connection_type += _dev->get_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR); + } std::cout << "\nDevice selected: \n\t" << _dev->get_info(RS2_CAMERA_INFO_NAME) - << (_dev->supports(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR) ? - std::string((stringify() << ". USB Type: " << _dev->get_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR))) : "") + << ". " << connection_type << " " << "\n\tS.N: " << (_dev->supports(RS2_CAMERA_INFO_SERIAL_NUMBER) ? _dev->get_info(RS2_CAMERA_INFO_SERIAL_NUMBER) : "") << "\n\tFW Ver: " << _dev->get_info(RS2_CAMERA_INFO_FIRMWARE_VERSION) << "\n\nUser streams requested: " << user_requests.size() diff --git a/tools/depth-quality/depth-quality-model.cpp b/tools/depth-quality/depth-quality-model.cpp index b969f2cfb9..5eeadad23f 100644 --- a/tools/depth-quality/depth-quality-model.cpp +++ b/tools/depth-quality/depth-quality-model.cpp @@ -46,21 +46,25 @@ namespace rs2 rs2::pipeline_profile active_profile; // Adjust settings according to USB type - bool usb3_device = true; + bool usb2_device = false; auto devices = _ctx.query_devices(); if (devices.size()) { auto dev = devices[0]; - if (dev.supports(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR)) + if (dev.supports(RS2_CAMERA_INFO_CONNECTION_TYPE)) { - std::string usb_type = dev.get_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR); - usb3_device = !(std::string::npos != usb_type.find("2.")); + auto connection_type = dev.get_info(RS2_CAMERA_INFO_CONNECTION_TYPE); + if (connection_type == std::string("USB") && dev.supports(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR)) + { + std::string usb_type = dev.get_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR); + usb2_device = (std::string::npos != usb_type.find("2.")); + } } } else return valid_config; - int requested_fps = usb3_device ? 30 : 15; + int requested_fps = usb2_device ? 15 : 30; // open Depth and Infrared streams using default profile { diff --git a/tools/fw-update/rs-fw-update.cpp b/tools/fw-update/rs-fw-update.cpp index b7dce0a1a0..d099b1737c 100644 --- a/tools/fw-update/rs-fw-update.cpp +++ b/tools/fw-update/rs-fw-update.cpp @@ -192,15 +192,14 @@ int write_fw_to_mipi_device( const rs2::device & dev, const std::vector< uint8_t bool is_mipi_device( const rs2::device & dev ) { - std::string usb_type = "unknown"; - - if( dev.supports( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR ) ) - usb_type = dev.get_info( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR ); - - bool d457_device = strcmp( dev.get_info( RS2_CAMERA_INFO_PRODUCT_ID ), "ABCD" ) == 0; - - // Currently only D457 model has MIPI connection - return d457_device && usb_type.compare( "unknown" ) == 0; + bool is_mipi_device = false; + if (dev.supports(RS2_CAMERA_INFO_CONNECTION_TYPE)) + { + auto connection_type = dev.get_info(RS2_CAMERA_INFO_CONNECTION_TYPE); + if (connection_type == "GMSL") + is_mipi_device = true; + } + return is_mipi_device; } int main( int argc, char ** argv ) diff --git a/tools/realsense-viewer/realsense-viewer.cpp b/tools/realsense-viewer/realsense-viewer.cpp index 1bc1a9eac1..57347bc1e6 100644 --- a/tools/realsense-viewer/realsense-viewer.cpp +++ b/tools/realsense-viewer/realsense-viewer.cpp @@ -469,16 +469,11 @@ int main(int argc, const char** argv) try auto dev = connected_devs[i]; std::string dev_type; - if( dev.supports( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR ) ) + if (dev.supports(RS2_CAMERA_INFO_CONNECTION_TYPE)) { - dev_type = "USB"; - dev_type += dev.get_info( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR ); - } - else if( dev.supports( RS2_CAMERA_INFO_PRODUCT_ID ) ) - { - dev_type = dev.get_info( RS2_CAMERA_INFO_PRODUCT_ID ); - if( dev_type == "ABCD" ) // Specific for D457 - dev_type = "GMSL"; + dev_type = dev.get_info(RS2_CAMERA_INFO_CONNECTION_TYPE); + if (dev_type == "USB" && dev.supports( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR )) + dev_type += dev.get_info( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR ); } std::string line = rsutils::string::from() << dev.get_info( RS2_CAMERA_INFO_NAME ) << " (" << dev_type diff --git a/wrappers/python/pyrs_device.cpp b/wrappers/python/pyrs_device.cpp index 447d2e94a3..789e5c8935 100644 --- a/wrappers/python/pyrs_device.cpp +++ b/wrappers/python/pyrs_device.cpp @@ -54,8 +54,16 @@ void init_device(py::module &m) { if( self.supports( RS2_CAMERA_INFO_CAMERA_LOCKED ) && strcmp( "YES", self.get_info( RS2_CAMERA_INFO_CAMERA_LOCKED ) ) ) ss << " UNLOCKED"; - if( self.supports( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR ) ) - ss << " on USB" << self.get_info( RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR ); + if (self.supports(RS2_CAMERA_INFO_CONNECTION_TYPE)) + { + auto connection_type = self.get_info(RS2_CAMERA_INFO_CONNECTION_TYPE); + ss << " on "; + ss << connection_type; + if (connection_type == "USB") + if (self.supports(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR)) + ss << self.get_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR); + } + else if( self.supports( RS2_CAMERA_INFO_PHYSICAL_PORT ) ) ss << " @ " << self.get_info( RS2_CAMERA_INFO_PHYSICAL_PORT ); ss << ")>";