Skip to content

Commit

Permalink
Do not automatically run REQUEST SENSE (s2pexec)
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Dec 9, 2024
1 parent 2ef107d commit 67181cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions cpp/s2pexec/s2pexec_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void S2pExec::Banner(bool header, bool usage)
<< " --binary-output-file/-F FILE Binary output file for data received.\n"
<< " --hex-output-file/-T FILE Hexadecimal text output file for data received.\n"
<< " --timeout/-o TIMEOUT The command timeout in seconds, default is 3 s.\n"
<< " --no-request-sense/-n Do not run REQUEST SENSE on error.\n"
<< " --request-sense/-R Automatically send REQUEST SENSE on error.\n"
<< " --reset-bus/-r Reset the bus.\n"
<< " --hex-only/-x Do not display/save the offset and ASCII data.\n"
<< " --version/-v Display the program version.\n"
Expand Down Expand Up @@ -101,7 +101,7 @@ bool S2pExec::ParseArguments(span<char*> args)
{ "help", no_argument, nullptr, 'H' },
{ "hex-only", no_argument, nullptr, 'x' },
{ "hex-output-file", required_argument, nullptr, 'T' },
{ "no-request-sense", no_argument, nullptr, 'n' },
{ "request-sense", no_argument, nullptr, 'R' },
{ "log-level", required_argument, nullptr, 'L' },
{ "reset-bus", no_argument, nullptr, 'r' },
{ "scsi-target", required_argument, nullptr, 'i' },
Expand All @@ -119,14 +119,14 @@ bool S2pExec::ParseArguments(span<char*> args)
// Resetting these is important for the interactive mode
command.clear();
data.clear();
request_sense = true;
request_sense = false;
reset_bus = false;
binary_input_filename.clear();
hex_input_filename.clear();

optind = 1;
int opt;
while ((opt = getopt_long(static_cast<int>(args.size()), args.data(), "b:B:c:d:f:F:h:i:o:L:T:Hnrvx",
while ((opt = getopt_long(static_cast<int>(args.size()), args.data(), "b:B:c:d:f:F:h:i:o:L:T:HrRvx",
options.data(), nullptr)) != -1) {
switch (opt) {
case 'b':
Expand Down Expand Up @@ -175,10 +175,6 @@ bool S2pExec::ParseArguments(span<char*> args)
log_level = optarg;
break;

case 'n':
request_sense = false;
break;

case 'o':
tout = optarg;
break;
Expand All @@ -187,6 +183,10 @@ bool S2pExec::ParseArguments(span<char*> args)
reset_bus = true;
break;

case 'R':
request_sense = true;
break;

case 'T':
hex_output_filename = optarg;
break;
Expand Down
6 changes: 3 additions & 3 deletions doc/s2pexec.1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ s2pexec \- SCSI2Pi SCSI/SASI command executor
{\fB\--hex-input-file/-t\fR \fIFILE\fR]
{\fB\--hex-output-file/-T\fR \fIFILE\fR]
{\fB\--timeout/-o\fR \fITIMEOUT\fR]
[\fB\--no-request-sense/-n\fR]
[\fB\--request-sense/-R\fR]
[\fB\--reset-bus/-r\fR]
[\fB\--hex-only/\fR]
[\fB\--help/-H\fR]
Expand Down Expand Up @@ -70,8 +70,8 @@ Optional file for data received in the DATA IN phase. The data in this file are
.BR --timeout/-o\fI " "\fITIMEOUT
The command timeout in seconds, default is 3 seconds. Operations like formatting may take much longer.
.TP
.BR --no-request-sense/-n\fI
Do not automatically send REQUEST SENSE after an error in order to get the sense data.
.BR --request-sense/-R\fI
Automatically send REQUEST SENSE after an error in order to get the sense data.
.TP
.BR --reset-bus/-r\fI
Reset the bus.
Expand Down

0 comments on commit 67181cb

Please sign in to comment.