Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FW version display after FW update #13316

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ namespace rs2
"and restart the realsense-viewer");
}
_done = true;
// need to find a way to update the fw version field in the viewer
// Restart the device to reconstruct with the new version information
_dev.hardware_reset();
}

void firmware_update_manager::process_flow(
Expand Down
3 changes: 2 additions & 1 deletion src/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ namespace librealsense
std::shared_ptr< processing_block_interface > create_pp_block( std::string const & name,
rsutils::json const & settings );

private:

void invoke_devices_changed_callbacks( std::vector< std::shared_ptr< device_info > > const & devices_removed,
std::vector< std::shared_ptr< device_info > > const & devices_added );

private:
std::map< std::string /*address*/, std::weak_ptr< device_info > > _user_devices;

rsutils::signal< std::vector< std::shared_ptr< device_info > > const & /*removed*/,
Expand Down
34 changes: 34 additions & 0 deletions src/ds/d400/d400-factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,40 @@ namespace librealsense

return tags;
};

void hardware_reset() override
{
d400_device::hardware_reset();
//limitation: the user must hold the context from which the device was created
//creating fake notification to trigger invoke_devices_changed_callbacks, causing disconnection and connection
auto dev_info = this->get_device_info();
auto non_const_device_info = std::const_pointer_cast< librealsense::device_info >( dev_info );
std::vector< std::shared_ptr< device_info > > devices{ non_const_device_info };
auto ctx = std::weak_ptr< context >( get_context() );
maloel marked this conversation as resolved.
Show resolved Hide resolved
std::thread fake_notification(
[ ctx, devs = std::move( devices ) ]()
{
try
{
if( auto strong = ctx.lock() )
{
strong->invoke_devices_changed_callbacks( devs, {} );
// MIPI devices do not re-enumerate so we need to give them some time to restart
std::this_thread::sleep_for( std::chrono::milliseconds( 3000 ) );
}
if( auto strong = ctx.lock() )
strong->invoke_devices_changed_callbacks( {}, devs );
}
catch( const std::exception & e )
{
LOG_ERROR( e.what() );
return;
}
} );
fake_notification.detach();
}


};

// AWGCT
Expand Down
Loading