aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2011-12-17 02:11:10 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2011-12-17 02:11:10 +0000
commit1cca59e0e62233106cd8558635fe3fc5ef2275e5 (patch)
tree7cf0db5a7d3cfcbd5f0fe8f374cdfa5f858d8cfe
parentae54f59eb8b9f2cc37046a111aadc4828c4a630c (diff)
downloadsg3_utils-1cca59e0e62233106cd8558635fe3fc5ef2275e5.tar.gz
sg_ses: cleanups + output primary enc log id; manpages + spelling
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@431 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog2
-rw-r--r--README10
-rw-r--r--README.freebsd4
-rw-r--r--README.iscsi2
-rw-r--r--README.sg_start2
-rw-r--r--README.solaris6
-rw-r--r--README.tru642
-rw-r--r--README.win328
-rw-r--r--doc/scsi_logging_level.82
-rw-r--r--doc/scsi_mandat.82
-rw-r--r--doc/scsi_readcap.82
-rw-r--r--doc/scsi_ready.82
-rw-r--r--doc/scsi_satl.82
-rw-r--r--doc/scsi_start.82
-rw-r--r--doc/scsi_stop.82
-rw-r--r--doc/scsi_temperature.82
-rw-r--r--doc/sg3_utils.82
-rw-r--r--doc/sg_logs.82
-rw-r--r--doc/sg_senddiag.84
-rw-r--r--doc/sg_ses.8221
-rw-r--r--doc/sg_vpd.88
-rw-r--r--doc/sg_write_same.86
-rw-r--r--scripts/README2
-rw-r--r--src/sg_ses.c113
24 files changed, 240 insertions, 170 deletions
diff --git a/ChangeLog b/ChangeLog
index 08899ab2..30458f3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ 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.33 [20111211] [svn: r430]
+Changelog for sg3_utils-1.33 [20111216] [svn: r431]
- win: change DataBufferOffset type per MSDN; caused
problem with 64 bit machines (buffered interface)
- sg_inq, sg_vpd: sync with spc4r33
diff --git a/README b/README
index 7fc3626b..8493fd41 100644
--- a/README
+++ b/README
@@ -20,7 +20,7 @@ For example the sg_inq utility issues a SCSI INQUIRY command and decodes the
response. The COVERAGE file has a table containing a row for each SCSI
command issued by this package; to the right of each row is the utility
(sometimes more than one) that issue that SCSI command. The COVERAGE file
-has a second table for ATA commands issude.
+has a second table for ATA commands usage.
Some utilities interface at a slightly higher level, for example: sg_dd,
sgm_dd and sgp_dd. These are closely related to the Unix dd command and
@@ -59,7 +59,7 @@ series.
In sg3_utils version 1.27 support has been added for the Linux bsg driver
which use the sg version 4 interface. There seems no point in renaming
this package sg4_utils. The existing utilities just silently support either.
-Cuurently the source build must be able to see the /usr/include/linux/bsg.h
+Currently the source build must be able to see the /usr/include/linux/bsg.h
file. Then at run time the /proc/devices pseudo file needs to have an entry
for the bsg driver (appeared around lk 2.6.28). With this in place each
utility at run time checks the device it has been given and if it is a char
@@ -124,7 +124,7 @@ scsi tape driver (st) in lk 2.6.6 .
In the src directory the bulk of the utilities are written in relatively
clean POSIX compliant C code with Linux specific system calls and structures
-removed and placed in linux specific files in the lib directory. A small
+removed and placed in Linux specific files in the lib directory. A small
number of utilities in the src directory do contain Linux specific logic
and are not ported to other OSes (e.g. sg_dd). One utility, sg_scan, has
two separate implementations, one for Linux (sg_scan.c.linux) and one for
@@ -163,7 +163,7 @@ calls over OS specific calls.
In Linux there are package build files for "rpm" based and for "deb" based
systems. The 'sg3_utils.spec' file in the main directory can be used like
this: 'rpmbuild -ba sg3_utils.spec' in a rpmbuild tree SPECS directory.
-To cross build or make a more widely distibutable package then the --target
+To cross build or make a more widely distributable package then the --target
option may be useful: 'rpmbuild --target=i386 -ba sg3_utils.spec' .
The 'build_debian.sh' script should build several "deb" packages and place
@@ -255,7 +255,7 @@ checks it against the asc/ascq text strings held in sg_lib_data.c .
The 'doc' subdirectory contains a README file containing the urls of
various related documents.
-The 'scripts' subdirectory contains some bourne (bash) shell scripts that
+The 'scripts' subdirectory contains some Bourne (bash) shell scripts that
rely on utilities in the main directory. One script uses the sdparm utility.
These scripts are described in the scripts/README file and have usage
messages.
diff --git a/README.freebsd b/README.freebsd
index f20c4b36..197f25a3 100644
--- a/README.freebsd
+++ b/README.freebsd
@@ -6,7 +6,7 @@ similar functionality; for example 'sg_map' is similar to
'camcontrol devlist'.
The dd variants from the sg3_utils package (e.g. sg_dd) rely on too many
-Linux idiosyncracies to be easily ported. A new package called 'ddpt'
+Linux idiosyncrasies to be easily ported. A new package called 'ddpt'
contains a utility with similar functionality to sg_dd and ddpt is available
for FreeBSD.
@@ -70,7 +70,7 @@ the tarball and installed with the familiar
running the "./autogen.sh" script prior to that sequence. There
are generic instruction on configure and friend in the INSTALL file.
-Some man pages have examples which use linux device names which
+Some man pages have examples which use Linux device names which
hopefully will not confuse the FreeBSD users.
Device naming
diff --git a/README.iscsi b/README.iscsi
index 9ce255cb..917190a2 100644
--- a/README.iscsi
+++ b/README.iscsi
@@ -1,7 +1,7 @@
iSCSI support for sg3-utils is available from external patches.
To build sg3-utils from sources and activate built-in iSCSI support
-you need both sg3-utils and the external userspace iSCSI library hosted at :
+you need both sg3-utils and the external user-space iSCSI library hosted at :
https://github.com/sahlberg/libiscsi
diff --git a/README.sg_start b/README.sg_start
index 97441fa5..cd232818 100644
--- a/README.sg_start
+++ b/README.sg_start
@@ -4,7 +4,7 @@ you can use sg_start to start (spin-up, 1) and stop (spin-down, 0) devices.
I also offers a parameter (-s) to send a synchronize cache command to a
device, so it should write back its internal buffers to the medium.
-Be aware that the Linux SCSI subsystem at this time does not autmatically
+Be aware that the Linux SCSI subsystem at this time does not automatically
starts stopped devices, so stopping a device which is in use may have fatal
results for you.
diff --git a/README.solaris b/README.solaris
index 7d92f1b8..b48a6541 100644
--- a/README.solaris
+++ b/README.solaris
@@ -4,7 +4,7 @@ The Solaris port of sg3_utils contains those utilities that are
_not_ specific to Linux.
The dd variants from the sg3_utils package (e.g. sg_dd) rely on too many
-Linux idiosyncracies to be easily ported. A new package called 'ddpt'
+Linux idiosyncrasies to be easily ported. A new package called 'ddpt'
contains a utility with similar functionality to sg_dd and is available
for Solaris.
@@ -68,7 +68,7 @@ the tarball and installed with the familiar
running the "./autogen.sh" script prior to that sequence. There
are generic instruction on configure and friend in the INSTALL file.
-Some man pages have examples which use linux device names which
+Some man pages have examples which use Linux device names which
hopefully will not confuse the Solaris users.
Device naming
@@ -90,7 +90,7 @@ disk. So a whole disk may be referred to as either:
And these device names are duplicated in the /dev/dsk and /dev/rdsk
directories. The former is the block device name and the latter
is for "raw" (or char device) access which is what sg3_utils needs.
-So in openSolaris something of the form:
+So in OpenSolaris something of the form:
sg_inq /dev/rdsk/c5t4d3p0
should work. If it doesn't add a '-vvv' option. If that is attempted
on the /dev/dsk/c5t4d3p0 variant an inappropriate ioctl for device
diff --git a/README.tru64 b/README.tru64
index 1537d6db..079de15f 100644
--- a/README.tru64
+++ b/README.tru64
@@ -63,7 +63,7 @@ This package uses autotools infrastructure with the now common
from the source found in the tarball. If the "./configure" sequence
fails try using the ./autogen.sh prior to that sequence.
-Some man pages have examples which use linux device names which hopefully
+Some man pages have examples which use Linux device names which hopefully
will not confuse Tru64 users.
diff --git a/README.win32 b/README.win32
index 1b8b372d..3468bd00 100644
--- a/README.win32
+++ b/README.win32
@@ -5,11 +5,11 @@ to Linux. One utility for listing available devices, sg_scan, has a
Windows-specific version for this port.
The dd variants from the sg3_utils package (e.g. sg_dd) rely on too many
-Linux idiosyncracies to be easily ported. A new package called 'ddpt'
+Linux idiosyncrasies to be easily ported. A new package called 'ddpt'
contains a utility with similar functionality to sg_dd and is available
for Windows.
-Two build environments are caterered for: cygwin (see www.cygwin.com) and
+Two build environments are catered for: cygwin (see www.cygwin.com) and
MinGW ("Minimalist GNU for Windows", see www.mingw.org). Both are based in
the gcc compiler (although other C compilers should have little problem with
the source code). Cygwin is a more sophisticated, commercial product that
@@ -75,7 +75,7 @@ file. An overview of sg3_utils can be found at:
http://sg.danny.cz/sg/sg3_utils.html .
A copy of the "sg3_utils.html" file is in the "doc" subdirectory.
-Some man pages have examples which use linux device names which hopefully
+Some man pages have examples which use Linux device names which hopefully
will not confuse Windows users.
Two pass-through variants
@@ -105,7 +105,7 @@ rather than:
./configure
prior to the 'make' call.
-In sg3_utils version 1.31 runtime selection of the direct or indirect
+In sg3_utils version 1.31 run-time selection of the direct or indirect
interface was added with the scsi_pt_win32_direct(int state_direct)
function declared in sg_pt.h. The default is indirect unless
'./configure --enable-win32-spt-direct' was used in the build. If
diff --git a/doc/scsi_logging_level.8 b/doc/scsi_logging_level.8
index ecaa5bed..0a3a6fe6 100644
--- a/doc/scsi_logging_level.8
+++ b/doc/scsi_logging_level.8
@@ -12,7 +12,7 @@ scsi_logging_level \- access Linux SCSI logging level information
.SH DESCRIPTION
.\" Add any additional description here
.PP
-This bourne shell script accesses the Linux SCSI subsystem logging
+This Bourne shell script accesses the Linux SCSI subsystem logging
level. The current values can be shown (e.g. with \fI\-\-get\fR)
or changed (e.g. with \fI\-\-set\fR). Superuser permissions will
typically be required to set the logging level.
diff --git a/doc/scsi_mandat.8 b/doc/scsi_mandat.8
index 75b4edb3..70469f6a 100644
--- a/doc/scsi_mandat.8
+++ b/doc/scsi_mandat.8
@@ -8,7 +8,7 @@ scsi_mandat \- check SCSI device support for mandatory commands
.SH DESCRIPTION
.\" Add any additional description here
.PP
-This bourne shell script calls several SCSI commands on the given
+This Bourne shell script calls several SCSI commands on the given
\fIDEVICE\fR. These SCSI commands are considered mandatory (although
that varies a little depending on which standard/draft the \fIDEVICE\fR
complies with). The results of each test and a pass/fail count are
diff --git a/doc/scsi_readcap.8 b/doc/scsi_readcap.8
index 4656bceb..0e7dd3fb 100644
--- a/doc/scsi_readcap.8
+++ b/doc/scsi_readcap.8
@@ -8,7 +8,7 @@ scsi_readcap \- do SCSI READ CAPACITY command on disks
.SH DESCRIPTION
.\" Add any additional description here
.PP
-This bourne shell script calls the sg_readcap utility on each given
+This Bourne shell script calls the sg_readcap utility on each given
\fIDEVICE\fR. This will send a SCSI READ CAPACITY command to each
\fIDEVICE\fR.
.PP
diff --git a/doc/scsi_ready.8 b/doc/scsi_ready.8
index fd3e6b32..21eb7ca7 100644
--- a/doc/scsi_ready.8
+++ b/doc/scsi_ready.8
@@ -8,7 +8,7 @@ scsi_ready \- do SCSI TEST UNIT READY on devices
.SH DESCRIPTION
.\" Add any additional description here
.PP
-This bourne shell script calls the sg_turs utility on each given
+This Bourne shell script calls the sg_turs utility on each given
\fIDEVICE\fR. This will send a SCSI TEST UNIT READY command to each
\fIDEVICE\fR. Disks, tape drives and DVD/BD players amongst others
may respond to this SCSI command.
diff --git a/doc/scsi_satl.8 b/doc/scsi_satl.8
index 919c828e..57cd7f66 100644
--- a/doc/scsi_satl.8
+++ b/doc/scsi_satl.8
@@ -8,7 +8,7 @@ scsi_satl \- check SCSI to ATA Translation (SAT) device support
.SH DESCRIPTION
.\" Add any additional description here
.PP
-This bourne shell script calls several SCSI commands on the given
+This Bourne shell script calls several SCSI commands on the given
\fIDEVICE\fR that is assumed to be an ATA device behind a SCSI
to ATA Translation (SAT) layer (SATL). The results of each test
and a pass/fail count are output.
diff --git a/doc/scsi_start.8 b/doc/scsi_start.8
index 20adbb4c..694d4bb6 100644
--- a/doc/scsi_start.8
+++ b/doc/scsi_start.8
@@ -8,7 +8,7 @@ scsi_start \- start one or more SCSI disks
.SH DESCRIPTION
.\" Add any additional description here
.PP
-This bourne shell script calls the sg_start utility on each given
+This Bourne shell script calls the sg_start utility on each given
\fIDEVICE\fR. The purpose is to spin up (start) each given \fIDEVICE\fR.
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
diff --git a/doc/scsi_stop.8 b/doc/scsi_stop.8
index ae773508..63741941 100644
--- a/doc/scsi_stop.8
+++ b/doc/scsi_stop.8
@@ -8,7 +8,7 @@ scsi_stop \- stop (spin down) one or more SCSI disks
.SH DESCRIPTION
.\" Add any additional description here
.PP
-This bourne shell script calls the sg_start utility on each given
+This Bourne shell script calls the sg_start utility on each given
\fIDEVICE\fR. The purpose is to spin down (stop) each given \fIDEVICE\fR.
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
diff --git a/doc/scsi_temperature.8 b/doc/scsi_temperature.8
index ad0c94c3..30b1dddf 100644
--- a/doc/scsi_temperature.8
+++ b/doc/scsi_temperature.8
@@ -8,7 +8,7 @@ scsi_temperature \- fetch the temperature of a SCSI device
.SH DESCRIPTION
.\" Add any additional description here
.PP
-This bourne shell script calls the sg_logs utility on each given
+This Bourne shell script calls the sg_logs utility on each given
\fIDEVICE\fR in order to find the device's temperature. The Temperature
log page is checked first and if it is not available then the Informational
Exceptions log page is checked.
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index 0c979f1a..5b01a300 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -366,7 +366,7 @@ trailing "h" or "H" as found in (storage) standards. When hex numbers are
given, multipliers cannot be used. For example the decimal value "256" can
be given as "0x100" or "100h".
.SH SCRIPTS, EXAMPLES and UTILS
-There are several bourne shell scripts in the 'scripts' subdirectory that
+There are several Bourne shell scripts in the 'scripts' subdirectory that
invoke compiled utilities (e.g. sg_readcap). The scripts start with 'scsi_'
rather than 'sg_'. One purpose of these scripts is to call the same
utility (e.g. sg_readcap) on multiple disks. Most of the basic compiled
diff --git a/doc/sg_logs.8 b/doc/sg_logs.8
index fbcca99e..551acf30 100644
--- a/doc/sg_logs.8
+++ b/doc/sg_logs.8
@@ -30,7 +30,7 @@ LOG SELECT command. At the same time a page code field was introduced to the
to the LOG SELECT command. The log subpage code can range from 0 to 255 (0xff)
inclusive. The subpage code value 255 can be thought of as a wildcard.
.PP
-This utility supports two command line syntaxes, the preferred one is shown
+This utility supports two command line surtaxes, the preferred one is shown
first in the synopsis and explained in this section. A later section on the
old command line syntax outlines the second group of options.
.SH OPTIONS
diff --git a/doc/sg_senddiag.8 b/doc/sg_senddiag.8
index 3abf279a..e81dd5c6 100644
--- a/doc/sg_senddiag.8
+++ b/doc/sg_senddiag.8
@@ -26,7 +26,7 @@ the page numbers of supported diagnostic pages).
When the \fI\-\-list\fR option is given without a \fIDEVICE\fR then a list of
diagnostic page names and their numbers, known by this utility, are listed.
.PP
-This utility supports two command line syntaxes, the preferred one is
+This utility supports two command line syntax\-es, the preferred one is
shown first in the synopsis and explained in this section. A later section
on the old command line syntax outlines the second group of options.
.SH OPTIONS
@@ -235,7 +235,7 @@ print out version string then exit.
\fB\-?\fR
output usage message. Ignore all other parameters.
.SH EXAMPLES
-The examples subdirectory in the sg3_utils packages contains two example
+The examples sub\-directory in the sg3_utils packages contains two example
scripts that turn on the CJTPAT (jitter pattern) on some SAS disks (one
script for each phy). One possible invocation for phy 1 is:
.PP
diff --git a/doc/sg_ses.8 b/doc/sg_ses.8
index e3f1e7ed..cca5a36e 100644
--- a/doc/sg_ses.8
+++ b/doc/sg_ses.8
@@ -1,6 +1,6 @@
.TH SG_SES "8" "December 2011" "sg3_utils\-1.33" SG3_UTILS
.SH NAME
-sg_ses \- fetch status from a SCSI Enclosure Services (SES) device
+sg_ses \- access a SCSI Enclosure Services (SES) device
.SH SYNOPSIS
.B sg_ses
[\fI\-\-byte1=B1\fR] [\fI\-\-clear=STR\fR] [\fI\-\-control\fR]
@@ -13,16 +13,16 @@ sg_ses \- fetch status from a SCSI Enclosure Services (SES) device
.SH DESCRIPTION
.\" Add any additional description here
.PP
-Fetches status from a SCSI Enclosure Service (SES) device (via a SCSI RECEIVE
-DIAGNOSTIC RESULTS command). This utility can also send controls to a SES
-device (via a SCSI SEND DIAGNOSTIC command). The \fIDEVICE\fR should be a SES
-device which may be a dedicated enclosure services processor (INQUIRY
-peripheral device type 0xd) or attached to another type of SCSI device (e.g.
-a disk) in which case the EncServ bit is set in its INQUIRY response.
+Fetches management information from a SCSI Enclosure Service (SES) device.
+This utility can also modify the state of a SES device. The \fIDEVICE\fR
+should be a SES device which may be a dedicated enclosure services
+processor (INQUIRY response's Peripheral Device Type is 13 [0xd]) or
+attached to another type of SCSI device (e.g. a disk) in which case the
+EncServ bit is set in its INQUIRY response.
.PP
-If no options are given (only the \fIDEVICE\fR argument) then all diagnostic
-pages supported by the device are listed. Most, but not necessarily all, of
-the listed diagnostic pages are defined in the SES standards and drafts.
+If no options are given (only the \fIDEVICE\fR argument) then the names of
+all diagnostic pages supported are listed. Most, but not necessarily all, of
+the named diagnostic pages are defined in the SES standards and drafts.
.PP
Changing the state of an enclosure (e.g. requesting the "ident" (locate) LED
to flash on a disk carrier in an array) is typically done using a
@@ -33,81 +33,84 @@ Services 3 document T10/2149\-D Revision 3 at http://www.t10.org . Existing
standards for SES and SES\-2 are ANSI INCITS 305\-1998 and ANSI INCITS
448\-2008 respectively.
.PP
-A tutorial on SES can be found here:
+There is a web page discussing this utility at
+http://sg.danny.cz/sg/sg_ses.html . A tutorial on SES can be found here:
http://www.snia.org/events/storage\-developer2008/presentations/monday/RajendraDivecha_SCSI_SES.pdf .
-It contains both an overview and in depth information suitable for decoding
-the contents of some diagnostic pages used by SES.
+.PP
+In the following sections "page" refers to a diagnostic page, either
+fetched with a SCSI RECEIVE DIAGNOSTIC RESULTS command or sent to the
+\fIDEVICE\fR with a SCSI SEND DIAGNOSTIC command.
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
The options are arranged in alphabetical order based on the long
option name.
.TP
\fB\-b\fR, \fB\-\-byte1\fR=\fIB1\fR
-some control pages need byte 1 (i.e. the second byte) set. In the enclosure
-control diagnostic page byte 1 contains the INFO, NON\-CRIT, CRIT and UNRECOV
+some control pages need byte 1 (i.e. the second byte) set. In the Enclosure
+Control page, byte 1 contains the INFO, NON\-CRIT, CRIT and UNRECOV
bits. If \fI\-\-control\fR and \fI\-\-data=H,H...\fR options are used then
the default value is 0. If the \fI\-\-clear=STR\fR, \fI\-\-get=STR\fR or
\fI\-\-set=STR\fR option is used the default value is what was in byte 1
-when the status page was read. \fIB1\fR is in decimal unless it is prefixed
-by '0x' or '0X' (or has a trailing 'h' or 'H').
+when the corresponding status page was read. \fIB1\fR is in decimal unless
+it is prefixed by '0x' or '0X' (or has a trailing 'h' or 'H').
.TP
\fB\-c\fR, \fB\-\-control\fR
will send control information to the \fIDEVICE\fR via a SCSI SEND
DIAGNOSTIC command. Cannot give both this option and \fI\-\-status\fR.
-The Enclosure control, String Out, Threshold Out, Array control (obsolete
-in SES\-2) and Subenclosure String Out diagnostic pages can be set currently.
-Not needed with the \fI\-\-clear=STR\fR and \fI\-\-set=STR\fR options.
+The Enclosure Control, String Out, Threshold Out, Array Control (obsolete
+in SES\-2) and Subenclosure String Out pages can be set currently. This
+option is assumed if either the \fI\-\-clear=STR\fR or \fI\-\-set=STR\fR
+option is given.
.TP
\fB\-C\fR, \fB\-\-clear\fR=\fISTR\fR
Used to clear a field in a control element. Must be used together with
a \fI\-\-descriptor=DN\fR or \fI\-\-index=...\fR option to specify which
-element is to be changed. By default the enclosure control page is modified,
-the only other page that can be modified is the threshold out page. See the
+element is to be changed. By default the Enclosure Control page is modified,
+the only other page that can be modified is the Threshold Out page. See the
STR FORMAT section below.
.TP
\fB\-d\fR, \fB\-\-data\fR=\fIH,H...\fR
permits a string of comma separated (ASCII) hex bytes to be specified (limit
1024). A (single) space separated string of hex bytes is also allowed but
-the list needs to be in quotes. This allows the parameters to a control
-diagnostic page to be specified. The string given should not include the
-first 4 bytes (i.e. page code and length). See next entry for using stdin.
+the list needs to be in quotes. This option allows the parameters to a
+control page to be specified. The string given should not include the first 4
+bytes (i.e. page code and length).
.TP
\fB\-d\fR, \fB\-\-data\fR=\-
reads a data string from stdin, limit 1024 bytes. Spaces, tabs and line feeds
additionally are permitted as separators.
.TP
\fB\-D\fR, \fB\-\-descriptor\fR=\fIDN\fR
-where \fIDN\fR is a descriptor name (string) as found in the element
-descriptor diagnostic page (i.e. page 7). If that page is supported then
-\fIDN\fR may be alternative for \fITIA,II\fR (in the \fI\-\-index=TIA,II\fR
-option). If the descriptor name contains a space then \fIDN\fR needs to be
-surrounded by quotes (single or double) or the space escaped (e.g. preceded
-by a backslash). Some elements (e.g. overall elements) may not have
-descriptor names. Useful with the \fI\-\-join\fR option as well as the
-\fI\-\-clear=STR\fR, \fI\-\-get=STR\fR and \fI\-\-set=STR\fR options. If
-no other options are given then the \fI\-\-join\fR option is assumed.
+where \fIDN\fR is a descriptor name (string) as found in the Element
+Descriptor page (i.e. page 7). If that page is supported then \fIDN\fR may be
+alternative for \fITIA,II\fR (in the \fI\-\-index=TIA,II\fR option). If the
+descriptor name contains a space then \fIDN\fR needs to be surrounded by
+quotes (single or double) or the space escaped (e.g. preceded by a backslash).
+Some elements (e.g. overall elements) may not have descriptor names. Useful
+with the \fI\-\-join\fR option as well as the \fI\-\-clear=STR\fR,
+\fI\-\-get=STR\fR and \fI\-\-set=STR\fR options. If no other options are
+given then the \fI\-\-join\fR option is assumed.
.TP
\fB\-e\fR, \fB\-\-enumerate\fR
-enumerate all known diagnostic page names and SES elements when this option
-is given once. If \fI\-\-enumerate\fR is given twice, then the recognized
-acronyms for the \fI\-\-clear=STR\fR, \fI\-\-get=STR\fR and \fI\-\-set=STR\fR
-options are listed. The utility exits after listing this information (so most
-other options and \fIDEVICE\fR are ignored).
+enumerate all known page names and SES elements when this option is given
+once. If \fI\-\-enumerate\fR is given twice, then the recognised acronyms for
+the \fI\-\-clear=STR\fR, \fI\-\-get=STR\fR and \fI\-\-set=STR\fR options are
+listed. The utility exits after listing this information (so most other
+options and \fIDEVICE\fR are ignored).
.TP
\fB\-f\fR, \fB\-\-filter\fR
-cuts down on the amount of output from the enclosure status diagnostic
-page and the additional element status page. When this option is given, any
-line which has all its binary flags cleared (i.e. 0) is filtered out (i.e.
-ignored). If a line has some other value on it (e.g. a temperature) then
-it is output.
+cuts down on the amount of output from the Enclosure Status page and the
+Additional Element Status page. When this option is given, any line which
+has all its binary flags cleared (i.e. 0) is filtered out (i.e. ignored).
+If a line has some other value on it (e.g. a temperature) then it is output.
.TP
\fB\-G\fR, \fB\-\-get\fR=\fISTR\fR
Used to read a field in a status element. Must be used together with
a \fI\-\-descriptor=DN\fR or \fI\-\-index=...\fR option to specify which
-element is to be read. By default the enclosure status page is read, the
-only other pages that can be read are the threshold in and additional
-element status pages. If a value is found it is output in decimal to
-stdout (by default) or in hexidecimal prededed by "0x" if the \fI\-\-hex\fR
+element is to be read. By default the Enclosure Status page is read, the
+only other pages that can be read are the Threshold In and Additional
+Element Status pages. If a value is found it is output in decimal to
+stdout (by default) or in hexadecimal preceded by "0x" if the \fI\-\-hex\fR
option is given. See the STR FORMAT section below.
.TP
\fB\-h\fR, \fB\-\-help\fR
@@ -119,10 +122,10 @@ any) in hexadecimal, with a leading "0x". Otherwise output the response
in hexadecimal. Ignored with some options (e.g. \fI\-\-join\fR).
.TP
\fB\-i\fR, \fB\-\-inner\-hex\fR
-the outer levels of a status diagnostic page are decoded and printed out
-but the innermost level (e.g. the element status descriptor) is output in
-hex. Also active with the additional element descriptor and threshold in
-pages. Can be used with \fI\-\-index=...\fR and/or \fI\-\-join\fR options.
+the outer levels of a status page are decoded and printed out but the
+innermost level (e.g. the Element Status Descriptor) is output in hex. Also
+active with the Additional Element Status and Threshold In pages. Can be
+used with \fI\-\-index=...\fR and/or \fI\-\-join\fR options.
.TP
\fB\-I\fR, \fB\-\-index\fR=\fIIIA\fR
where \fIIIA\fR is either an individual index or an element type abbreviation.
@@ -139,38 +142,38 @@ then the \fI\-\-page=2\fR option is assumed. To enumerate the available
element type abbreviations use the \fI\-\-enumerate\fR option.
.TP
\fB\-j\fR, \fB\-\-join\fR
-group elements from the element descriptor, enclosure status and additional
-element status pages. If this option is given twice then elements from
-the threshold in page are also grouped. The order is dictated by the
-configuration page. All elements are output unless the \fI\-\-index=\fR
-option is given, in which case only the matching element is output, or
-no element is output if there is no match. See the INDEXES section below.
+group elements from the Element Descriptor, Enclosure Status and Additional
+Element Status pages. If this option is given twice then elements from the
+Threshold In page are also grouped. The order is dictated by the Configuration
+page. All elements are output unless the \fI\-\-index=\fR option is given, in
+which case only the matching element is output, or no element is output if
+there is no match. See the INDEXES section below.
.TP
\fB\-l\fR, \fB\-\-list\fR
This option is equivalent to \fI\-\-enumerate\fR. See that option.
.TP
\fB\-p\fR, \fB\-\-page\fR=\fIPG\fR
-where \fIPG\fR is a page code. Assumed to be in decimal unless prefixed by
+where \fIPG\fR is a page abbreviation or code (a number). If \fIPG\fR
+starts with a digit it is assumed to be in decimal unless prefixed by
0x for hex. Valid range is 0 to 255 (0x0 to 0xff) inclusive. Default is
-page_code 0 (i.e. "Supported diagnostic pages").
+page 'sdp' which is page_code 0 (i.e. "Supported Diagnostic Pages").
.TP
\fB\-r\fR, \fB\-\-raw\fR
-outputs the chosen status page in (ASCII) hex in a format suitable for
-a later invocation using the \fI\-\-data=\fR option. A status diagnostic
-page less its first 4 bytes (page code and length) is output.
-When used twice (e.g. \fI\-rr\fR) outputs full diagnostic page in binary
-to stdout.
+outputs the chosen status page in (ASCII) hex in a format suitable for a
+later invocation using the \fI\-\-data=\fR option. A status page less its
+first 4 bytes (page code and length) is output. When used twice (e.g.
+\fI\-rr\fR) the full page contents is output in binary to stdout.
.TP
\fB\-s\fR, \fB\-\-status\fR
-will fetch status diagnostic page from the \fIDEVICE\fR via a SCSI RECEIVE
-DIAGNOSTIC RESULTS command. If this option is not given and
-\fI\-\-control\fR is not given then \fI\-\-status\fR is assumed.
+will fetch status page from the \fIDEVICE\fR via a SCSI RECEIVE DIAGNOSTIC
+RESULTS command. If this option is not given and \fI\-\-control\fR is not
+given then \fI\-\-status\fR is assumed.
.TP
\fB\-S\fR, \fB\-\-set\fR=\fISTR\fR
-Used to set a field in a control element. Must be used together with
-a \fI\-\-descriptor=DN\fR or \fI\-\-index=...\fR option to specify which
-element is to be changed. By default the enclosure control page is modified,
-the only other page that can be modified is the threshold out page. See the
+Used to set a field in a control element. Must be used together with a
+\fI\-\-descriptor=DN\fR or \fI\-\-index=...\fR option to specify which
+element is to be changed. By default the Enclosure Control page is modified,
+the only other page that can be modified is the Threshold Out page. See the
STR FORMAT section below.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
@@ -180,12 +183,12 @@ increase the level of verbosity, (i.e. debug output).
print the version string and then exit.
.SH INDEXES
An enclosure can have information about its disk and tape drives plus other
-supporting components like power supplies spread across several diagnostic
-pages. Addressing a specific element (overall or individual) is complicated.
+supporting components like power supplies spread across several pages.
+Addressing a specific element (overall or individual) is complicated.
.PP
The Configuration page is key: it contains a list of "type headers", each
of which contains an element type (e.g. Array Device Slot), a sub\-enclosure
-identifier (0 for the main enclosure) and a "Number of possible elements".
+identifier (0 for the primary enclosure) and a "Number of possible elements".
Corresponding to each type header, the Enclosure Status page has one "overall"
element plus "Number of possible elements" individual elements all of which
have the given element type. For some element types the "Number of possible
@@ -204,12 +207,13 @@ Enclosure Status page.
.PP
Addressing a single overall element or a single individual element is done
with two indexes: TI and II. Both are origin 0. TI=0 corresponds to the
-first type header entry which must be a device slot or array device slot
+first type header entry which must be a Device Slot or Array Device Slot
element type (according to the SES\-2 standard). To address the corresponding
overall instance, II is set to -1, otherwise II can be set to the individual
instance index. As an alternative to the type header index (TI), an element
-type abbreviation (e.g. "ps") optionally followed by a number (e.g. "ps1"
-refers to the second Power Supply element type) can be given.
+type abbreviation (A) optionally followed by a number (e.g. "ps" refers to
+the first Power Supply element type; "ps1" refers to the second) can be
+given.
.PP
One of two command lines variants can be used to specify indexes:
\fI\-\-index=TIA,II\fR where \fITIA\fR is either an type header index (TI)
@@ -227,7 +231,7 @@ For example these are equivalent: \fI\-\-index=arr\fR and
\fI\-\-index=_23\fR since the Array Device Slot element type value is 23.
Also \fI\-\-index=ps1\fR and \fI\-\-index=_2_1\fR are equivalent.
.PP
-For example if the first type header in the Configuration page has Array
+Another example: if the first type header in the Configuration page has Array
Device Slot element type then \fI\-\-index=0,-1\fR is equivalent to
\fI\-\-index=arr\fR. Also \fI\-\-index=arr,3\fR is equivalent to
\fI\-\-index=3\fR.
@@ -244,7 +248,7 @@ The \fISTR\fR arguments of the \fI\-\-clear=STR\fR, \fI\-\-get=STR\fR and
<start_byte>:<start_bit>[:<num_bits>][=<value>]
.PP
The <acronym> is one of a list of common fields (e.g. "ident" and "fault")
-that the utilty converts internally into the second form. The <start_byte>
+that the utility converts internally into the second form. The <start_byte>
is usually in the range 0 to 3, the <start_bit> must be in the range 0 to
7 and the <num_bits> must be in the range 1 to 64 (default 1). The
number of bits are read in the left to right sense of the element tables
@@ -267,14 +271,14 @@ the state of the enclosure.
.PP
The lowest level technique provided by this utility involves outputting
a "status" page in hex with \fI\-\-raw\fR. Then a text editor can be used
-to edit the hex (note: to change an enclosure control descriptor the SELECT
+to edit the hex (note: to change an Enclosure Control descriptor the SELECT
bit needs to be set). Next the control page data can fed back with the
\fI\-\-data=H,H...\fR option together with the \fI\-\-control\fR option;
the \fI\-\-byte1=B1\fR option may need to be given as well.
.PP
-Changes to the enclosure control page (and the threshold out page) can be
+Changes to the Enclosure Control page (and the Threshold Out page) can be
done at a higher level. This involves choosing a page (the default in this
-case is the enclosure control page). Next choose an individual or overall
+case is the Enclosure Control page). Next choose an individual or overall
element index (or name it with its element descriptor string). Then give
the element's name (e.g. "ident" for RQST IDENT) or its position within that
element (e.g. in an array device slot control element RQST IDENT is byte 2,
@@ -298,60 +302,60 @@ There is a related command set called SAF\-TE (SCSI attached fault\-tolerant
enclosure) for enclosure (including RAID) status and control. SCSI devices
that support SAF\-TE report "Processor" peripheral device type (0x3) in their
INQUIRY response. See the sg_safte utility in this package or safte\-monitor
-on the internet.
+on the Internet.
.SH EXAMPLES
These examples use Linux device names. For suitable device names in
other supported Operating Systems see the sg3_utils(8) man page.
.PP
To view the supported pages:
.PP
- sg_ses /dev/sda
+ sg_ses /dev/bsg/6:0:2:0
.PP
-To view the configuration page:
+To view the Configuration page:
.PP
- sg_ses \-\-page=1 /dev/sda
+ sg_ses \-\-page=cf /dev/bsg/6:0:2:0
.PP
-To view the status page:
+To view the Enclosure Status page:
.PP
- sg_ses \-\-page=2 /dev/sda
+ sg_ses \-\-page=es /dev/bsg/6:0:2:0
.PP
Changing a temperature threshold is possible, if a little awkward. The
current thresholds can be shown with:
.PP
- sg_ses \-\-page=5 /dev/sda
+ sg_ses \-\-page=th /dev/bsg/6:0:2:0
.PP
The threshold to be changed can be chosen. Then output the threshold page
in hex (suitable for editing) with:
.PP
- sg_ses \-\-page=5 \-\-raw /dev/sda > t
+ sg_ses \-\-page=th \-\-raw /dev/bsg/6:0:2:0 > t
.PP
Then with the aid of the SES\-3 document (in revision 3: section 6.1.8)
use your favourite editor to change t. The changes can be sent to the
device with:
.PP
- sg_ses \-\-control \-\-page=5 \-\-data=\- /dev/sda < t
+ sg_ses \-\-control \-\-page=th \-\-data=\- /dev/bsg/6:0:2:0 < t
.PP
If the above is successful, the threshold should have been changed. To
check try:
.PP
- sg_ses \-\-page=5 /dev/sda
+ sg_ses \-\-page=th /dev/bsg/6:0:2:0
.PP
again.
.PP
-Fields in the various elements of the enclosure control diagnostic page
-can be changed with a higher level syntax. The following example looks
-at flashing the "ident" LED (also called "locate") on "ArrayDevice07"
-which is a disk (or more precisely the carrier drawer the disk is in):
+Fields in the various elements of the Enclosure Control page can be changed
+with a higher level syntax. The following example looks at flashing
+the "ident" LED (also called "locate") on "ArrayDevice07" which is a disk (or
+more precisely the carrier drawer the disk is in):
.PP
sg_ses \-\-index=7 \-\-set=2:1:1 /dev/sg3
.PP
-If the element descriptor diagnostic page shows that "ArrayDevice07" is
+If the Element Descriptor diagnostic page shows that "ArrayDevice07" is
the descriptor name associated with element index 7 then this invocation
-is equivalent to the last one:
+is equivalent to the previous one:
.PP
sg_ses \-\-descriptor=ArrayDevice07 \-\-set=2:1:1 /dev/sg3
.PP
-Further the byte 2, bit 1 (for 1 bit) field in the array slot control
+Further the byte 2, bit 1 (for 1 bit) field in the Array Device Slot control
element is RQST INDENT for asking a disk carrier to flash a LED so it can
be located. In this case "ident" (or "locate") is accepted as an acronym
for that field:
@@ -362,13 +366,13 @@ To turn off that LED:
.PP
sg_ses \-\-descriptor=ArrayDevice07 \-\-clear=ident /dev/sg3
.PP
-To get the SAS address of that device (which is held in the additional
-element sense page (page 10)) printed on hex:
+To get the (attached) SAS address of that device (which is held in the
+Additional Element Sense page (page 10)) printed on hex:
.PP
- sg_ses \-p 10 \-D ArrayDevice07 \-G at_sas_addr \-H /dev/sg3
+ sg_ses \-p aes \-D ArrayDevice07 \-G at_sas_addr \-H /dev/sg3
.PP
-To collate the information in the enclosure status, element descriptor
-and additional element status pages the \fI\-\-join\fR option can be used:
+To collate the information in the Enclosure Status, Element Descriptor
+and Additional Element Status pages the \fI\-\-join\fR option can be used:
.PP
sg_ses \-\-join /dev/sg3
.PP
@@ -390,10 +394,5 @@ Copyright \(co 2004\-2011 Douglas Gilbert
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.SH "SEE ALSO"
-There is a web page discussing this utility at
-http://sg.danny.cz/sg/sg_ses.html .
-.PP
-Also see these related utilties:
-.PP
.B sg_inq, sg_safte, sg_senddiag, sg3_utils (in sg3_utils package);
-.B safte\-monitor (internet)
+.B safte\-monitor (Internet)
diff --git a/doc/sg_vpd.8 b/doc/sg_vpd.8
index 510ee4aa..94dad610 100644
--- a/doc/sg_vpd.8
+++ b/doc/sg_vpd.8
@@ -29,7 +29,7 @@ option name.
\fB\-e\fR, \fB\-\-enumerate\fR
list the names of the known VPD pages, first the standard pages, then the
vendor specific pages. Each group is sorted in abbreviation order. The
-\fIDEVICE\fR and other options are ignored and this utility exits afte
+\fIDEVICE\fR and other options are ignored and this utility exits after
listing the VPD page names.
.TP
\fB\-h\fR, \fB\-\-help\fR
@@ -73,7 +73,7 @@ numbers are given the second number indicates which vendor specific VPD page
to decode when several pages share the same VPD page number. If this option
is not given (nor '\-i', '\-l' nor '\-V') then the "Supported VPD pages" (0x0)
VPD page is fetched and decoded. If \fIPG\fR is '\-1' or 'sinq' then the
-standard inquiry response is output.
+standard INQUIRY response is output.
.TP
\fB\-q\fR, \fB\-\-quiet\fR
suppress the amount of decoding output.
@@ -107,10 +107,10 @@ a SATA disk behind a SAT layer then this
command: 'sg_vpd \-p ai \-HHH /dev/sdb | hdparm \-\-Istdin'
should decode the ATA IDENTIFY (PACKET) DEVICE response.
.SH NOTES
-Since some VPD pages (e.g. the Extended Inquiry page) depend on settings
+Since some VPD pages (e.g. the Extended INQUIRY page) depend on settings
in the standard INQUIRY response, then the standard INQUIRY response is
output as a pseudo VPD page when \fIPG\fR is set to '\-1' or 'sinq'. Also
-the decoding of some fields (e.g. the Extended Inquiry page's SPT field)
+the decoding of some fields (e.g. the Extended INQUIRY page's SPT field)
is expanded when the '\-\-long' option is given using the standard INQUIRY
response information (e.g. the PDT and the PROTECT fields).
.PP
diff --git a/doc/sg_write_same.8 b/doc/sg_write_same.8
index 16279a2b..22eb168a 100644
--- a/doc/sg_write_same.8
+++ b/doc/sg_write_same.8
@@ -135,7 +135,7 @@ sets the "Write protect" field in the WRITE SAME cdb to \fIWPR\fR. The
default value is zero. \fIWPR\fR should be a value between 0 and 7.
When \fIWPR\fR is 1 or greater, and the disk's protection type is 1 or
greater, then 8 extra bytes of protection information are expected or
-generated (to place in the commmand's data-out buffer).
+generated (to place in the commmand's data out buffer).
.TP
\fB\-x\fR, \fB\-\-xferlen\fR=\fILEN\fR
where \fILEN\fR is the data out buffer length. Defaults to the length of
@@ -242,7 +242,7 @@ wrong):
dd if=/dev/sdb skip=2468 bs=512 of=/dev/null count=1
.PP
Now an attempt is made to create a binary file with zeroes in the user data,
-0x0000 in the appliction tag and 0xff bytes in the other two PI fields. It
+0x0000 in the application tag and 0xff bytes in the other two PI fields. It
is awkward to create 0xff bytes in a file (in Unix) as the "tr" command
below shows:
.PP
@@ -262,7 +262,7 @@ contain 520 bytes. Now that file can be written to LBA 2468 as follows:
Note the \fI\-\-wrprotect=3\fR rather than being set to 1, since we want
the WRITE SAME command to succeed even though the PI data now indicates
the user data is corrupted. When an attempt is made to read the LBA, an
-erro should occur:
+error should occur:
.PP
dd if=/dev/sdb skip=2468 bs=512 of=/dev/null count=1
.PP
diff --git a/scripts/README b/scripts/README
index 08ac35c6..35c67d0a 100644
--- a/scripts/README
+++ b/scripts/README
@@ -7,7 +7,7 @@ more utilities from the sg3_utils package. They assume the sg3_utils
package utilities are on the PATH of the user.
scsi_logging_level is written by Andreas Herrmann <aherrman at de dot ibm
-dot com>. It sets the logging level of the SCSI subsystem in the linux
+dot com>. It sets the logging level of the SCSI subsystem in the Linux
2.6 series kernels. See that file for more information.
The other scripts are written by the author. Some do testing while others
diff --git a/src/sg_ses.c b/src/sg_ses.c
index 04c21ac6..3f2841ad 100644
--- a/src/sg_ses.c
+++ b/src/sg_ses.c
@@ -27,7 +27,7 @@
* commands tailored for SES (enclosure) devices.
*/
-static char * version_str = "1.64 20111211"; /* ses3r03 */
+static char * version_str = "1.64 20111216"; /* ses3r03 */
#define MX_ALLOC_LEN 4096
#define MX_ELEM_HDR 1024
@@ -145,7 +145,7 @@ struct type_desc_hdr_t {
unsigned char etype; /* element type code (0: unspecified) */
unsigned char num_elements; /* number of possible elements, excluding
* overall element */
- unsigned char se_id; /* subenclosure id (0 for main enclosure) */
+ unsigned char se_id; /* subenclosure id (0 for primary enclosure) */
unsigned char txt_len; /* type descriptor text length; (unused) */
};
@@ -157,7 +157,7 @@ struct join_row_t {
int el_ind_indiv; /* individual element index, -1 for overall
* instance, otherwise origin 0 */
unsigned char etype; /* element type */
- unsigned char se_id; /* subenclosure id (0 for main enclosure) */
+ unsigned char se_id; /* subenclosure id (0 for primary enclosure) */
int ei_asc; /* element index used by Additional Element
* Status page, -1 for not applicable */
int ei_asc2; /* some vendors get ei_asc wrong, this is
@@ -192,6 +192,18 @@ struct acronym2tuple {
int num_bits;
};
+/* Structure for holding (sub-)enclosure information found in the
+ * Configuration diagnostic page. */
+struct enclosure_info {
+ int have_info;
+ int rel_esp_id; /* relative enclosure services process id (origin 1) */
+ int num_esp; /* number of enclosure services processes */
+ unsigned char enc_log_id[8]; /* 8 byte NAA */
+ unsigned char enc_vendor_id[8]; /* may differ from INQUIRY response */
+ unsigned char product_id[16]; /* may differ from INQUIRY response */
+ unsigned char product_rev_level[4]; /* may differ from INQUIRY response */
+};
+
static struct type_desc_hdr_t type_desc_hdr_arr[MX_ELEM_HDR];
@@ -1183,8 +1195,11 @@ ses_configuration_sdg(const unsigned char * resp, int resp_len)
printf(" vendor-specific data:\n");
/* dStrHex((const char *)(ucp + 40), el - 40, 0); */
printf(" ");
- for (j = 0; j < (el - 40); ++j)
+ for (j = 0; j < (el - 40); ++j) {
+ if ((j > 0) && (0 == (j % 16)))
+ printf("\n ");
printf("%02x ", *(ucp + 40 + j));
+ }
printf("\n");
}
}
@@ -1210,11 +1225,13 @@ truncated:
return;
}
-/* Returns total number of type descriptor headers written to 'tdhp' or -1
+/* DPC_CONFIGURATION
+ * Returns total number of type descriptor headers written to 'tdhp' or -1
* if there is a problem */
static int
populate_type_desc_hdr_arr(int fd, struct type_desc_hdr_t * tdhp,
unsigned int * generationp,
+ struct enclosure_info * primary_ip,
struct opts_t * op)
{
int resp_len, k, el, num_subs, sum_type_dheaders, res, n;
@@ -1249,6 +1266,15 @@ populate_type_desc_hdr_arr(int fd, struct type_desc_hdr_t * tdhp,
el);
continue;
}
+ if ((0 == k) && primary_ip) {
+ ++primary_ip->have_info;
+ primary_ip->rel_esp_id = (ucp[0] & 0x70) >> 4;
+ primary_ip->num_esp = (ucp[0] & 0x7);
+ memcpy(primary_ip->enc_log_id, ucp + 4, 8);
+ memcpy(primary_ip->enc_vendor_id, ucp + 12, 8);
+ memcpy(primary_ip->product_id, ucp + 20, 16);
+ memcpy(primary_ip->product_rev_level, ucp + 36, 4);
+ }
}
for (k = 0; k < sum_type_dheaders; ++k, ucp += 4) {
if ((ucp + 3) > last_ucp)
@@ -2301,8 +2327,11 @@ ses_subenc_string_sdg(const unsigned char * resp, int resp_len)
if (el > 4) {
/* dStrHex((const char *)(ucp + 4), el - 4, 0); */
printf(" ");
- for (j = 0; j < (el - 4); ++j)
+ for (j = 0; j < (el - 4); ++j) {
+ if ((j > 0) && (0 == (j % 16)))
+ printf("\n ");
printf("%02x ", *(ucp + 4 + j));
+ }
printf("\n");
} else
printf(" <empty>\n");
@@ -2527,10 +2556,11 @@ read_hex(const char * inp, unsigned char * arr, int * arr_len)
static int
ses_process_status_page(int sg_fd, struct opts_t * op)
{
- int rsp_len, res;
+ int j, rsp_len, res;
unsigned int ref_gen_code;
unsigned char rsp_buff[MX_ALLOC_LEN];
const char * cp;
+ struct enclosure_info primary_info;
cp = find_in_diag_page_desc(op->page_code);
res = do_rec_diag(sg_fd, op->page_code, rsp_buff, sizeof(rsp_buff),
@@ -2553,6 +2583,7 @@ ses_process_status_page(int sg_fd, struct opts_t * op)
"[0x%x]\n", op->page_code);
dStrHex((const char *)rsp_buff, rsp_len, 0);
} else {
+ memset(&primary_info, 0, sizeof(primary_info));
switch (op->page_code) {
case DPC_SUPPORTED:
ses_supported_pages_sdg("Supported diagnostic pages",
@@ -2563,9 +2594,16 @@ ses_process_status_page(int sg_fd, struct opts_t * op)
break;
case DPC_ENC_STATUS:
res = populate_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- &ref_gen_code, op);
+ &ref_gen_code, &primary_info,
+ op);
if (res < 0)
return res;
+ if (primary_info.have_info) {
+ printf(" Primary enclosure logical identifier (hex): ");
+ for (j = 0; j < 8; ++j)
+ printf("%02x", primary_info.enc_log_id[j]);
+ printf("\n");
+ }
ses_enc_status_dp(type_desc_hdr_arr, res, ref_gen_code,
rsp_buff, rsp_len, op);
break;
@@ -2587,8 +2625,11 @@ ses_process_status_page(int sg_fd, struct opts_t * op)
int j;
printf(" ");
- for (j = 0; j < (rsp_len - 4); ++j)
+ for (j = 0; j < (rsp_len - 4); ++j) {
+ if ((j > 0) && (0 == (j % 16)))
+ printf("\n ");
printf("%02x ", *(rsp_buff + 4 + j));
+ }
printf("\n");
#endif
} else
@@ -2596,17 +2637,31 @@ ses_process_status_page(int sg_fd, struct opts_t * op)
break;
case DPC_THRESHOLD:
res = populate_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- &ref_gen_code, op);
+ &ref_gen_code, &primary_info,
+ op);
if (res < 0)
return res;
+ if (primary_info.have_info) {
+ printf(" Primary enclosure logical identifier (hex): ");
+ for (j = 0; j < 8; ++j)
+ printf("%02x", primary_info.enc_log_id[j]);
+ printf("\n");
+ }
ses_threshold_sdg(type_desc_hdr_arr, res, ref_gen_code,
rsp_buff, rsp_len, op);
break;
case DPC_ELEM_DESC:
res = populate_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- &ref_gen_code, op);
+ &ref_gen_code, &primary_info,
+ op);
if (res < 0)
return res;
+ if (primary_info.have_info) {
+ printf(" Primary enclosure logical identifier (hex): ");
+ for (j = 0; j < 8; ++j)
+ printf("%02x", primary_info.enc_log_id[j]);
+ printf("\n");
+ }
ses_element_desc_sdg(type_desc_hdr_arr, res, ref_gen_code,
rsp_buff, rsp_len, op);
break;
@@ -2621,9 +2676,16 @@ ses_process_status_page(int sg_fd, struct opts_t * op)
break;
case DPC_ADD_ELEM_STATUS:
res = populate_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- &ref_gen_code, op);
+ &ref_gen_code, &primary_info,
+ op);
if (res < 0)
return res;
+ if (primary_info.have_info) {
+ printf(" Primary enclosure logical identifier (hex): ");
+ for (j = 0; j < 8; ++j)
+ printf("%02x", primary_info.enc_log_id[j]);
+ printf("\n");
+ }
ses_additional_elem_sdg(type_desc_hdr_arr, res, ref_gen_code,
rsp_buff, rsp_len, op);
break;
@@ -2676,12 +2738,20 @@ process_join(int sg_fd, struct opts_t * op, int display)
const char * enc_state_changed = " <<state of enclosure changed, "
"please try again>>\n";
const struct type_desc_hdr_t * tdhp;
+ struct enclosure_info primary_info;
char b[64];
num_t_hdrs = populate_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- &ref_gen_code, op);
+ &ref_gen_code, &primary_info,
+ op);
if (num_t_hdrs < 0)
return num_t_hdrs;
+ if (display && primary_info.have_info) {
+ printf(" Primary enclosure logical identifier (hex): ");
+ for (j = 0; j < 8; ++j)
+ printf("%02x", primary_info.enc_log_id[j]);
+ printf("\n");
+ }
res = do_rec_diag(sg_fd, DPC_ENC_STATUS, enc_stat_rsp,
sizeof(enc_stat_rsp), op, &enc_stat_rsp_len);
if (res)
@@ -3302,8 +3372,8 @@ ses_cgs(int sg_fd, const struct tuple_acronym_val * tavp,
}
if ((NULL == jrp->enc_statp) || (k >= MX_JOIN_ROWS)) {
if (op->desc_name)
- fprintf(stderr, "descriptor name: %s not found (check page "
- "7)\n", op->desc_name);
+ fprintf(stderr, "descriptor name: %s not found (check the 'ed' "
+ "page [0x7])\n", op->desc_name);
else
fprintf(stderr, "index: %d,%d not found\n", op->ind_th,
op->ind_indiv);
@@ -3357,7 +3427,7 @@ process_do_enumerate(const struct opts_t * op)
} else {
/* command line has multiple --enumerate and/or --list options */
printf("--clear, --get, --set acronyms for enclosure status/control "
- "[0x2] page:\n");
+ "['es' or 'ec'] page:\n");
for (a2tp = ecs_a2t_arr; a2tp->acron; ++a2tp) {
cp = (a2tp->etype < 0) ? "*" :
find_element_tname(a2tp->etype, b, sizeof(b));
@@ -3365,14 +3435,14 @@ process_do_enumerate(const struct opts_t * op)
a2tp->start_byte, a2tp->start_bit, a2tp->num_bits);
}
printf("\n--clear, --get, --set acronyms for threshold in/out "
- "[0x5] page:\n");
+ "['th'] page:\n");
for (a2tp = th_a2t_arr; a2tp->acron; ++a2tp) {
cp = (a2tp->etype < 0) ? "*" :
find_element_tname(a2tp->etype, b, sizeof(b));
printf(" %s [%s] [%d:%d:%d]\n", a2tp->acron, (cp ? cp : "??"),
a2tp->start_byte, a2tp->start_bit, a2tp->num_bits);
}
- printf("\n--get acronyms for additional element status [0xa] page "
+ printf("\n--get acronyms for additional element status ['aes'] page "
"(SAS EIP=1):\n");
for (a2tp = ae_sas_a2t_arr; a2tp->acron; ++a2tp) {
cp = (a2tp->etype < 0) ? "*" :
@@ -3465,9 +3535,10 @@ main(int argc, char * argv[])
inq_resp.product, inq_resp.revision);
pd_type = inq_resp.peripheral_type;
cp = sg_get_pdt_str(pd_type, sizeof(buff), buff);
- if (0xd == pd_type)
- printf(" enclosure services device\n");
- else if (0x40 & inq_resp.byte_6)
+ if (0xd == pd_type) {
+ if (opts.verbose)
+ printf(" enclosure services device\n");
+ } else if (0x40 & inq_resp.byte_6)
printf(" %s device has EncServ bit set\n", cp);
else
printf(" %s device (not an enclosure)\n", cp);