Skip to content

Commit

Permalink
Update documentation for rs-terminal with example of commands from a …
Browse files Browse the repository at this point in the history
…file.

Minor fixes/enhancements
  • Loading branch information
ev-mp committed Jun 23, 2021
1 parent ad767e1 commit 96ef929
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/terminal-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,15 @@ namespace librealsense
}

if (tokens.empty())
throw runtime_error("Wrong input!");
throw runtime_error("Invald input! - no arguments provided");

auto command_str = tokens.front();
auto command_str = utilities::strings::to_lower(tokens.front());
auto it = _cmd_xml.commands.find(command_str);
if (it == _cmd_xml.commands.end())
throw runtime_error("Command not found!");
throw runtime_error(to_string() << "Command " << command_str << " was not found!");

command = it->second;
for (auto i = 1; i < tokens.size(); ++i)
params.push_back(tokens[i]);
}

}
17 changes: 16 additions & 1 deletion tools/terminal/readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# rs-terminal Tool

## Goal
`rs-terminal` tool can be used to send debug commands to camera firmware. The tool can operate in two modes - if you have access to the specification of debug commands for the exact firmware you are using (provided in XML form) the tool will provide help and auto-completion based on the information within the XML. If you don't have access to the spec, you can still operate the tool in HEX mode, sending binary commands directly. Later mode of operation is intended to allow Intel support team to troubleshoot the hardware remotely by providing the user the exact binary commands to input.
`rs-terminal` tool can be used to send debug commands to camera firmware. The tool can operate in two modes - if you have access to the specification of debug commands for the exact firmware you are using (provided in XML form) the tool will provide help and auto-completion based on the information within the XML.
The tool may accept specific parameters input from files as well as the console
If you don't have access to the spec, you can still operate the tool in HEX mode, sending binary commands directly. Later mode of operation is intended to allow Intel support team to troubleshoot the hardware remotely by providing the user the exact binary commands to input.

## Usage
After installing `librealsense` run `rs-terminal` to launch the tool in HEX mode.
Expand All @@ -10,6 +12,19 @@ After installing `librealsense` run `rs-terminal` to launch the tool in HEX mode
* `-d <number>` - choose device by device number
* `-n <serial>` - choose device by serial number
* `-a` - broadcast to all connected devices
* `-c` - execute a sequence of FW commands listed in a file. (The file must be ANSI/UTF-8 format)

Example:
>`rs-terminal -l cmd.xml-c sequence.txt`
Run the tool, load the FW command specifications/mapping file and then iterate over and execute the FW commands listed in `sequence.txt` file

Possible content for `sequence.txt`:
```
gvd
oemr
oemw /usr/tmp/tbd.bin
gvd
```


4 changes: 2 additions & 2 deletions tools/terminal/rs-terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ void xml_mode(const string& line, const commands_xml& cmd_xml, rs2::device& dev,
}

if (tokens.empty())
throw runtime_error("Wrong input!");
throw runtime_error("Invald input! - no arguments provided");

auto command_str = tokens.front();
auto command_str = utilities::strings::to_lower(tokens.front());
auto it = cmd_xml.commands.find(command_str);
if (it == cmd_xml.commands.end())
throw runtime_error("Command " + command_str + " was not found!");
Expand Down

0 comments on commit 96ef929

Please sign in to comment.