Skip to content

Commit

Permalink
PR #12346 from Eran: eth misc
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel authored Nov 2, 2023
2 parents 7979fd4 + f0f0535 commit 386c6dc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
12 changes: 8 additions & 4 deletions common/metadata-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ namespace rs2

class windows_metadata_helper : public metadata_helper
{
using super = metadata_helper;

public:
static bool parse_device_id(const std::string& id, device_id* res)
{
Expand Down Expand Up @@ -239,11 +241,13 @@ namespace rs2

bool is_enabled(std::string id) const override
{
bool res = false;

device_id did;
if (parse_device_id(id, &did))
foreach_device_path({ did }, [&res, did](const device_id&, std::wstring path) {
if( ! parse_device_id( id, &did ) )
// If it's not parsed, it's not a valid USB device; return the default
return super::is_enabled( id );

bool res = false;
foreach_device_path({ did }, [&res, did](const device_id&, std::wstring path) {

HKEY key;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, path.c_str(), 0, KEY_READ | KEY_WOW64_64KEY, &key) == ERROR_SUCCESS)
Expand Down
2 changes: 1 addition & 1 deletion common/metadata-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace rs2

static bool can_support_metadata(const std::string& product)
{
return product == "D400";
return product == "D400" || product == "D500";
}

// This is the command-line parameter that gets passed to another process (running as admin) in order to enable metadata -- see WinMain
Expand Down
3 changes: 2 additions & 1 deletion scripts/realsense_metadata_win10.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ $MultiPinDevices =
"USB\VID_8086&PID_0B5B&MI_00",# D405
"USB\VID_8086&PID_0B5C&MI_00",# D455
"USB\VID_8086&PID_0B64&MI_00",# L515
"USB\VID_8086&PID_0B68&MI_00" # L535
"USB\VID_8086&PID_0B68&MI_00",# L535
"USB\VID_8086&PID_0B56&MI_00" # D555e

#Inhibit system warnings and erros, such as permissions or missing values
$ErrorActionPreference = "silentlycontinue"
Expand Down
7 changes: 6 additions & 1 deletion third-party/realdds/src/dds-device-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,12 @@ void dds_device::impl::open( const dds_stream_profiles & profiles )
{ "stream-profiles", stream_profiles },
};

write_control_message( j );
nlohmann::json reply;
write_control_message( j, &reply );

if( rsutils::json::get( reply, status_key, status_ok ) != status_ok )
throw std::runtime_error( "failed to open stream: "
+ rsutils::json::get< std::string >( reply, explanation_key, "no explanation" ) );
}


Expand Down
5 changes: 5 additions & 0 deletions unit-tests/dds/metadata-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
color_stream.init_options( [] )
color_stream.set_intrinsics( d435i.color_stream_intrinsics() )

def on_control( server, id, control, reply ):
# the control has already been output to debug by the calling code, as will the reply
return True # otherwise the control will be flagged as error

device_server.on_control( on_control )
device_server.init( [color_stream], [], {} )


Expand Down

0 comments on commit 386c6dc

Please sign in to comment.