aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2008-04-05 12:54:33 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2008-04-05 12:54:33 +0000
commite83316c69658e88f525a69b5ee9b1b537a369f33 (patch)
treefe10671779085b633990ae3c14a6e6372c943963
parent5dd770c7c4aaa582a9fe694384bfd52a78053362 (diff)
downloadsg3_utils-e83316c69658e88f525a69b5ee9b1b537a369f33.tar.gz
maxlen option additions
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@167 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog44
-rw-r--r--README2
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg3_utils.821
-rw-r--r--doc/sg_dd.88
-rw-r--r--doc/sg_get_config.812
-rw-r--r--doc/sg_inq.84
-rw-r--r--doc/sg_requests.820
-rw-r--r--doc/sg_rmsn.813
-rw-r--r--doc/sgm_dd.812
-rw-r--r--lib/sg_cmds_basic.c5
-rwxr-xr-xscripts/scsi_satl4
-rw-r--r--sg3_utils.spec4
-rw-r--r--src/sg_inq.c3
-rw-r--r--src/sg_inq_data.c2
-rw-r--r--src/sg_requests.c102
-rw-r--r--src/sg_vpd.c7
17 files changed, 151 insertions, 114 deletions
diff --git a/ChangeLog b/ChangeLog
index c4ca1fda..8d1583b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,50 +2,50 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for sg3_utils-1.26 [20080327]
- - sg_ses: sync with ses2r19b
+Changelog for sg3_utils-1.26 [20080404]
+ - sg_sat_phy_event: new utility; copied from examples
+ directory and enhanced, rename original to sg__sat_phy_event
+ - sg_ses: sync with ses2r19b, many nomenclature changes
- sg_get_config: sync with mmc6r01
- allow Microcode upgrade and DVD read feature descriptors
to be 4 bytes long
- - sg_cmds_extra: add vrprotect argument to sg_ll_verify10()
- - add sg_ll_get_performance() and sg_ll_set_cd_speed()
- sg_verify: add --vrprotect= option
- sg_vpd: add nominal form factor to block dev. char. VPD page
- add --maxlen= option to set allocation length in cdb
- sg_inq: add --maxlen= option that does same as --len=
- - move version descriptors into sg_inq_data.c file
- - update version descriptors to spc4r13
+ - move version descriptors (spc4r14) to sg_inq_data.c file
- sg_inq+sg_vpd: logic for "NAA-3 Locally assigned" identifier
- update extended inquiry VPD page
- - sg_write_long: add examples section to man page
- - sg_sat_phy_event: copied from examples directory and enhanced,
- rename original to sg__sat_phy_event
- - sg_dd: improve MMC handling of 'illegal mode for this track'
- read errors (with ILI and info field)
- sg_modes: add --maxlen= option to specify allocation length
- - sg_start: add '--noflush' and '--mod=PC_MOD' options (08-139r1)
- - change 'long long' to int64_t and 'unsigned long long' to
- uint64_t to stress that 64 bit integer wanted, not larger
+ - sg_start: add '--noflush' and '--mod=PC_MOD' options (sbc3r14)
- sg_request: add a '--progress' option (similar to sg_turs)
+ - add --maxlen= option to set allocation length in cdb
+ - sg_dd: improve MMC handling of 'illegal mode for this track'
+ read errors (with ILI and info field)
+ - sg_dd, sgm_dd, sgp_dd, sginfo, sg_rbuf, sg_read: replace
+ "%lld" and friends with PRI macros
- sg_turs: add more to man page about '--progress' indication
- - sg_lib: update asc/ascq code to spc4r13
- - audit of dangerous 'u64 = uch[24] << 24' code, replace most
- 'unsigned long's
- - utils/hxascdmp: add hxascdmp(1) man page
+ - sg_write_long: add examples section to man page
+ - sg_lib: update asc/ascq strings to spc4r14
- split sg_lib into sg_lib_data.[hc] and sg_lib.[hc]
- split sg_cmds_extra into sg_cmds_extra and sg_cmds_mmc
- add osd2r03 service actions (all different from osd-r10)
- add sg_get_trans_proto_str()
- add sg_get_sense_filemark_eom_ili() function (MMC uses ILI)
- add sense key specific unit attention condition queue
- overflow decoding
- - multiple documentation corrections provided by Dan Horak
+ overflow decoding (added in spc4r13)
- sg_cmds_mmc: add sg_ll_set_streaming() function
+ - sg_cmds_extra: add vrprotect argument to sg_ll_verify10()
+ - add sg_ll_get_performance() and sg_ll_set_cd_speed()
+ - change 'long long' to int64_t and 'unsigned long long' to
+ uint64_t to stress that 64 bit integer wanted, not larger
+ - audit of dangerous 'u64 = uch[24] << 24' code, replace most
+ 'unsigned long's
+ - multiple documentation corrections provided by Dan Horak
- win32/MinGW: define SG3_UTILS_MINGW when detected
- remove archive/pre_configure subdirectory
- - sg_dd, sgm_dd, sgp_dd, sginfo, sg_rbuf, sg_read: replace
- "%lld" and friends with PRI macros
- move sg_io_linux.c into the lib subdirectory
+ - utils/hxascdmp: add hxascdmp(1) man page
Changelog for sg3_utils-1.25 [20071016]
- sg_stpg: new utility to Set Target Port Groups
diff --git a/README b/README
index d1b2e311..9fbf721a 100644
--- a/README
+++ b/README
@@ -343,4 +343,4 @@ See http://www.torque.net/sg/tools.html
Doug Gilbert
-27th March 2008
+4th April 2008
diff --git a/debian/changelog b/debian/changelog
index 63e755f3..efa09aff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.26-0.1) unstable; urgency=low
* New upstream version
- -- Doug Gilbert <dgilbert@interlog.com> Thu, 27 Mar 2008 16:00:00 -0400
+ -- Doug Gilbert <dgilbert@interlog.com> Fri, 04 Apr 2008 17:00:00 +1000
sg3-utils (1.25-0.1) unstable; urgency=low
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index 4b7019de..da8a96bf 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -1,10 +1,10 @@
-.TH SG3_UTILS "8" "January 2008" "sg3_utils\-1.26" SG3_UTILS
+.TH SG3_UTILS "8" "April 2008" "sg3_utils\-1.26" SG3_UTILS
.SH NAME
sg3_utils \- a package of utilities for sending SCSI commands
.SH SYNOPSIS
.B sg_*
-[\fI\-\-help\fR] [\fI\-\-hex\fR] [\fI\-\-raw\fR] [\fI\-\-verbose\fR]
-[\fI\-\-version\fR] [\fIOTHER_OPTIONS\fR] \fIDEVICE\fR
+[\fI\-\-help\fR] [\fI\-\-hex\fR] [\fI\-\-maxlen=LEN\fR] [\fI\-\-raw\fR]
+[\fI\-\-verbose\fR] [\fI\-\-version\fR] [\fIOTHER_OPTIONS\fR] \fIDEVICE\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
@@ -25,7 +25,7 @@ http://www.t10.org/scsi\-3.htm with the SCSI command sets in the upper part
of the diagram. SCSI commands in common with all device types can be found
in SPC of which SPC\-4 is the latest major version. Block device specific
commands (e.g. as used by disks) are in SBC, those for tape drives in
-SSC and those for CD/DVD drives in MMC.
+SSC and those for CD/DVD/HD_DVD/BD drives in MMC.
.PP
There are two generations of command line option usage. The newer
utilities (written since July 2004) use the getopt_long() function to parse
@@ -153,6 +153,19 @@ output the usage message then exit.
for SCSI commands that yield a non\-trivial response, print out that
response in ASCII hexadecimal.
.TP
+\fB\-m\fR, \fB\-\-maxlen\fR=\fILEN\fR
+several important SCSI commands (e.g. INQUIRY and MODE SENSE) have response
+lengths that vary depending on many factors, only some of which these
+utilities take into account. The maximum response length is typically
+specified in the 'allocation length' field of the cdb. In the absence of
+this option, several utilities use a default allocation length (sometimes
+recommended in the SCSI draft standards) or a "double fetch" strategy.
+See sg_logs(8) for its description of a "double fetch" strategy. These
+techniques are imperfect and in the presence of faulty SCSI targets can
+cause problems (e.g. some USB mass storage devices freeze if they receive
+an INQUIRY allocation length other than 36). Also use of this option
+disables any "double fetch" strategy that may have otherwise been used.
+.TP
\fB\-r\fR, \fB\-\-raw\fR
for SCSI commands that yield a non\-trivial response, output that response
in binary to stdout. If any error messages or warning are produced they are
diff --git a/doc/sg_dd.8 b/doc/sg_dd.8
index 7f51bbdb..a25f5b1b 100644
--- a/doc/sg_dd.8
+++ b/doc/sg_dd.8
@@ -1,4 +1,4 @@
-.TH SG_DD "8" "June 2007" "sg3_utils\-1.25" SG3_UTILS
+.TH SG_DD "8" "April 2008" "sg3_utils\-1.26" SG3_UTILS
.SH NAME
sg_dd \- copies data to and from files and devices. Specialised for
devices that understand the SCSI command set.
@@ -343,8 +343,8 @@ Disk partition information can often be found with
[the "\-ul" argument is useful in this respect].
.PP
For sg devices (and block devices when blk_sgio=1 is given) this utility
-issues SCSI READ and WRITE (SBC) commands which
-are appropriate for disks and reading from CD/DVD drives. Those commands
+issues SCSI READ and WRITE (SBC) commands which are appropriate for disks and
+reading from CD/DVD/HD-DVD/BD drives. Those commands
are not formatted correctly for tape devices so sg_dd should not be used on
tape devices. If the largest block address of the requested transfer
exceeds a 32 bit block number (i.e 0xffff) then a warning is issued and
@@ -416,7 +416,7 @@ Written by Doug Gilbert and Peter Allworth.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2000\-2007 Douglas Gilbert
+Copyright \(co 2000\-2008 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/doc/sg_get_config.8 b/doc/sg_get_config.8
index ff81eeae..6f97dcd7 100644
--- a/doc/sg_get_config.8
+++ b/doc/sg_get_config.8
@@ -1,4 +1,4 @@
-.TH SG_GET_CONFIG "8" "February 2007" "sg3_utils\-1.24" SG3_UTILS
+.TH SG_GET_CONFIG "8" "April 2008" "sg3_utils\-1.26" SG3_UTILS
.SH NAME
sg_get_config \- sends a SCSI GET CONFIGURATION command
.SH SYNOPSIS
@@ -12,7 +12,7 @@ sg_get_config \- sends a SCSI GET CONFIGURATION command
.PP
Sends a SCSI GET CONFIGURATION command to \fIDEVICE\fR and decodes the
response. The response includes the features and profiles of the device.
-Typically these devices are CD and DVD players that may (but not
+Typically these devices are CD, DVD, HD-DVD and BD players that may (but not
necessarily) have media in them. These devices may well be connected via
ATAPI, USB or IEEE 1394 transports. In such cases they are "SCSI" devices
only in the sense that they use the "Multi\-Media command" set (MMC).
@@ -24,9 +24,9 @@ section 5 on "Features and Profile for Multi_Media devices" for more
information on specific feature parameters and profiles. The manufacturer's
product manual may also be useful.
.PP
-Since modern DVD writers support many features and profiles, the decoded
-output from this utility can be large. There are various ways to cut down
-the output. If the \fI\-\-brief\fR option is used only the feature names
+Since modern DVD and BD writers support many features and profiles, the
+decoded output from this utility can be large. There are various ways to cut
+down the output. If the \fI\-\-brief\fR option is used only the feature names
are shown and the feature parameters are not decoded. Alternatively if only
one feature is of interest then this combination of options is
appropriate: "\-\-rt=2 \-\-starting=\fIFC\fR". Another possibility is to show
@@ -122,7 +122,7 @@ Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2004\-2007 Douglas Gilbert
+Copyright \(co 2004\-2008 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/doc/sg_inq.8 b/doc/sg_inq.8
index 945fc50b..0b5a0a63 100644
--- a/doc/sg_inq.8
+++ b/doc/sg_inq.8
@@ -173,7 +173,7 @@ device names may be used as well (e.g. "/dev/st0m").
.SH ATA DEVICES
There are two major types of ATA devices: non\-packet devices (e.g. ATA
disks) and packet devices (ATAPI). The majority of ATAPI devices are
-CD/DVD drives in which the ATAPI transport carries the MMC set (i.e.
+CD/DVD/BD drives in which the ATAPI transport carries the MMC set (i.e.
a SCSI command set). Further, both types of ATA devices can be connected
to a host computer via a "SCSI" (or some other) transport. When an
ATA disk is controlled via a SCSI (or non\-ATA) transport then two
@@ -188,7 +188,7 @@ The main identifying command for any SCSI device is an INQUIRY. The
corresponding command for an ATA non\-packet device is IDENTIFY DEVICE
while for an ATA packet device it is IDENTIFY PACKET DEVICE.
.PP
-When this utility is invoked for an ATAPI device (e.g. a CD/DVD
+When this utility is invoked for an ATAPI device (e.g. a CD/DVD/BD
drive with "sg_inq /dev/hdc") then a SCSI INQUIRY is sent to the
device and if it responds then the response to decoded and output and
this utility exits. To see the response for an ATA IDENTIFY PACKET
diff --git a/doc/sg_requests.8 b/doc/sg_requests.8
index 83d93591..f3634480 100644
--- a/doc/sg_requests.8
+++ b/doc/sg_requests.8
@@ -1,11 +1,11 @@
-.TH SG_REQUESTS "8" "March 2008" "sg3_utils\-1.26" SG3_UTILS
+.TH SG_REQUESTS "8" "April 2008" "sg3_utils\-1.26" SG3_UTILS
.SH NAME
sg_requests \- send one or more SCSI REQUEST SENSE commands
.SH SYNOPSIS
.B sg_requests
-[\fI\-\-desc\fR] [\fI\-\-help\fR] [\fI\-\-hex\fR] [\fI\-\-num=NUM\fR]
-[\fI\-\-progress\fR] [\fI\-\-raw\fR] [\fI\-\-status\fR] [\fI\-\-time\fR]
-[\fI\-\-verbose\fR] [\fI\-\-version\fR] \fIDEVICE\fR
+[\fI\-\-desc\fR] [\fI\-\-help\fR] [\fI\-\-hex\fR] [\fI\-\-maxlen=LEN\fR]
+[\fI\-\-num=NUM\fR] [\fI\-\-progress\fR] [\fI\-\-raw\fR] [\fI\-\-status\fR]
+[\fI\-\-time\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR] \fIDEVICE\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
@@ -24,7 +24,8 @@ sets the DESC bit in the REQUEST SENSE SCSI cdb. The \fIDEVICE\fR
should return sense data in descriptor (rather than fixed) format. This
will only occur if the \fIDEVICE\fR 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.
+field may cause a check condition status with an illegal request sense key,
+but will most likely be ignored.
.TP
\fB\-h\fR, \fB\-\-help\fR
output the usage message then exit.
@@ -32,6 +33,11 @@ output the usage message then exit.
\fB\-H\fR, \fB\-\-hex\fR
output response in ASCII hexadecimal.
.TP
+\fB\-m\fR, \fB\-\-maxlen\fR=\fILEN\fR
+where \fILEN\fR is the (maximum) response length in bytes. It is placed in the
+cdb's "allocation length" field. If not given (or \fILEN\fR is zero) then
+252 is used. The maximum value of \fILEN\fR is 255 (but SPC-4 recommends 252).
+.TP
\fB\-n\fR, \fB\-\-num\fR=\fINUM\fR
perform \fINUM\fR SCSI REQUEST SENSE commands, stopping when either \fINUM\fR
is reached or an error occurs. The default value for \fINUM\fR is 1 .
@@ -76,13 +82,13 @@ 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.
.PP
-However recent SCSI drafts (e.g. SPC\-3 rev 23 and SBC\-2 rev 16) increase
+However recent SCSI drafts (e.g. SPC\-4 rev 14 and SBC\-3 rev 14) increase
the utility of the REQUEST SENSE command. Idle and standby (low) power
conditions can be detected with this command.
.PP
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).
+SSC\-3 (i.e. for tapes) and MMC\-4 (i.e. for CD/DVD/HD-DVD/BD drives).
.PP
The progress indication is optionally part of the sense data. When a prior
command that takes a long time to complete (and typically precludes other
diff --git a/doc/sg_rmsn.8 b/doc/sg_rmsn.8
index aed7154a..aa54d19e 100644
--- a/doc/sg_rmsn.8
+++ b/doc/sg_rmsn.8
@@ -1,4 +1,4 @@
-.TH SG_RMSN "8" "January 2007" "sg3_utils\-1.23" SG3_UTILS
+.TH SG_RMSN "8" "April 2008" "sg3_utils\-1.26" SG3_UTILS
.SH NAME
sg_rmsn \- sends a SCSI READ MEDIA SERIAL NUMBER command
.SH SYNOPSIS
@@ -11,10 +11,9 @@ sg_rmsn \- sends a SCSI READ MEDIA SERIAL NUMBER command
Send a SCSI READ MEDIA SERIAL NUMBER command to \fIDEVICE\fR and outputs
the response.
.PP
-This command is described in SPC\-3 found at www.t10.org . It was
-originally added to SPC\-3 in revision 11 (2003/2/12). It is not an
-mandatory command and the author has not seen any SCSI devices
-that support it.
+This command is described in SPC\-3 found at www.t10.org . It was originally
+added to SPC\-3 in revision 11 (2003/2/12). It is not an mandatory command
+and the author has not seen any SCSI devices that support it.
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
.TP
@@ -39,7 +38,7 @@ response and its VPD pages (see sg_vpd). The relevant VPD pages are
the "device identification page" (VPD page 0x83) and the "unit serial
number" page (VPD page 0x80).
.PP
-The MMC\-4 command set for CDs and DVDs has a "media serial number"
+The MMC\-4 command set for CD/DVD/HD-DVD/BD drives has a "media serial number"
feature (0x109) [and a "logical unit serial number" feature]. These
can be viewed with sg_get_config.
.SH EXIT STATUS
@@ -50,7 +49,7 @@ Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2005\-2007 Douglas Gilbert
+Copyright \(co 2005\-2008 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/doc/sgm_dd.8 b/doc/sgm_dd.8
index 6e895891..2f21df7f 100644
--- a/doc/sgm_dd.8
+++ b/doc/sgm_dd.8
@@ -1,4 +1,4 @@
-.TH SGM_DD "8" "July 2007" "sg3_utils\-1.25" SG3_UTILS
+.TH SGM_DD "8" "April 2008" "sg3_utils\-1.26" SG3_UTILS
.SH NAME
sgm_dd \- copies data to and from files and devices. Specialized for
devices that understand the SCSI command set and does memory mapped
@@ -245,10 +245,10 @@ All informative, warning and error output is sent to stderr so that
dd's output file can be stdout and remain unpolluted. If no options
are given, then the usage message is output and nothing else happens.
.PP
-For sg devices this utility issues SCSI READ and WRITE (SBC) commands
-which are appropriate for disks and reading from CD/DVD drives. Those
-commands are not formatted correctly for tape devices so sgm_dd should
-not be used on tape devices.
+For sg devices this utility issues SCSI READ and WRITE (SBC) commands which
+are appropriate for disks and reading from CD/DVD/BD drives. Those commands
+are not formatted correctly for tape devices so sgm_dd should not be used
+on tape devices.
.PP
This utility stops the copy if any error is encountered. For more
advanced "copy on error" logic see the
@@ -275,7 +275,7 @@ Written by Doug Gilbert and Peter Allworth.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2000\-2007 Douglas Gilbert
+Copyright \(co 2000\-2008 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/lib/sg_cmds_basic.c b/lib/sg_cmds_basic.c
index 8dd10c08..2ba70f06 100644
--- a/lib/sg_cmds_basic.c
+++ b/lib/sg_cmds_basic.c
@@ -1146,9 +1146,8 @@ sg_ll_request_sense(int sg_fd, int desc, void * resp, int mx_resp_len,
rsCmdBlk[1] |= 0x1;
if (NULL == sg_warnings_strm)
sg_warnings_strm = stderr;
- if (mx_resp_len > 0xfc) {
- fprintf(sg_warnings_strm, "SPC-3 says request sense allocation "
- "length should be <= 252\n");
+ if (mx_resp_len > 0xff) {
+ fprintf(sg_warnings_strm, "mx_resp_len cannot exceed 255\n");
return -1;
}
rsCmdBlk[4] = mx_resp_len & 0xff;
diff --git a/scripts/scsi_satl b/scripts/scsi_satl
index 0fe829fc..2bbdf195 100755
--- a/scripts/scsi_satl
+++ b/scripts/scsi_satl
@@ -2,7 +2,7 @@
# scsi_satl
#
# Script to test compliance of SCSI commands on a SCSI to ATA
-# Transaltion (SAT) Layer (SATL). This scripts was compiled using
+# Translation (SAT) Layer (SATL). This script was compiled using
# sat-r09.pdf found at www.t10.org .
# The vintage is SPC-3 and SPC-4 (see www.t10.org).
#
@@ -24,7 +24,7 @@
# This script uses utilities from sg3_utils package (version
# 1.22 or later) and sdparm (version 0.99 or later)
#
-# Douglas Gilbert 20070317
+# Douglas Gilbert 20080328
quiet=0
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 4b4aace3..43e4394e 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,8 +79,8 @@ fi
%{_libdir}/*.la
%changelog
-* Thu Mar 27 2008 - dgilbert at interlog dot com
-- sg_get_config sync with mmc6r01, add sg_sat_phy_event
+* Fri Apr 04 2008 - dgilbert at interlog dot com
+- add sg_sat_phy_event, sync with drafts prior to this date
* sg3_utils-1.26
* Tue Oct 16 2007 - dgilbert at interlog dot com
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 65f547e1..2aafc5a1 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -66,7 +66,7 @@
* information [MAINTENANCE IN, service action = 0xc]; see sg_opcodes.
*/
-static char * version_str = "0.75 20080313"; /* spc-4 rev 13 */
+static char * version_str = "0.76 20080404"; /* spc-4 rev 14 */
#define VPD_SUPPORTED_VPDS 0x0
@@ -1263,6 +1263,7 @@ decode_x_inq_vpd(unsigned char * buff, int len, int do_hex)
printf(" WU_SUP=%d CRD_SUP=%d NV_SUP=%d V_SUP=%d LUICLR=%d\n",
!!(buff[6] & 0x8), !!(buff[6] & 0x4), !!(buff[6] & 0x2),
!!(buff[6] & 0x1), !!(buff[7] & 0x1));
+ printf(" Multi I_T nexus microcode download=%d\n", buff[9] & 0xf);
}
static void
diff --git a/src/sg_inq_data.c b/src/sg_inq_data.c
index 6e17c048..1c4fc3df 100644
--- a/src/sg_inq_data.c
+++ b/src/sg_inq_data.c
@@ -53,7 +53,7 @@ struct sg_version_descriptor {
const char * name;
};
-/* table from SPC-4 revision 13 [sorted numerically (from Annex D.8)] */
+/* table from SPC-4 revision 14 [sorted numerically (from Annex D.8)] */
struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x0, "Version Descriptor not supported or No standard identified"},
{0x20, "SAM (no version claimed)"},
diff --git a/src/sg_requests.c b/src/sg_requests.c
index ba42f2b6..5207d73a 100644
--- a/src/sg_requests.c
+++ b/src/sg_requests.c
@@ -47,9 +47,10 @@
* This program issues the SCSI command REQUEST SENSE to the given SCSI device.
*/
-static char * version_str = "1.19 20080325";
+static char * version_str = "1.20 20080404";
-#define REQUEST_SENSE_BUFF_LEN 252
+#define MAX_REQS_RESP_LEN 255
+#define DEF_REQS_RESP_LEN 252
/* Not all environments support the Unix sleep() */
#if defined(MSC_VER) || defined(__MINGW32__)
@@ -66,45 +67,51 @@ static char * version_str = "1.19 20080325";
static struct option long_options[] = {
- {"desc", 0, 0, 'd'},
- {"help", 0, 0, 'h'},
- {"hex", 0, 0, 'H'},
- {"num", 1, 0, 'n'},
- {"progress", 0, 0, 'p'},
- {"raw", 0, 0, 'r'},
- {"status", 0, 0, 's'},
- {"time", 0, 0, 't'},
- {"verbose", 0, 0, 'v'},
- {"version", 0, 0, 'V'},
+ {"desc", no_argument, 0, 'd'},
+ {"help", no_argument, 0, 'h'},
+ {"hex", no_argument, 0, 'H'},
+ {"maxlen", required_argument, 0, 'm'},
+ {"num", required_argument, 0, 'n'},
+ {"progress", no_argument, 0, 'p'},
+ {"raw", no_argument, 0, 'r'},
+ {"status", no_argument, 0, 's'},
+ {"time", no_argument, 0, 't'},
+ {"verbose", no_argument, 0, 'v'},
+ {"version", no_argument, 0, 'V'},
{0, 0, 0, 0},
};
-static void usage()
+static void
+usage()
{
fprintf(stderr, "Usage: "
- "sg_requests [--desc] [--help] [--hex] [--num=NUM] [--progress] "
- "[--raw]\n"
- " [--status] [--time] [--verbose] [--version] "
- "DEVICE\n"
- " where:\n"
- " --desc|-d set flag for descriptor sense "
- "format\n"
- " --help|-h print out usage message\n"
- " --hex|-H output in hexadecimal\n"
- " --num=NUM|-n NUM number of REQUEST SENSE commands "
- "to send (def: 1)\n"
- " --progress|-p output a progress indication (percentage) "
- "if available\n"
- " --raw|-r output in binary (to stdout)\n"
- " --status|-s set exit status from parameter data "
- "(def: only set\n"
- " exit status from autosense)\n"
- " --time|-t time the transfer, calculate commands "
- "per second\n"
- " --verbose|-v increase verbosity\n"
- " --version|-V print version string and exit\n\n"
- "Performs a SCSI REQUEST SENSE command\n"
- );
+ "sg_requests [--desc] [--help] [--hex] [--maxlen=LEN] "
+ "[--num=NUM]\n"
+ " [--progress] [--raw] [--status] [--time] "
+ "[--verbose]\n"
+ " [--version] DEVICE\n"
+ " where:\n"
+ " --desc|-d set flag for descriptor sense "
+ "format\n"
+ " --help|-h print out usage message\n"
+ " --hex|-H output in hexadecimal\n"
+ " --maxlen=LEN|-m LEN max response length (allocation "
+ "length in cdb)\n"
+ " (def: 0 -> 252 bytes)\n"
+ " --num=NUM|-n NUM number of REQUEST SENSE commands "
+ "to send (def: 1)\n"
+ " --progress|-p output a progress indication (percentage) "
+ "if available\n"
+ " --raw|-r output in binary (to stdout)\n"
+ " --status|-s set exit status from parameter data "
+ "(def: only set\n"
+ " exit status from autosense)\n"
+ " --time|-t time the transfer, calculate commands "
+ "per second\n"
+ " --verbose|-v increase verbosity\n"
+ " --version|-V print version string and exit\n\n"
+ "Performs a SCSI REQUEST SENSE command\n"
+ );
}
@@ -119,10 +126,11 @@ static void dStrRaw(const char* str, int len)
int main(int argc, char * argv[])
{
int sg_fd, res, c, resp_len, k, progress;
- unsigned char requestSenseBuff[REQUEST_SENSE_BUFF_LEN];
+ unsigned char requestSenseBuff[MAX_REQS_RESP_LEN + 1];
int desc = 0;
int num_rs = 1;
int do_hex = 0;
+ int maxlen = 0;
int do_progress = 0;
int do_raw = 0;
int do_status = 0;
@@ -137,7 +145,7 @@ int main(int argc, char * argv[])
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "dhHn:prstvV", long_options,
+ c = getopt_long(argc, argv, "dhHm:n:prstvV", long_options,
&option_index);
if (c == -1)
break;
@@ -153,6 +161,14 @@ int main(int argc, char * argv[])
case 'H':
++do_hex;
break;
+ case 'm':
+ maxlen = sg_get_num(optarg);
+ if ((maxlen < 0) || (maxlen > MAX_REQS_RESP_LEN)) {
+ fprintf(stderr, "argument to '--maxlen' should be %d or "
+ "less\n", MAX_REQS_RESP_LEN);
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ break;
case 'n':
num_rs = sg_get_num(optarg);
if (num_rs < 1) {
@@ -198,6 +214,8 @@ int main(int argc, char * argv[])
}
}
+ if (0 == maxlen)
+ maxlen = DEF_REQS_RESP_LEN;
if (NULL == device_name) {
fprintf(stderr, "missing device name!\n");
usage();
@@ -214,8 +232,8 @@ int main(int argc, char * argv[])
if (k > 0)
sleep_for(30);
memset(requestSenseBuff, 0x0, sizeof(requestSenseBuff));
- res = sg_ll_request_sense(sg_fd, desc, requestSenseBuff,
- sizeof(requestSenseBuff), 1, verbose);
+ res = sg_ll_request_sense(sg_fd, desc, requestSenseBuff, maxlen,
+ 1, verbose);
if (res) {
ret = res;
if (SG_LIB_CAT_INVALID_OP == res)
@@ -278,8 +296,8 @@ int main(int argc, char * argv[])
requestSenseBuff[7] = '\0';
for (k = 0; k < num_rs; ++k) {
memset(requestSenseBuff, 0x0, sizeof(requestSenseBuff));
- res = sg_ll_request_sense(sg_fd, desc, requestSenseBuff,
- sizeof(requestSenseBuff), 1, verbose);
+ res = sg_ll_request_sense(sg_fd, desc, requestSenseBuff, maxlen,
+ 1, verbose);
ret = res;
if (0 == res) {
resp_len = requestSenseBuff[7] + 8;
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index e2c0dff3..cff7c765 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -52,7 +52,7 @@
*/
-static char * version_str = "0.28 20080313"; /* spc4r13 */
+static char * version_str = "0.29 20080404"; /* spc4r14 */
extern void svpd_enumerate_vendor(void);
extern int svpd_decode_vendor(int sg_fd, int num_vpd, int subvalue,
@@ -1066,6 +1066,7 @@ decode_x_inq_vpd(unsigned char * buff, int len, int do_hex)
printf(" WU_SUP=%d CRD_SUP=%d NV_SUP=%d V_SUP=%d LUICLR=%d\n",
!!(buff[6] & 0x8), !!(buff[6] & 0x4), !!(buff[6] & 0x2),
!!(buff[6] & 0x1), !!(buff[7] & 0x1));
+ printf(" Multi I_T nexus microcode download=%d\n", buff[9] & 0xf);
}
static void
@@ -2111,8 +2112,8 @@ main(int argc, char * argv[])
++do_long;
break;
case 'm':
- maxlen = sg_get_num(optarg);
- if ((maxlen < 0) || (maxlen > MX_ALLOC_LEN)) {
+ maxlen = sg_get_num(optarg);
+ if ((maxlen < 0) || (maxlen > MX_ALLOC_LEN)) {
fprintf(stderr, "argument to '--maxlen' should be %d or "
"less\n", MX_ALLOC_LEN);
return SG_LIB_SYNTAX_ERROR;