1SG_OPCODES(8)                      SG3_UTILS                     SG_OPCODES(8)
2
3
4

NAME

6       sg_opcodes  -  report  supported SCSI commands or task management func‐
7       tions
8

SYNOPSIS

10       sg_opcodes  [--alpha]  [--help]  [--hex]  [--no-inquiry]  [--opcode=OP]
11       [--raw]  [--rctd]  [--repd]  [--sa=SA] [--tmf] [--unsorted] [--verbose]
12       [--version] DEVICE
13
14       sg_opcodes [-a] [-n] [-o=OP] [-q] [-R] [-s=SA] [-t] [-u] [-v] [-V] [-?]
15       DEVICE
16

DESCRIPTION

18       This  utility sends a SCSI REPORT SUPPORTED OPERATION CODES or a REPORT
19       SUPPORTED TASK MANAGEMENT FUNCTIONS command to the DEVICE and then out‐
20       puts  the response. The default action is to report supported operation
21       codes. In this mode it will either list all supported commands or  give
22       detailed   information   on   a  specific  command  identified  by  the
23       --opcode=OP  option  (perhaps  with  additional  information  from  the
24       --sa=SA option).
25
26       The  name of a SCSI command depends on its peripheral device type (e.g.
27       a disk). The REPORT SUPPORTED OPERATION CODES and REPORT SUPPORTED TASK
28       MANAGEMENT  FUNCTIONS commands are not supported in the MMC command set
29       for CD and DVD devices. This utility does  an  INQUIRY  to  obtain  the
30       peripheral  device type and prints out the vendor, product and revision
31       strings.
32
33       A similar facility to query supported operation  codes  previously  was
34       available   via  the  CmdDt  bit  in  the  SCSI  INQUIRY  command  (see
35       sg_inq(8)). However that facility was made obsolete and replaced by the
36       REPORT  SUPPORTED  OPERATION CODES command in SPC-3 (revision 4) during
37       February 2002.
38
39       This utility supports two command line syntaxes, the preferred  one  is
40       shown first in the synopsis and explained in this section. A later sec‐
41       tion on the old command  line  syntax  outlines  the  second  group  of
42       options.
43

OPTIONS

45       Arguments to long options are mandatory for short options as well.
46
47       -a, --alpha
48              when  all  supported  commands  are  being  listed  there  is no
49              requirement for the device server (i.e. the DEVICE) to sort  the
50              list  of  commands.  When  this option is given the list of sup‐
51              ported commands is sorted by name  (alphabetically).  When  this
52              option  and  the --unsorted option are both _not_ given then the
53              list of supported commands is sorted numerically (first by oper‐
54              ation code and then by service action).
55
56       -h, --help
57              outputs  the usage message summarizing command line options then
58              exits. Ignores DEVICE if given.
59
60       -H, --hex
61              outputs the response in ASCII hexadecimal to stdout.
62
63       -n, --no-inquiry
64              Prior to calling a SCSI REPORT SUPPORTED OPERATION  CODES  or  a
65              REPORT  SUPPORTED  TASK  MANAGEMENT  FUNCTIONS  command,  a SCSI
66              INQUIRY command is performed. The reason  is  to  determine  the
67              peripheral device type (pdt) of the DEVICE as this is helpful in
68              translating operation codes to the  command  names.  By  default
69              this  utility  prints  a  summary of INQUIRY command response on
70              stdout. If this option (or the --raw option) is given then  that
71              summary is not printed on stdout.
72
73       -O, --old
74              Switch to older style options. Please use as first option.
75
76       -o, --opcode=OP
77              the  DEVICE  will be queried for the given operation code ( i.e.
78              the OP value) which is the first byte of a SCSI command.  OP  is
79              decimal  unless  prefixed  by  "0x" or it has a trailing "h". OP
80              should be in the range 0 to  255  (0xff)  inclusive.  When  this
81              option  is  not given then all available SCSI commands supported
82              by the DEVICE are listed.
83
84       -r, --raw
85              output the response in binary  to  stdout.  Error  messages  and
86              warnings, if any, are sent to stderr.
87
88       -R, --rctd
89              set report command timeout descriptor (RCTD) bit in the cdb. The
90              response may or may not contain command timeout descriptors.  If
91              available  they are output. If supported there are two values: a
92              nominal command timeout and a recommended command timeout.  Both
93              have  units of seconds. A value of zero means that no timeout is
94              indicated and this is shown in the corresponding decoded  output
95              as "-".
96
97       -q, --repd
98              set  read  extended parameter data (REPD) bit in the report task
99              management functions cdb. 16 bytes rather  than  the  default  4
100              bytes  expected  in the response. This was added in SPC-4 (revi‐
101              sion 26).
102
103       -s, --sa=SA
104              the DEVICE will be queried for a command with the given  service
105              action  (i.e.  the  SA  value).  Used  in  conjunction  with the
106              --opcode=OP option. If this option is not given, --opcode=OP  is
107              given  and  the  command  in question does have a service action
108              then a value of 0 will be assumed. SA is decimal and expected to
109              be in the range 0 to 65535 (0xffff) inclusive.
110
111       -t, --tmf
112              list  supported task management functions. This is done with the
113              SCSI REPORT SUPPORTED TASK MANAGEMENT FUNCTIONS  command.   When
114              this  option is chosen the --alpha, --opcode=OP, --rctd, --sa=SA
115              and --unsorted options are ignored.
116
117       -u, --unsorted
118              when all  supported  commands  are  being  listed  there  is  no
119              requirement  for the device server (i.e. the DEVICE) to sort the
120              list of commands. When this option is given  the  list  of  sup‐
121              ported  commands  is in the order given by the DEVICE. When this
122              option is not given the supported commands  are  sorted  numeri‐
123              cally (first by operation code and then by service action).
124
125       -v, --verbose
126              increase level of verbosity. Can be used multiple times.
127
128       -V, --version
129              print out version string then exit.
130

