-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
base: development
Are you sure you want to change the base?
hw reset errors handling #13254
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So some D500 devices will return 0 data and some success opcode? |
||
success = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
There was a problem hiding this comment.
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?