SG_REQUESTS(8)

NAME
sg_requests - send one or more SCSI REQUEST SENSE commands

SYNOPSIS
sg_requests [--desc] [--help] [--hex] [--num=NUM] [--raw] [--status] [--time] [--verbose] [--version] DEVICE

DESCRIPTION

Send REQUEST SENSE command to DEVICE and output the response which is expected to be in sense data format. Both fixed and descriptor format are supported.

OPTIONS
Arguments to long options are mandatory for short options as well.

-d, --desc
    sets the DESC bit in the REQUEST SENSE SCSI cdb. The DEVICE should return sense data in descriptor (rather than fixed) format. This will only occur if the DEVICE recognizes descriptor format (SPC-3 and later). If the device is pre SPC-3 then setting a bit in a reserved field may cause a check condition status with an illegal request sense key.

-h, --help
    output the usage message then exit.

-H, --hex
    output response in ASCII hexadecimal.

-n, --num=NUM
    perform NUM SCSI REQUEST SENSE commands, stopping when either NUM is reached or an error occurs. The default value for NUM is 1 .

-r, --raw
    output response in binary (to stdout).

-s, --status
    if the last REQUEST SENSE finished without error (from SCSI status or autosense) then the contents of the parameter data are analysed as sense data and the exit status is set accordingly. The default action (when this option is not given) is to ignore the contents of the parameter data for the purposes of setting the exit status. Some types of error set a sense key of "NO SENSE" with non-zero information in the additional sense code (e.g. the FAILURE PREDICTION THRESHOLD EXCEEDED group of codes); this results in an exit status value of 10. If the sense key is "NO SENSE" and both asc and ascq are zero then the exit status is set to 0 . See the sg3_utils(8) man page for exit status values.

-t, --time
    time the SCSI REQUEST SENSE command(s) and calculate the average number of operations per second.

-v, --verbose
    increase the level of verbosity, (i.e. debug output). Additionally the response (if received) is output in ASCII-HEX. Use this option multiple times for greater verbosity.

-V, --version
    print the version string and then exit.

NOTES
In SCSI 1 and 2 the REQUEST SENSE command was very important for error and warning processing in SCSI. The autosense capability rendered this command almost superfluous.

However recent SCSI drafts (e.g. SPC-3 rev 23 and SBC-2 rev 16) increase the utility of the REQUEST SENSE command. Idle and standby power conditions can now be detected with this command; a progress indication is given during FORMAT (when that command was started with with IMMED=1 in its parameter header); and the Filemark, ILI and EOM bits may be set (e.g. by a tape drive). Interestingly the sense key is set to "no sense" while the asc/ascq code convey the information (e.g. 0x5e/0x4 "Standby condition activated by command").

The REQUEST SENSE command is not marked as mandatory in SPC-3 (i.e. for all SCSI devices) but is marked as mandatory in SBC-2 (i.e. for disks), SSC-3 (i.e. for tapes) and MMC-4 (i.e. for CD/DVD drives).

EXIT STATUS
The exit status of sg_requests is 0 when it is successful. Otherwise see the sg3_utils(8) man page.

AUTHORS
Written by Douglas Gilbert.

REPORTING BUGS
Report bugs to <dgilbert at interlog dot com>.

COPYRIGHT
Copyright © 2004-2007 Douglas Gilbert
This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO
sg3_utils