Skip to content

Commit

Permalink
PR #13510 from AviaAv: remove response size limitation, and remove lo…
Browse files Browse the repository at this point in the history
…g prints for cmds with empty responses
  • Loading branch information
Nir-Az authored Nov 18, 2024
2 parents e1cf8e5 + 8b36e44 commit 455f76f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/rs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4013,7 +4013,9 @@ rs2_raw_data_buffer* rs2_terminal_parse_response(rs2_terminal_parser* terminal_p
VALIDATE_NOT_NULL(command);
VALIDATE_NOT_NULL(response);
VALIDATE_LE(size_of_command, 1000); //bufer shall be less than 1000 bytes or similar
VALIDATE_LE(size_of_response, 5000);//bufer shall be less than 5000 bytes or similar

// some commands may return a longer length as a response
//VALIDATE_LE(size_of_response, 5000);//bufer shall be less than 5000 bytes or similar


std::string command_string;
Expand Down
7 changes: 5 additions & 2 deletions src/terminal-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ namespace librealsense
data_vec.insert(data_vec.begin(), data.begin(), data.end());
return data_vec;
}
else
else if (response.size() == 4) // if the response contains only the opcode, there's no response other than the opcode, return success message
{
return response;
unsigned opcode = response[0];
auto str = (rsutils::string::from() << "Command succeeded, returned 0x" << hex << opcode).str();
return std::vector<uint8_t>(str.begin(), str.end());
}
return response;
}

vector<uint8_t> terminal_parser::build_raw_command_data(const command_from_xml& command, const vector<string>& params) const
Expand Down

0 comments on commit 455f76f

Please sign in to comment.