man sg_opcodes (Administration système) - reports information on supported SCSI commands or supported task management functions

NAME

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

SYNOPSIS

sg_opcodes [-a] [-o=<opcode> [-s=<service_action> ] ] [-u] [-u] [-v] [-V] [-?] <scsi_device>

DESCRIPTION

This utility sends a REPORT SUPPORTED OPERATION CODES or a REPORT SUPPORTED TASK MANAGEMENT FUNCTIONS SCSI command to the given device 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 "-o" option (perhaps with additional information from the "-s" option).

The name of a SCSI command depends on its peripheral device type (e.g. a disk) which is obtained from a standard SCSI INQUIRY command. Further 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.

A similar facility to query supported operation codes used to be 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 SCSI command in SPC-3 (revision 4) in February 2002.

-a
when all supported commands are being listed there is no requirement for the device server (i.e. the target) 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 '-u' option are both _not_ given then the list of supported commands is sorted numerically (first by operation code and then by service action).
-o=<opcode>
the given device will be queried for the given operation code ("opcode") which is the first byte of a SCSI command. Argument 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 target are listed.
-s=<service_action>
the given device will be queried for a command with the given service action ("service_action"). Used in conjunction with the '-o=<opcode>' option. If '-s' is not given, '-o' is given and the command in question does have a service action then a value of 0 will be assumed. The "<service_action>" argument is hexadecimal and expected to be in the range 0 to ffff inclusive.
-t
list supported task management functions. When this option is chosen the '-a', '-o' and '-u' options are ignored.
-u
when all supported commands are being listed there is no requirement for the device server (i.e. the target) to sort the list of commands. When this option is given the list of supported commands is in the order given by the target. When this option is not given the supported commands are sorted numerically (first by operation code and then by service action).
-v
verbose: print out cdb of issued commands prior to execution. '-vv' and '-vvv' are also accepted yielding greater verbosity.
-V
print out version string
-?
output usage message. Ignore all other parameters.

As of SPC-4 revision 1 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.

In the 2.4 series of Linux kernels the given device must be a SCSI generic (sg) device. In the 2.6 series block devices (e.g. disks and SCSI DVDs) can also be specified. For example "sg_opcodes /dev/sda" will work in the 2.6 series kernels.

AUTHOR

Written by Doug Gilbert

REPORTING BUGS

Report bugs to <dgilbert at interlog dot com>.

COPYRIGHT

Copyright © 2004-2005 Douglas Gilbert

This software is distributed under the GPL version 2. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO

sg_inq(sg3_utils)