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

NAME

6       sg_opcodes  -  reports  information  on supported SCSI commands or task
7       management functions
8

SYNOPSIS

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

DESCRIPTION

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

OPTIONS

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

NOTES

114       As  of  SPC-4 revision 7a the recognized task management functions are:
115       abort set, abort task set, clear ACA, clear task set, I_T nexus  reset,
116       logical unit reset, query task, target reset and wakeup.
117
118       In  the  2.4  series of Linux kernels the DEVICE must be a SCSI generic
119       (sg) device. In the 2.6 series block devices (e.g. SCSI disks  and  DVD
120       drives)  can  also be specified. For example "sg_opcodes /dev/sda" will
121       work in the 2.6 series kernels.
122

EXIT STATUS

124       The exit status of sg_opcodes is 0 when it is successful. Otherwise see
125       the sg3_utils(8) man page.
126

OLDER COMMAND LINE OPTIONS

128       The  options  in  this  section  were  the only ones available prior to
129       sg3_utils version 1.23 . In sg3_utils  version  1.23  and  later  these
130       older  options can be selected by either setting the SG3_UTILS_OLD_OPTS
131       environment variable or using '--old' (or '-O) as the first option.
132
133       -a     sort command  alphabetically.  Equivalent  to  --alpha  in  main
134              description.
135
136       -N     switch to the newer style options.
137
138       -o=OP  the  DEVICE  will  be queried for the given operation code (i.e.
139              OP) which is the first byte of a SCSI command. OP is hexadecimal
140              and  expected  to  be in the range 0 to ff inclusive.  When this
141              option is not given then all available SCSI  commands  supported
142              by the DEVICE are listed.
143
144       -R     set  the  report  command  timeout descriptor (RCTD) bit in cdb.
145              Equivalent to --rctd in main description.
146
147       -s=SA  the DEVICE will be queried for a command with the given  service
148              action  (i.e. SA). Used in conjunction with the -o=OP option. If
149              this option is not given, -o=OP is  given  and  the  command  in
150              question  does  have  a service action then a value of 0 will be
151              assumed.  SA is hexadecimal and expected to be in the range 0 to
152              ffff inclusive.
153
154       -t     list supported task management functions. Equivalent to --tmf in
155              the main description.
156
157       -u     output all supported commands in  the  order  given  by  DEVICE.
158              Equivalent to --unsorted in main description.
159
160       -v     increase level of verbosity. Can be used multiple times.
161
162       -V     print out version string then exit.
163
164       -?     output usage message. Ignore all other parameters.
165

AUTHOR

167       Written by Doug Gilbert
168

REPORTING BUGS

170       Report bugs to <dgilbert at interlog dot com>.
171
173       Copyright © 2004-2007 Douglas Gilbert
174       This  software is distributed under the GPL version 2. There is NO war‐
175       ranty; not even for MERCHANTABILITY or FITNESS FOR  A  PARTICULAR  PUR‐
176       POSE.
177

SEE ALSO

179       sg_inq(sg3_utils)
180
181
182
183sg3_utils-1.23                   January 2007                    SG_OPCODES(8)
Impressum