-
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
Fix FW logs bug. #12853
Merged
Merged
Fix FW logs bug. #12853
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,15 +44,16 @@ namespace librealsense | |
void firmware_logger_device::get_fw_logs_from_hw_monitor() | ||
{ | ||
command update_command = get_update_command(); | ||
if( update_command.cmd == 0 ) | ||
return; | ||
|
||
auto res = _hw_monitor->send( update_command ); | ||
if( res.empty() ) | ||
if( update_command.cmd != 0 ) | ||
{ | ||
return; | ||
auto res = _hw_monitor->send( update_command ); | ||
if( ! res.empty() ) | ||
HandleReceivedData( res ); | ||
} | ||
} | ||
|
||
void firmware_logger_device::HandleReceivedData( std::vector< uint8_t > & res ) | ||
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. const? 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. Added, and naming convention fixed |
||
{ | ||
// Convert bytes to fw_logs_binary_data | ||
auto beginOfLogIterator = res.data(); | ||
size_t size_left = res.size(); | ||
|
@@ -61,7 +62,7 @@ namespace librealsense | |
size_t log_size = get_log_size( beginOfLogIterator ); | ||
if( log_size > size_left ) | ||
{ | ||
LOG_WARNING( "Received an incomplete FW log" ); // TODO - remove after debugging, or decrease to debug level. | ||
LOG_WARNING( "Received an incomplete FW log" ); | ||
break; | ||
} | ||
auto endOfLogIterator = beginOfLogIterator + log_size; | ||
|
@@ -176,7 +177,11 @@ namespace librealsense | |
command start_command = parser->get_start_command(); | ||
start_command.cmd = _fw_logs_command.cmd; // Opcode comes from the device, may be different between devices | ||
if( start_command.cmd != 0 ) | ||
_hw_monitor->send( start_command ); | ||
{ | ||
auto res = _hw_monitor->send( start_command ); | ||
if( !res.empty() ) | ||
HandleReceivedData( res ); | ||
} | ||
} | ||
|
||
void extended_firmware_logger_device::stop() | ||
|
@@ -188,7 +193,11 @@ namespace librealsense | |
command stop_command = parser->get_stop_command(); | ||
stop_command.cmd = _fw_logs_command.cmd; // Opcode comes from the device, may be different between devices | ||
if( stop_command.cmd != 0 ) | ||
_hw_monitor->send( stop_command ); | ||
{ | ||
auto res = _hw_monitor->send( stop_command ); | ||
if( !res.empty() ) | ||
HandleReceivedData( res ); | ||
} | ||
} | ||
|
||
size_t extended_firmware_logger_device::get_log_size( const uint8_t * buff ) const | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As I understand from the code, before if the user deactivate the log parsing, we continues dequeue until
get_number_of_fw_logs() == 0
Now we will stop even we still have logs as our loop is
while( enable_firmware_logs )
Is this change the required behavior?
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.
"Get logs" HWM can return multiple log entries at once. Those entries are put in a queue. Subsequent calls to
get_firmware_log
don't send HWM, only deque the messages.get_number_of_fw_logs() == 0
when the queue is empty, then we break the loop and callstop_collecting