| .TH SG_OPCODES "8" "December 2012" "sg3_utils\-1.35" SG3_UTILS |
| .SH NAME |
| sg_opcodes \- report supported SCSI commands or task management functions |
| .SH SYNOPSIS |
| .B sg_opcodes |
| [\fI\-\-alpha\fR] [\fI\-\-compact\fR] [\fI\-\-help\fR] [\fI\-\-hex\fR] |
| [\fI\-\-no-inquiry\fR] [\fI\-\-opcode=OP\fR] [\fI\-\-raw\fR] [\fI\-\-rctd\fR] |
| [\fI\-\-repd\fR] [\fI\-\-sa=SA\fR] [\fI\-\-tmf\fR] [\fI\-\-unsorted\fR] |
| [\fI\-\-verbose\fR] [\fI\-\-version\fR] \fIDEVICE\fR |
| .PP |
| .B sg_opcodes |
| [\fI\-a\fR] [\fI\-c\fR] [\fI\-n\fR] [\fI\-o=OP\fR] [\fI\-q\fR] [\fI\-R\fR] |
| [\fI\-s=SA\fR] [\fI\-t\fR] [\fI\-u\fR] [\fI\-v\fR] [\fI\-V\fR] [\fI\-?\fR] |
| \fIDEVICE\fR |
| .SH DESCRIPTION |
| .\" Add any additional description here |
| .PP |
| This utility sends a SCSI REPORT SUPPORTED OPERATION CODES or a REPORT |
| SUPPORTED TASK MANAGEMENT FUNCTIONS command to the \fIDEVICE\fR and then |
| outputs the response. The default action is to report supported operation |
| codes. In this mode it will either list all supported commands or give |
| detailed information on a specific command identified by the |
| \fI\-\-opcode=OP\fR option (perhaps with additional information from the |
| \fI\-\-sa=SA\fR option). |
| .PP |
| The name of a SCSI command depends on its peripheral device type (e.g. a |
| disk). The REPORT SUPPORTED OPERATION CODES and REPORT SUPPORTED TASK |
| MANAGEMENT FUNCTIONS commands are not supported in the MMC command set for |
| CD and DVD devices. This utility does an INQUIRY to obtain the peripheral |
| device type and prints out the vendor, product and revision strings. |
| .PP |
| A similar facility to query supported operation codes previously was available |
| via the CmdDt bit in the SCSI INQUIRY command (see sg_inq(8)). However that |
| facility was made obsolete and replaced by the REPORT SUPPORTED OPERATION |
| CODES command in SPC\-3 (revision 4) during February 2002. |
| .PP |
| This utility supports two command line syntaxes, the preferred one is |
| shown first in the synopsis and explained in this section. A later section |
| on the old command line syntax outlines the second group of options. |
| .SH OPTIONS |
| Arguments to long options are mandatory for short options as well. |
| .TP |
| \fB\-a\fR, \fB\-\-alpha\fR |
| when all supported commands are being listed there is no requirement for |
| the device server (i.e. the \fIDEVICE\fR) to sort the list of commands. When |
| this option is given the list of supported commands is sorted by |
| name (alphabetically). When this option and the \fB\-\-unsorted\fR option are |
| both _not_ given then the list of supported commands is sorted |
| numerically (first by operation code and then by service action). |
| .TP |
| \fB\-c\fR, \fB\-\-compact\fR |
| some command names, especially those associated with some service actions, |
| are getting longer. This may cause line wrap in the one line per command |
| mode on some terminals. When this option is given the opcode and service |
| action fields are combined into a single field with the service action, |
| prefixed by a comma shown directly after the opcode. If there is no service |
| action associated with the command, then the comma and the service action |
| are not shown after the opcode. The CDB size field is not shown when this |
| option is given. |
| .TP |
| \fB\-h\fR, \fB\-\-help\fR |
| outputs the usage message summarizing command line options |
| then exits. Ignores \fIDEVICE\fR if given. |
| .TP |
| \fB\-H\fR, \fB\-\-hex\fR |
| outputs the response in ASCII hexadecimal to stdout. |
| .TP |
| \fB\-n\fR, \fB\-\-no-inquiry\fR |
| Prior to calling a SCSI REPORT SUPPORTED OPERATION CODES or a REPORT |
| SUPPORTED TASK MANAGEMENT FUNCTIONS command, a SCSI INQUIRY command |
| is performed. The reason is to determine the peripheral device type (pdt) |
| of the \fIDEVICE\fR as this is helpful in translating operation codes |
| to the command names. By default this utility prints a summary of INQUIRY |
| command response on stdout. If this option (or the \fI\-\-raw\fR option) |
| is given then that summary is not printed on stdout. |
| .TP |
| \fB\-O\fR, \fB\-\-old\fR |
| switch to older style options. |
| .TP |
| \fB\-o\fR, \fB\-\-opcode\fR=\fIOP\fR |
| the \fIDEVICE\fR will be queried for the given operation code ( i.e. the |
| \fIOP\fR value) which is the first byte of a SCSI command. \fIOP\fR is |
| decimal unless prefixed by "0x" or it has a trailing "h". \fIOP\fR should |
| be in the range 0 to 255 (0xff) inclusive. When this option is not given |
| then all available SCSI commands supported by the \fIDEVICE\fR are listed. |
| .TP |
| \fB\-r\fR, \fB\-\-raw\fR |
| output the response in binary to stdout. Error messages and warnings, if |
| any, are sent to stderr. |
| .TP |
| \fB\-R\fR, \fB\-\-rctd\fR |
| set report command timeout descriptor (RCTD) bit in the cdb. The response |
| may or may not contain command timeout descriptors. If available they are |
| output. If supported there are two values: a nominal command timeout |
| and a recommended command timeout. Both have units of seconds. A value |
| of zero means that no timeout is indicated and this is shown in |
| the corresponding decoded output as "\-". |
| .TP |
| \fB\-q\fR, \fB\-\-repd\fR |
| set read extended parameter data (REPD) bit in the report task management |
| functions cdb. 16 bytes rather than the default 4 bytes expected in the |
| response. This was added in SPC\-4 (revision 26). |
| .TP |
| \fB\-s\fR, \fB\-\-sa\fR=\fISA\fR |
| the \fIDEVICE\fR will be queried for a command with the given service |
| action (i.e. the \fISA\fR value). Used in conjunction with the |
| \fI\-\-opcode=OP\fR option. If this option is not given, \fI\-\-opcode=OP\fR |
| is given and the command in question does have a service action then a value |
| of 0 will be assumed. \fISA\fR is decimal and expected to be in the range 0 |
| to 65535 (0xffff) inclusive. |
| .TP |
| \fB\-t\fR, \fB\-\-tmf\fR |
| list supported task management functions. This is done with the SCSI REPORT |
| SUPPORTED TASK MANAGEMENT FUNCTIONS command. When this option is chosen |
| the \fI\-\-alpha\fR, \fI\-\-opcode=OP\fR, \fI\-\-rctd\fR, \fI\-\-sa=SA\fR |
| and \fI\-\-unsorted\fR options are ignored. |
| .TP |
| \fB\-u\fR, \fB\-\-unsorted\fR |
| when all supported commands are being listed there is no requirement for |
| the device server (i.e. the \fIDEVICE\fR) to sort the list of commands. When |
| this option is given the list of supported commands is in the order given by |
| the \fIDEVICE\fR. When this option is not given the supported commands |
| are sorted numerically (first by operation code and then by service action). |
| .TP |
| \fB\-v\fR, \fB\-\-verbose\fR |
| increase level of verbosity. Can be used multiple times. |
| .TP |
| \fB\-V\fR, \fB\-\-version\fR |
| print out version string then exit. |
| .SH NOTES |
| As of SPC\-4 revision 7a the recognized task management functions are: |
| abort set, abort task set, clear ACA, clear task set, I_T nexus reset, |
| logical unit reset, query task, target reset and wakeup. |
| As of SPC\-4 revision 26 target reset and wakeup have been made obsolete |
| while query task set and query asynchronous event notification have been |
| added. |
| .PP |
| In the 2.4 series of Linux kernels the \fIDEVICE\fR must be a SCSI |
| generic (sg) device. In the 2.6 series block devices (e.g. SCSI disks |
| and DVD drives) can also be specified. For example "sg_opcodes /dev/sda" |
| will work in the 2.6 series kernels. |
| .SH EXIT STATUS |
| The exit status of sg_opcodes is 0 when it is successful. Otherwise see |
| the sg3_utils(8) man page. |
| .SH OLDER COMMAND LINE OPTIONS |
| The options in this section were the only ones available prior to sg3_utils |
| version 1.23 . In sg3_utils version 1.23 and later these older options can |
| be selected by either setting the SG3_UTILS_OLD_OPTS environment variable |
| or using '\-\-old' (or '\-O) as the first option. |
| .TP |
| \fB\-a\fR |
| sort command alphabetically. Equivalent to \fI\-\-alpha\fR in main |
| description. |
| .TP |
| \fB\-n\fR |
| don't print a summary of the SCSI INQUIRY response on stdout. |
| .TP |
| \fB\-N\fR |
| switch to the newer style options. |
| .TP |
| \fB\-o\fR=\fIOP\fR |
| the \fIDEVICE\fR will be queried for the given operation code (i.e. |
| \fIOP\fR) which is the first byte of a SCSI command. \fIOP\fR is |
| hexadecimal and expected to be in the range 0 to ff inclusive. |
| When this option is not given then all available SCSI commands supported |
| by the \fIDEVICE\fR are listed. |
| .TP |
| \fB\-q\fR |
| set the read extended parameter data (REPD) bit in report TMF cdb. |
| Equivalent to \fI\-\-repd\fR in main description. |
| .TP |
| \fB\-R\fR |
| set the report command timeout descriptor (RCTD) bit in cdb. Equivalent |
| to \fI\-\-rctd\fR in main description. |
| .TP |
| \fB\-s\fR=\fISA\fR |
| the \fIDEVICE\fR will be queried for a command with the given service |
| action (i.e. \fISA\fR). Used in conjunction with the \fI\-o=OP\fR |
| option. If this option is not given, \fI\-o=OP\fR is given and the command |
| in question does have a service action then a value of 0 will be assumed. |
| \fISA\fR is hexadecimal and expected to be in the range 0 to ffff inclusive. |
| .TP |
| \fB\-t\fR |
| list supported task management functions. Equivalent to \fI\-\-tmf\fR in |
| the main description. |
| .TP |
| \fB\-u\fR |
| output all supported commands in the order given by \fIDEVICE\fR. |
| Equivalent to \fI\-\-unsorted\fR in main description. |
| .TP |
| \fB\-v\fR |
| increase level of verbosity. Can be used multiple times. |
| .TP |
| \fB\-V\fR |
| print out version string then exit. |
| .TP |
| \fB\-?\fR |
| output usage message. Ignore all other parameters. |
| .SH EXAMPLES |
| The examples in this page use Linux device names. For suitable device |
| names in other supported Operating Systems see the sg3_utils(8) man page. |
| .PP |
| To see the information about a specific command give its operation |
| code to the '\-\-op=' option. A command line invocation is shown first |
| followed by a typical response: |
| .PP |
| # sg_opcodes \-\-op=93h /dev/sdb |
| .PP |
| Opcode=0x93 |
| .br |
| Command_name: Write same(16) |
| .br |
| Command supported [conforming to SCSI standard] |
| .br |
| Usage data: 93 e2 00 00 00 00 ff ff ff ff 00 00 ff ff 00 00 |
| .PP |
| The next example shows the supported task management functions: |
| .PP |
| # sg_opcodes \-\-tmf \-n /dev/sdb |
| .PP |
| Task Management Functions supported by device: |
| .br |
| Abort task |
| .br |
| Abort task set |
| .br |
| Clear ACA |
| .br |
| Clear task set |
| .br |
| Logical unit reset |
| .br |
| Query task |
| .br |
| .SH AUTHOR |
| Written by Douglas Gilbert |
| .SH "REPORTING BUGS" |
| Report bugs to <dgilbert at interlog dot com>. |
| .SH COPYRIGHT |
| Copyright \(co 2004\-2012 Douglas Gilbert |
| .br |
| This software is distributed under the GPL version 2. There is NO |
| warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| .SH "SEE ALSO" |
| .B sg_inq(sg3_utils) |