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

hw reset errors handling #13254

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
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
31 changes: 29 additions & 2 deletions src/ds/d500/d500-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,35 @@ namespace librealsense
void d500_device::hardware_reset()
{
command cmd(ds::HWRST);
cmd.require_response = false;
_hw_monitor->send(cmd);
cmd.require_response = true;
int retries = 0;
bool success = false;
const int ERR_SWNotReady = -21;
const int ERR_Operation_Timeout = -18;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we do with this error?

do
{
auto res = _hw_monitor->send(cmd);
if (res.size() == 0)
return; // happens when no error occurs

auto hwm_ans = *reinterpret_cast<hwmon_response*>(res.data());
if (hwm_ans == hwmon_response::hwm_Success)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So some D500 devices will return 0 data and some success opcode?
We need to ask FW team to align this behavior
both should return success IMO

success = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just return?

else
{
if (hwm_ans == ERR_SWNotReady)
{
retries++;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
LOG_WARNING("HW Reset - SW not ready received");
}
else
{
throw std::runtime_error("HW Reset - error received - " + static_cast<int>(hwm_ans));
}
}

} while (!success && retries < 3);
}

void d500_device::enter_update_state() const
Expand Down
Loading