Skip to content

Commit

Permalink
Code Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ev-mp committed Feb 4, 2020
1 parent a10b64d commit 10a248f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
41 changes: 25 additions & 16 deletions tools/enumerate-devices/readme.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
# rs-enumerate-devices Tool

## Goal
`rs-enumerate-devices` tool is a console application providing information about the connected devices.
`rs-enumerate-devices` tool is a console application providing information about Realsense devices.

## Usage
After installing `librealsense` run ` rs-enumerate-devices` to launch the tool.
An example for output for a D415 camera is:
An example output for a D415 camera (using `-S` option) is:

```
Name : Intel RealSense 415
Serial Number : 725112060346
Firmware Version : 05.08.14.00
Physical Port : /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/video4linux/video1
Debug Op Code : 15
Advanced Mode : YES
Product Id : 0AD3
Device Name Serial Number Firmware Version
Intel RealSense D415 725112060411 05.12.02.100
Device info:
Name : Intel RealSense D415
Serial Number : 725112060411
Firmware Version : 05.12.02.100
Recommended Firmware Version : 05.12.02.100
Physical Port : \\?\usb#vid_8086&pid_0ad3&mi_00#6&2a371216&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global
Debug Op Code : 15
Advanced Mode : YES
Product Id : 0AD3
Camera Locked : NO
Usb Type Descriptor : 3.2
Product Line : D400
Asic Serial Number : 012345678901
Firmware Update Id : 012345678901
```

## Command Line Parameters

|Flag |Description |
|---|---|
|`-s`|Provide a one-line summary, one line per device|
|`-S`|Extends `-s` by providing a short summary for each device|
|`-s`|Generate a one-line info for each connected device|
|`-S`|Extends `-s` by providing a short summary per device|
|`-o`|List supported device controls, options and streaming modes|
|`-c`|Provide calibration (Intrinsic/Extrinsic) and steraming modes information|
|`-p`|Enumerate streams contained in ROSBag record file. Usage `-p <rosbag_full_path>`|
|`-c`|Provide calibration (Intrinsic/Extrinsic) and streaming modes information|
|`-p`|Enumerate streams contained in ROSBag record file. Usage `-p <rosbag_full_path_name>`.|
| None| The default mode. Equivalent to `-S` plus the list of all the supported streaming profiles|

The options `-o`, `-c` `-p` are additive and can concatenated:
`rs-enumerate-devices -o -c -p rosbag.rec` - will print the camera info, streaming modes,
supported option and the calibration info both for the live cameras and the prerecorded `rosbag.rec` file.
The options `-o`, `-c` and `-p` are additive and can be combined, e.g. call
`rs-enumerate-devices -o -c -p rosbag.rec` to print the camera info, streaming modes, supported options and the calibration data both for the live cameras and the prerecorded `rosbag.rec` file.

The options `-S`, `-s` are restrictive and therefore incompatible with `-o` and `-c`,
but still can be used with `-p <file_name>`.
17 changes: 12 additions & 5 deletions tools/enumerate-devices/rs-enumerate-devices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ int main(int argc, char** argv) try
bool show_modes = !(compact_view || short_view);
auto playback_dev_file = show_playback_device_arg.getValue();

if ((short_view || compact_view) && (show_options || show_calibration_data))
{
std::stringstream s;
s << "rs-enumerate-devices ";
for (int i = 1; i < argc; ++i)
s << argv[i] << ' ';
std::cout << "Warning: The command line \"" << s.str().c_str()
<<"\" has conflicting requests.\n The flags \"-s\" / \"-S\" are compatible with \"-p\" only,"
<< " other options will be ignored.\nRefer to the tool's documentation for details\n" << std::endl;
}

// Obtain a list of devices currently present on the system
context ctx;
rs2::device d;
Expand All @@ -224,7 +235,7 @@ int main(int argc, char** argv) try
// Retrieve the viable devices
std::vector<rs2::device> devices;

for ( size_t i = 0u; i < device_count; i++)
for ( auto i = 0u; i < device_count; i++)
{
try
{
Expand Down Expand Up @@ -258,10 +269,6 @@ int main(int argc, char** argv) try
<< endl;
}

if (show_options || show_calibration_data || show_modes)
cout << "\n\nNote: \"-s\"\\\"-S\" option is not compatible with the other flags specified,"
<< " the additional options are skipped" << endl;

show_options = show_calibration_data = show_modes = false;
}

Expand Down

0 comments on commit 10a248f

Please sign in to comment.