NOTES

132       As  of  SPC-4 revision 7a the recognized task management functions are:
133       abort set, abort task set, clear ACA, clear task set, I_T nexus  reset,
134       logical  unit  reset, query task, target reset and wakeup.  As of SPC-4
135       revision 26 target reset and wakeup have been made obsolete while query
136       task set and query asynchronous event notification have been added.
137
138       In  the  2.4  series of Linux kernels the DEVICE must be a SCSI generic
139       (sg) device. In the 2.6 series block devices (e.g. SCSI disks  and  DVD
140       drives)  can  also be specified. For example "sg_opcodes /dev/sda" will
141       work in the 2.6 series kernels.
142

EXIT STATUS

144       The exit status of sg_opcodes is 0 when it is successful. Otherwise see
145       the sg3_utils(8) man page.
146

OLDER COMMAND LINE OPTIONS

148       The  options  in  this  section  were  the only ones available prior to
149       sg3_utils version 1.23 . In sg3_utils  version  1.23  and  later  these
150       older  options can be selected by either setting the SG3_UTILS_OLD_OPTS
151       environment variable or using '--old' (or '-O) as the first option.
152
153       -a     sort command  alphabetically.  Equivalent  to  --alpha  in  main
154              description.
155
156       -n     don't print a summary of the SCSI INQUIRY response on stdout.
157
158       -N, --new
159              Switch to the newer style options.
160
161       -o=OP  the  DEVICE  will  be queried for the given operation code (i.e.
162              OP) which is the first byte of a SCSI command. OP is hexadecimal
163              and  expected  to  be in the range 0 to ff inclusive.  When this
164              option is not given then all available SCSI  commands  supported
165              by the DEVICE are listed.
166
167       -q     set  the  read  extended parameter data (REPD) bit in report TMF
168              cdb.  Equivalent to --repd in main description.
169
170       -R     set the report command timeout descriptor  (RCTD)  bit  in  cdb.
171              Equivalent to --rctd in main description.
172
173       -s=SA  the  DEVICE will be queried for a command with the given service
174              action (i.e. SA). Used in conjunction with the -o=OP option.  If
175              this  option  is  not  given,  -o=OP is given and the command in
176              question does have a service action then a value of  0  will  be
177              assumed.  SA is hexadecimal and expected to be in the range 0 to
178              ffff inclusive.
179
180       -t     list supported task management functions. Equivalent to --tmf in
181              the main description.
182
183       -u     output  all  supported  commands  in  the order given by DEVICE.
184              Equivalent to --unsorted in main description.
185
186       -v     increase level of verbosity. Can be used multiple times.
187
188       -V     print out version string then exit.
189
190       -?     output usage message. Ignore all other parameters.
191

EXAMPLES

193       The examples in this page use Linux device names. For  suitable  device
194       names  in  other  supported  Operating Systems see the sg3_utils(8) man
195       page.
196
197       To see the information about a specific command give its operation code
198       to  the  '--op='  option. A command line invocation is shown first fol‐
199       lowed by a typical response:
200
201          # sg_opcodes --op=93h /dev/sdb
202
203         Opcode=0x93
204         Command_name: Write same(16)
205         Command supported [conforming to SCSI standard]
206         Usage data: 93 e2 00 00 00 00 ff ff ff ff 00 00 ff ff 00 00
207
208       The next example shows the supported task management functions:
209
210          # sg_opcodes --tmf -n /dev/sdb
211
212       Task Management Functions supported by device:
213           Abort task
214           Abort task set
215           Clear ACA
216           Clear task set
217           Logical unit reset
218           Query task
219

AUTHOR

221       Written by Douglas Gilbert
222

REPORTING BUGS

224       Report bugs to <dgilbert at interlog dot com>.
225
227       Copyright © 2004-2012 Douglas Gilbert
228       This software is distributed under the GPL version 2. There is NO  war‐
229       ranty;  not  even  for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
230       POSE.
231

SEE ALSO

233       sg_inq(sg3_utils)
234
235
236
237sg3_utils-1.35                   December 2012                   SG_OPCODES(8)
Impressum