1SG_REQUESTS(8) SG3_UTILS SG_REQUESTS(8)
2
3
4
6 sg_requests - send one or more SCSI REQUEST SENSE commands
7
9 sg_requests [--desc] [--help] [--hex] [--maxlen=LEN] [--num=NUM]
10 [--number=NUM] [--progress] [--raw] [--status] [--time] [--verbose]
11 [--version] DEVICE
12
14 Send SCSI REQUEST SENSE command to DEVICE and output the parameter data
15 response which is expected to be in sense data format. Both fixed and
16 descriptor sense data formats are supported.
17
18 Multiple REQUEST SENSE commands can be sent with the --num=NUM option.
19 This can be used for timing purposes or monitoring the progress indica‐
20 tion.
21
23 Arguments to long options are mandatory for short options as well.
24
25 -d, --desc
26 sets the DESC bit in the REQUEST SENSE SCSI cdb. The DEVICE
27 should return sense data in descriptor (rather than fixed) for‐
28 mat. This will only occur if the DEVICE recognizes descriptor
29 format (SPC-3 and later). If the device is pre SPC-3 then set‐
30 ting a bit in a reserved field may cause a check condition sta‐
31 tus with an illegal request sense key, but will most likely be
32 ignored.
33
34 -h, --help
35 output the usage message then exit.
36
37 -H, --hex
38 output response in ASCII hexadecimal.
39
40 -m, --maxlen=LEN
41 where LEN is the (maximum) response length in bytes. It is
42 placed in the cdb's "allocation length" field. If not given (or
43 LEN is zero) then 252 is used. The maximum value of LEN is 255
44 (but SPC-4 recommends 252).
45
46 -n, --num=NUM
47 perform NUM SCSI REQUEST SENSE commands, stopping when either
48 NUM is reached or an error occurs. The default value for NUM is
49 1 .
50
51 --number=NUM
52 same action as --num=NUM. Added for compatibility with sg_turs.
53
54 -p, --progress
55 show progress indication (a percentage) if available. If --num‐
56 ber=NUM is given, NUM is greater than 1 and an initial progress
57 indication was detected then this utility waits 30 seconds
58 before subsequent checks. Exits when NUM is reached or there
59 are no more progress indications. Ignores --hex, --raw and
60 --time options. See NOTES section below.
61
62 -r, --raw
63 output response in binary (to stdout).
64
65 -s, --status
66 if the REQUEST SENSE command finished without error (as indi‐
67 cated by its SCSI status) then the contents of the parameter
68 data are analysed as sense data and the exit status is set
69 accordingly. The default action (i.e. when this option is not
70 given) is to ignore the contents of the parameter data for the
71 purposes of setting the exit status. Some types of error set a
72 sense key of "NO SENSE" with non-zero information in the addi‐
73 tional sense code (e.g. the FAILURE PREDICTION THRESHOLD
74 EXCEEDED group of codes); this results in an exit status value
75 of 10. If the sense key is "NO SENSE" and both asc and ascq are
76 zero then the exit status is set to 0 . See the sg3_utils(8) man
77 page for exit status values.
78
79 -t, --time
80 time the SCSI REQUEST SENSE command(s) and calculate the average
81 number of operations per second.
82
83 -v, --verbose
84 increase the level of verbosity, (i.e. debug output). Addition‐
85 ally the response (if received) is output in ASCII-HEX. Use this
86 option multiple times for greater verbosity.
87
88 -V, --version
89 print the version string and then exit.
90
92 In SCSI 1 and 2 the REQUEST SENSE command was very important for error
93 and warning processing in SCSI. The autosense capability rendered this
94 command almost superfluous.
95
96 However recent SCSI drafts (e.g. SPC-4 rev 14 and SBC-3 rev 14)
97 increase the utility of the REQUEST SENSE command. Idle and standby
98 (low) power conditions can be detected with this command.
99
100 The REQUEST SENSE command is not marked as mandatory in SPC-3 (i.e. for
101 all SCSI devices) but is marked as mandatory in SBC-2 (i.e. for disks),
102 SSC-3 (i.e. for tapes) and MMC-4 (i.e. for CD/DVD/HD-DVD/BD drives).
103
104 The progress indication is optionally part of the sense data. When a
105 prior command that takes a long time to complete (and typically pre‐
106 cludes other media access commands) is still underway, the progress
107 indication can be used to determine how long before the device returns
108 to its normal state.
109
110 The SCSI FORMAT command for disks used with the IMMED bit set is an
111 example of an operation that takes a significant amount of time and
112 precludes other media access during that time. The IMMED bit set
113 instructs the FORMAT command to return control to the application
114 client once the format has commenced (see SBC-3). Several long duration
115 SCSI commands associated with tape drives also use the progress indica‐
116 tion (see SSC-3).
117
118 Early standards suggested that the SCSI TEST UNIT READY command be used
119 for polling the progress indication (see the sg_turs utility). Since
120 SPC-3 the standards suggest that the SCSI REQUEST SENSE command should
121 be used instead.
122
123 The DEVICE is opened with a read-only flag (e.g. in Unix with the
124 O_RDONLY flag).
125
127 The exit status of sg_requests is 0 when it is successful. Otherwise
128 see the sg3_utils(8) man page.
129
131 Written by Douglas Gilbert.
132
134 Report bugs to <dgilbert at interlog dot com>.
135
137 Copyright © 2004-2016 Douglas Gilbert
138 This software is distributed under a FreeBSD license. There is NO war‐
139 ranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR‐
140 POSE.
141
143 sg_turs (sg3_utils)
144
145
146
147sg3_utils-1.43 February 2016 SG_REQUESTS(8)