aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--README2
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg3_utils.82
-rw-r--r--doc/sg_logs.88
-rw-r--r--include/sg_lib_data.h4
-rw-r--r--lib/sg_lib.c3
-rw-r--r--lib/sg_lib_data.c31
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/sg_inq.c2
-rw-r--r--src/sg_inq_data.c7
-rw-r--r--src/sg_logs.c162
12 files changed, 142 insertions, 88 deletions
diff --git a/ChangeLog b/ChangeLog
index 0aff0882..3990cfe6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,12 +2,13 @@ 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.37 [20130627] [svn: r500]
+Changelog for sg3_utils-1.37 [20130701] [svn: r501]
- sg_compare_and_write: fix wrprotect setting
- sg_inq: fix referrals VPD page
- - sg_logs: improve for tape drives
+ - sg_logs: improve for tape drives, general cleanup
- sg_persist: fix core dump on -Q option
- sg_unmap: fix core dump on -g option
+ - sg_libs: extended copy opcode renamed (spc4r34)
- Makefile.am cleanup
Changelog for sg3_utils-1.36 [20130531] [svn: r497]
diff --git a/README b/README
index 630b7c20..222a35c0 100644
--- a/README
+++ b/README
@@ -382,4 +382,4 @@ See http://sg.danny.cz/sg/tools.html
Douglas Gilbert
-21st June 2013
+1st July 2013
diff --git a/debian/changelog b/debian/changelog
index e347fb47..1fc799b8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.37-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Thu, 27 Jun 2013 11:00:00 -0400
+ -- Douglas Gilbert <dgilbert@interlog.com> Mon, 01 Jul 2013 15:00:00 -0400
sg3-utils (1.36-0.1) unstable; urgency=low
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index 3069e03c..c59a30b3 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -1,4 +1,4 @@
-.TH SG3_UTILS "8" "June 2013" "sg3_utils\-1.37" SG3_UTILS
+.TH SG3_UTILS "8" "July 2013" "sg3_utils\-1.37" SG3_UTILS
.SH NAME
sg3_utils \- a package of utilities for sending SCSI commands
.SH SYNOPSIS
diff --git a/doc/sg_logs.8 b/doc/sg_logs.8
index 16f26d5c..07fb8e63 100644
--- a/doc/sg_logs.8
+++ b/doc/sg_logs.8
@@ -1,4 +1,4 @@
-.TH SG_LOGS "8" "October 2011" "sg3_utils\-1.33" SG3_UTILS
+.TH SG_LOGS "8" "July 2013" "sg3_utils\-1.37" SG3_UTILS
.SH NAME
sg_logs \- access log pages with SCSI LOG SENSE command
.SH SYNOPSIS
@@ -23,14 +23,14 @@ This utility sends a SCSI LOG SENSE command to the \fIDEVICE\fR and then
outputs the response. The LOG SENSE command is used to fetch log pages. Known
log pages are decoded by default. When the \fI\-\-reset\fR and/or
\fI\-\-select\fR option is given then a SCSI LOG SELECT command is issued to
-reset parameters.
+reset parameters (e.g. counters).
.PP
In SPC\-4 revision 5 a subpage code was introduced to both the LOG SENSE and
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 surtaxes, the preferred one is shown
+This utility supports two command line syntaxes, 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
@@ -338,7 +338,7 @@ Written by Douglas Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2002\-2011 Douglas Gilbert
+Copyright \(co 2002\-2013 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/include/sg_lib_data.h b/include/sg_lib_data.h
index 57611318..68fd1c86 100644
--- a/include/sg_lib_data.h
+++ b/include/sg_lib_data.h
@@ -26,8 +26,8 @@ extern "C" {
#define SG_MAINTENANCE_OUT 0xa4
#define SG_PERSISTENT_RESERVE_IN 0x5e
#define SG_PERSISTENT_RESERVE_OUT 0x5f
-#define SG_EXTENDED_COPY 0x83
-#define SG_RECEIVE_COPY 0x84
+#define SG_EXTENDED_COPY 0x83 /* since spc4r34 called: Third party copy out */
+#define SG_RECEIVE_COPY 0x84 /* since spc4r34 called: Third party copy in */
#define SG_SERVICE_ACTION_IN_12 0xab
#define SG_SERVICE_ACTION_OUT_12 0xa9
#define SG_SERVICE_ACTION_BIDI 0x9d
diff --git a/lib/sg_lib.c b/lib/sg_lib.c
index cfc2fd28..227b4b0c 100644
--- a/lib/sg_lib.c
+++ b/lib/sg_lib.c
@@ -1234,6 +1234,7 @@ sg_get_opcode_sa_name(unsigned char cmd_byte0, int service_action,
"action=0x%x", service_action);
break;
case SG_EXTENDED_COPY:
+ /* 'Extended copy' was renamed 'Third party copy out' in spc4r34 */
vnp = get_value_name(sg_lib_xcopy_sa_arr, service_action, peri_type);
if (vnp)
my_snprintf(buff, buff_len, "%s", vnp->name);
@@ -1242,6 +1243,8 @@ sg_get_opcode_sa_name(unsigned char cmd_byte0, int service_action,
service_action);
break;
case SG_RECEIVE_COPY:
+ /* 'Receive copy results' was renamed 'Third party copy in' in
+ * spc4r34 */
vnp = get_value_name(sg_lib_rec_copy_sa_arr, service_action,
peri_type);
if (vnp)
diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c
index e884848a..7d45ef91 100644
--- a/lib/sg_lib_data.c
+++ b/lib/sg_lib_data.c
@@ -15,7 +15,7 @@
#endif
-const char * sg_lib_version_str = "1.84 20130603"; /* spc4r36, sbc3r32 */
+const char * sg_lib_version_str = "1.86 20130701"; /* spc4r36, sbc3r32 */
#ifdef SG_SCSI_STRINGS
struct sg_lib_value_name_t sg_lib_normal_opcodes[] = {
@@ -135,8 +135,9 @@ struct sg_lib_value_name_t sg_lib_normal_opcodes[] = {
{0x81, 0, "Rebuild(16)"},
{0x81, PDT_TAPE, "Read reverse(16)"},
{0x82, 0, "Regenerate(16)"},
- {0x83, 0, "Extended copy"},
- {0x84, 0, "Receive copy results"},
+ {0x83, 0, "Third party copy out"}, /* Extended copy, before spc4r34 */
+ /* Following was "Receive copy results", before spc4r34 */
+ {0x84, 0, "Third party copy in"},
{0x85, 0, "ATA command pass through(16)"}, /* was 0x98 in spc3 rev21c */
{0x86, 0, "Access control in"},
{0x87, 0, "Access control out"},
@@ -311,22 +312,26 @@ struct sg_lib_value_name_t sg_lib_pr_out_arr[] = { /* opcode 0x5f */
{0xffff, 0, NULL},
};
+/* 'Extended copy' was renamed 'Third party copy in' in spc4r34 */
+/* LID1 is an abbreviation of List Identifier length of 1 byte */
struct sg_lib_value_name_t sg_lib_xcopy_sa_arr[] = { /* opcode 0x83 */
- {0x0, 0, "Extended copy(lid1)"},
- {0x1, 0, "Extended copy(lid4)"},
+ {0x0, 0, "Extended copy(LID1)"},
+ {0x1, 0, "Extended copy(LID4)"},
{0x10, 0, "Populate token"},
{0x11, 0, "Write using token"},
- {0x1c, 0, "Extended copy abort"},
+ {0x1c, 0, "Copy operation abort"},
{0xffff, 0, NULL},
};
+/* 'Receive copy results' was renamed 'Third party copy out' in spc4r34 */
+/* LID4 is an abbreviation of List Identifier length of 4 bytes */
struct sg_lib_value_name_t sg_lib_rec_copy_sa_arr[] = { /* opcode 0x84 */
- {0x0, 0, "Receive copy status(lid1)"},
- {0x1, 0, "Receive copy data(lid1)"},
+ {0x0, 0, "Receive copy status(LID1)"},
+ {0x1, 0, "Receive copy data(LID1)"},
{0x3, 0, "Receive copy operating parameters"},
- {0x4, 0, "Receive copy failure details(lid1)"},
- {0x5, 0, "Receive copy status(lid4)"},
- {0x6, 0, "Receive copy data(lid4)"},
+ {0x4, 0, "Receive copy failure details(LID1)"},
+ {0x5, 0, "Receive copy status(LID4)"},
+ {0x6, 0, "Receive copy data(LID4)"},
{0x7, 0, "Receive ROD token information"},
{0x8, 0, "Report all ROD tokens"},
{0xffff, 0, NULL},
@@ -470,7 +475,7 @@ struct sg_lib_value_name_t sg_lib_variable_length_arr[] = {
/* A conveniently formatted list of SCSI ASC/ASCQ codes and their
* corresponding text can be found at: www.t10.org/lists/asc-num.txt
- * The following should match asc-num.txt dated 20111222 */
+ * The following should match asc-num.txt dated 20130605 */
#ifdef SG_SCSI_STRINGS
struct sg_lib_asc_ascq_range_t sg_lib_asc_ascq_range[] =
@@ -628,6 +633,7 @@ struct sg_lib_asc_ascq_t sg_lib_asc_ascq[] =
{0x11,0x12,"Auxiliary memory read error"},
{0x11,0x13,"Read error - failed retransmission request"},
{0x11,0x14,"Read error - LBA marked bad by application client"},
+ {0x11,0x15,"Write after sanitize required"},
{0x12,0x00,"Address mark not found for id field"},
{0x13,0x00,"Address mark not found for data field"},
{0x14,0x00,"Recorded entity not found"},
@@ -897,6 +903,7 @@ struct sg_lib_asc_ascq_t sg_lib_asc_ascq[] =
{0x3F,0x12,"iSCSI IP address added"},
{0x3F,0x13,"iSCSI IP address removed"},
{0x3F,0x14,"iSCSI IP address changed"},
+ {0x3F,0x15,"Inspect referrals sense descriptors"},
/*
* ASC 0x40, 0x41 and 0x42 overridden by "additional2" array entries
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 87e09326..f21c63c7 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,7 +79,7 @@ fi
%{_libdir}/*.la
%changelog
-* Thu Jun 27 2013 - dgilbert at interlog dot com
+* Mon Jul 01 2013 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.37
diff --git a/src/sg_inq.c b/src/sg_inq.c
index beb5a20e..338aade9 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -67,7 +67,7 @@
* information [MAINTENANCE IN, service action = 0xc]; see sg_opcodes.
*/
-static const char * version_str = "1.14 20130613"; /* SPC-4 rev 36 */
+static const char * version_str = "1.15 20130701"; /* SPC-4 rev 36 */
/* Following VPD pages are in ascending page number order */
diff --git a/src/sg_inq_data.c b/src/sg_inq_data.c
index c8c7fda8..22881521 100644
--- a/src/sg_inq_data.c
+++ b/src/sg_inq_data.c
@@ -48,8 +48,8 @@ struct sg_version_descriptor {
const char * name;
};
-/* table from SPC-4 revision 35 [sorted numerically (from Annex E.9)] */
-/* Can also be obtained from : http://www.t10.org/lists/stds.txt 20121115 */
+/* table from SPC-4 revision 36 [sorted numerically (from Annex E.9)] */
+/* Can also be obtained from : http://www.t10.org/lists/stds.txt 20130321 */
#ifdef SG_SCSI_STRINGS
struct sg_version_descriptor sg_version_descriptor_arr[] = {
@@ -197,6 +197,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x4aa, "ADC-2 T10/1741-D revision 8"},
{0x4ac, "ADC-2 ANSI INCITS 441-2008"},
{0x4c0, "SBC-3 (no version claimed)"},
+ {0x4c3, "SBC-3 T10/BSR INCITS 514 revision 35"},
{0x4e0, "MMC-6 (no version claimed)"},
{0x4e3, "MMC-6 T10/1836-D revision 2b"},
{0x4e5, "MMC-6 T10/1836-D revision 02g"},
@@ -207,6 +208,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x502, "ADC-3 T10/1895-D revision 04"},
{0x504, "ADC-3 T10/1895-D revision 05"},
{0x506, "ADC-3 T10/1895-D revision 05a"},
+ {0x50a, "ADC-3 ANSI INCITS 497-2012"},
{0x520, "SSC-4 (no version claimed)"},
{0x523, "SSC-4 T10/BSR INCITS 516 revision 2"},
{0x560, "OSD-3 (no version claimed)"},
@@ -329,6 +331,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xc4b, "SAS-2.1 T10/2125-D revision 07"},
{0xc4e, "SAS-2.1 ANSI INCITS 478-2011"},
{0xc60, "SAS-3 (no version claimed)"},
+ {0xc63, "SAS-3 T10/BSR INCITS 519 revision 05a"},
{0xd20, "FC-PH (no version claimed)"},
{0xd3b, "FC-PH ANSI INCITS 230-1994"},
{0xd3c, "FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS "
diff --git a/src/sg_logs.c b/src/sg_logs.c
index c765b041..fa95c279 100644
--- a/src/sg_logs.c
+++ b/src/sg_logs.c
@@ -25,7 +25,7 @@
#include "sg_lib.h"
#include "sg_cmds_basic.h"
-static const char * version_str = "1.12 20130621"; /* spc4r35 + sbc3r30 */
+static const char * version_str = "1.13 20130701"; /* spc4r35 + sbc3r30 */
#define MX_ALLOC_LEN (0xfffc)
#define SHORT_RESP_LEN 128
@@ -822,13 +822,13 @@ show_page_name(int pg_code, int subpg_code,
printf("%sTapeAlert (ssc-2)\n", b);
break;
case 0x30:
- printf("%sTape usage log (IBM specific)\n", b);
+ printf("%sTape usage (IBM specific)\n", b);
break;
case 0x31:
- printf("%sTape capacity log (IBM specific)\n", b);
+ printf("%sTape capacity (IBM specific)\n", b);
break;
case 0x32:
- printf("%sData compression log (IBM specific)\n", b);
+ printf("%sData compression (IBM specific)\n", b);
break;
default:
done = 0;
@@ -931,7 +931,7 @@ show_buffer_under_overrun_page(unsigned char * resp, int len, int show_pcb)
unsigned char * ucp;
char pcb_str[PCB_STR_LEN];
- printf("Buffer over-run/under-run page\n");
+ printf("Buffer over-run/under-run page (spc-2) [0x1]\n");
num = len - 4;
ucp = &resp[0] + 4;
while (num > 3) {
@@ -980,22 +980,23 @@ show_buffer_under_overrun_page(unsigned char * resp, int len, int show_pcb)
static void
show_error_counter_page(unsigned char * resp, int len, int show_pcb)
{
- int num, pl, pc, pcb;
+ int num, pl, pc, pcb, pg_code;
unsigned char * ucp;
char pcb_str[PCB_STR_LEN];
- switch(resp[0] & 0x3f) {
+ pg_code = resp[0] & 0x3f;
+ switch(pg_code) {
case WRITE_ERR_LPAGE:
- printf("Write error counter page\n");
+ printf("Write error counter page (spc-3) [0x%x]\n", pg_code);
break;
case READ_ERR_LPAGE:
- printf("Read error counter page\n");
+ printf("Read error counter page (spc-3) [0x%x]\n", pg_code);
break;
case READ_REV_ERR_LPAGE:
- printf("Read Reverse error counter page\n");
+ printf("Read Reverse error counter page (spc-3) [0x%x]\n", pg_code);
break;
case VERIFY_ERR_LPAGE:
- printf("Verify error counter page\n");
+ printf("Verify error counter page (spc-3) [0x%x]\n", pg_code);
break;
default:
printf("expecting error counter page, got page = 0x%x\n", resp[0]);
@@ -1038,7 +1039,7 @@ show_non_medium_error_page(unsigned char * resp, int len, int show_pcb)
unsigned char * ucp;
char pcb_str[PCB_STR_LEN];
- printf("Non-medium error page\n");
+ printf("Non-medium error page (spc-2) [0x6]\n");
num = len - 4;
ucp = &resp[0] + 4;
while (num > 3) {
@@ -1075,7 +1076,7 @@ show_power_condition_transitions_page(unsigned char * resp, int len,
unsigned char * ucp;
char pcb_str[PCB_STR_LEN];
- printf("Power condition transitions page\n");
+ printf("Power condition transitions page (spc-4) [0x1a]\n");
num = len - 4;
ucp = &resp[0] + 4;
while (num > 3) {
@@ -1109,7 +1110,7 @@ show_power_condition_transitions_page(unsigned char * resp, int len,
}
}
-/* Vendor specific: 0x30 */
+/* Tape usage: Vendor specific (IBM): 0x30 */
static void
show_tape_usage_log_page(unsigned char * resp, int len, int show_pcb)
{
@@ -1122,10 +1123,10 @@ show_tape_usage_log_page(unsigned char * resp, int len, int show_pcb)
num = len - 4;
ucp = &resp[0] + 4;
if (num < 4) {
- printf("badly formed tape usage log page\n");
+ printf("badly formed tape usage page\n");
return;
}
- printf("Tape usage log page\n");
+ printf("Tape usage page (IBM specific) [0x30]\n");
for (k = num; k > 0; k -= extra, ucp += extra) {
pc = (ucp[0] << 8) + ucp[1];
pcb = ucp[2];
@@ -1202,7 +1203,7 @@ show_tape_usage_log_page(unsigned char * resp, int len, int show_pcb)
}
}
-/* Vendor specific: 0x31 */
+/* Tape capacity: vendor specific (IBM): 0x31 */
static void
show_tape_capacity_log_page(unsigned char * resp, int len, int show_pcb)
{
@@ -1214,10 +1215,10 @@ show_tape_capacity_log_page(unsigned char * resp, int len, int show_pcb)
num = len - 4;
ucp = &resp[0] + 4;
if (num < 4) {
- printf("badly formed tape capacity log page\n");
+ printf("badly formed tape capacity page\n");
return;
}
- printf("Tape capacity log page\n");
+ printf("Tape capacity page (IBM specific) [0x31]\n");
for (k = num; k > 0; k -= extra, ucp += extra) {
pc = (ucp[0] << 8) + ucp[1];
pcb = ucp[2];
@@ -1251,22 +1252,28 @@ show_tape_capacity_log_page(unsigned char * resp, int len, int show_pcb)
}
}
-/* originally vendor specific 0x32, ssc4 standardizes at 0x1b */
+/* Data compression: originally vendor specific 0x32 (IBM), then
+ * ssc-4 standardizes it at 0x1b */
static void
show_data_compression_log_page(unsigned char * resp, int len, int show_pcb)
{
- int k, j, pl, num, extra, pc, pcb;
+ int k, j, pl, num, extra, pc, pcb, pg_code;
uint64_t n;
unsigned char * ucp;
char pcb_str[PCB_STR_LEN];
+ pg_code = resp[0] & 0x3f;
num = len - 4;
ucp = &resp[0] + 4;
if (num < 4) {
- printf("badly formed data compression log page\n");
+ printf("badly formed data compression page\n");
return;
}
- printf("Data compression log page\n");
+ if (0x1b == pg_code)
+ printf("Data compression page (ssc-4) [0x1b]\n");
+ else
+ printf("Data compression page (IBM specific) [0x%x]\n",
+ pg_code);
for (k = num; k > 0; k -= extra, ucp += extra) {
pc = (ucp[0] << 8) + ucp[1];
pcb = ucp[2];
@@ -1345,10 +1352,10 @@ show_last_n_error_page(unsigned char * resp, int len, int show_pcb)
printf("No error events logged\n");
return;
}
- printf("Last n error events log page\n");
+ printf("Last n error events page (spc-2) [0x7]\n");
for (k = num; k > 0; k -= pl, ucp += pl) {
if (k < 3) {
- printf("short Last n error events log page\n");
+ printf("short Last n error events page\n");
return;
}
pl = ucp[3] + 4;
@@ -1387,10 +1394,10 @@ show_last_n_deferred_error_page(unsigned char * resp, int len, int show_pcb)
printf("No deferred errors logged\n");
return;
}
- printf("Last n deferred errors log page\n");
+ printf("Last n deferred errors page (spc-2) [0xb]\n");
for (k = num; k > 0; k -= pl, ucp += pl) {
if (k < 3) {
- printf("short Last n deferred errors log page\n");
+ printf("short Last n deferred errors page\n");
return;
}
pl = ucp[3] + 4;
@@ -1428,9 +1435,11 @@ static void
show_self_test_page(unsigned char * resp, int len, int show_pcb)
{
int k, num, n, res, pcb;
+ unsigned int v;
unsigned char * ucp;
uint64_t ull;
char pcb_str[PCB_STR_LEN];
+ char b[80];
num = len - 4;
if (num < 0x190) {
@@ -1438,7 +1447,7 @@ show_self_test_page(unsigned char * resp, int len, int show_pcb)
"0x190 bytes]\n", num);
return;
}
- printf("Self-test results page\n");
+ printf("Self-test results page (spc-3) [0x10]\n");
for (k = 0, ucp = resp + 4; k < 20; ++k, ucp += 20 ) {
pcb = ucp[2];
n = (ucp[6] << 8) | ucp[7];
@@ -1459,9 +1468,15 @@ show_self_test_page(unsigned char * resp, int len, int show_pcb)
ull <<= 8; ull |= ucp[15];
if ((0xffffffffffffffffULL != ull) && (res > 0) && ( res < 0xf))
printf(" address of first error = 0x%" PRIx64 "\n", ull);
- if (ucp[16] & 0xf)
- printf(" sense key = 0x%x, asc = 0x%x, asq = 0x%x",
- ucp[16] & 0xf, ucp[17], ucp[18]);
+ v = ucp[16] & 0xf;
+ if (v) {
+ printf(" sense key = 0x%x [%s] , asc = 0x%x, ascq = 0x%x",
+ v, sg_get_sense_key_str(v, sizeof(b), b), ucp[17],
+ ucp[18]);
+ if (ucp[17] || ucp[18])
+ printf(" [%s]\n", sg_get_asc_ascq_str(ucp[17], ucp[18],
+ sizeof(b), b));
+ }
if (show_pcb) {
get_pcb_str(pcb, pcb_str, sizeof(pcb_str));
printf("\n <%s>\n", pcb_str);
@@ -1482,14 +1497,14 @@ show_temperature_page(unsigned char * resp, int len, int show_pcb, int hdr,
num = len - 4;
ucp = &resp[0] + 4;
if (num < 4) {
- printf("badly formed Temperature log page\n");
+ printf("badly formed Temperature page\n");
return;
}
if (hdr)
- printf("Temperature log page\n");
+ printf("Temperature page (spc-3) [0xd]\n");
for (k = num; k > 0; k -= extra, ucp += extra) {
if (k < 3) {
- printf("short Temperature log page\n");
+ printf("short Temperature page\n");
return;
}
extra = ucp[3] + 4;
@@ -1535,13 +1550,13 @@ show_start_stop_page(unsigned char * resp, int len, int show_pcb, int verbose)
num = len - 4;
ucp = &resp[0] + 4;
if (num < 4) {
- printf("badly formed Start-stop cycle counter log page\n");
+ printf("badly formed Start-stop cycle counter page\n");
return;
}
- printf("Start-stop cycle counter log page\n");
+ printf("Start-stop cycle counter page (spc-3) [0xe]\n");
for (k = num; k > 0; k -= extra, ucp += extra) {
if (k < 3) {
- printf("short Start-stop cycle counter log page\n");
+ printf("short Start-stop cycle counter page\n");
return;
}
extra = ucp[3] + 4;
@@ -1633,14 +1648,14 @@ show_ie_page(unsigned char * resp, int len, int show_pcb, int full)
num = len - 4;
ucp = &resp[0] + 4;
if (num < 4) {
- printf("badly formed Informational Exceptions log page\n");
+ printf("badly formed Informational Exceptions page\n");
return;
}
if (full)
- printf("Informational Exceptions log page\n");
+ printf("Informational Exceptions page (spc-3) [0x2f]\n");
for (k = num; k > 0; k -= extra, ucp += extra) {
if (k < 3) {
- printf("short Informational Exceptions log page\n");
+ printf("short Informational Exceptions page\n");
return;
}
extra = ucp[3] + 4;
@@ -1650,10 +1665,9 @@ show_ie_page(unsigned char * resp, int len, int show_pcb, int full)
if (extra > 5) {
if (full) {
printf(" IE asc = 0x%x, ascq = 0x%x", ucp[4], ucp[5]);
- if (ucp[4]) {
+ if (ucp[4] || ucp[5])
if(sg_get_asc_ascq_str(ucp[4], ucp[5], sizeof(b), b))
printf("\n [%s]", b);
- }
}
if (extra > 6) {
if (ucp[6] < 0xff)
@@ -2042,7 +2056,8 @@ show_protocol_specific_page(unsigned char * resp, int len,
if (6 != (0xf & ucp[4]))
return 0; /* only decode SAS log page */
if ((0 == k) && (0 == optsp->do_name))
- printf("Protocol Specific port log page for SAS SSP\n");
+ printf("Protocol Specific port page for SAS SSP (sas-2) "
+ "[0x18]\n");
show_sas_port_param(ucp, param_len, optsp);
k += param_len;
ucp += param_len;
@@ -2072,6 +2087,12 @@ show_stats_perform_page(unsigned char * resp, int len,
printf("log_page=0x%x\n", STATS_LPAGE);
if (subpg_code > 0)
printf("log_subpage=0x%x\n", subpg_code);
+ } else {
+ if (0 == subpg_code)
+ printf("General Statistics and Performance (spc-4) [0x19]\n");
+ else
+ printf("Group Statistics and Performance (%d) (spc-4) "
+ "[0x19,0x%x]\n", subpg_code, subpg_code);
}
if (subpg_code > 31)
return 0;
@@ -2394,7 +2415,7 @@ show_cache_stats_page(unsigned char * resp, int len,
num = len - 4;
ucp = resp + 4;
if (num < 4) {
- printf("badly formed Cache memory statistics log page\n");
+ printf("badly formed Cache memory statistics page\n");
return 0;
}
spf = !!(resp[0] & 0x40);
@@ -2404,15 +2425,15 @@ show_cache_stats_page(unsigned char * resp, int len,
if (subpg_code > 0)
printf("log_subpage=0x%x\n", subpg_code);
} else
- printf("Cache memory statistics log page\n");
+ printf("Cache memory statistics page (spc-4) [0x19,0x20]\n");
for (k = num; k > 0; k -= extra, ucp += extra) {
if (k < 3) {
- printf("short Cache memory statistics log page\n");
+ printf("short Cache memory statistics page\n");
return 0;
}
if (8 != ucp[3]) {
- printf("Cache memory statistics log page parameter length not "
+ printf("Cache memory statistics page parameter length not "
"8\n");
return 0;
}
@@ -2521,7 +2542,7 @@ show_format_status_page(unsigned char * resp, int len, int show_pcb)
uint64_t ull;
char pcb_str[PCB_STR_LEN];
- printf("Format status page (sbc-2) [0x8]\n");
+ printf("Format status page (sbc-2) [0x8]\n");
num = len - 4;
ucp = &resp[0] + 4;
while (num > 3) {
@@ -2589,7 +2610,7 @@ show_non_volatile_cache_page(unsigned char * resp, int len, int show_pcb)
unsigned char * ucp;
char pcb_str[PCB_STR_LEN];
- printf("Non-volatile cache page (sbc-2) [0x17]\n");
+ printf("Non-volatile cache page (sbc-2) [0x17]\n");
num = len - 4;
ucp = &resp[0] + 4;
while (num > 3) {
@@ -3050,8 +3071,9 @@ show_background_scan_results_page(unsigned char * resp, int len, int show_pcb,
printf(" sense key: %s [sk,asc,ascq: 0x%x,0x%x,0x%x]\n",
sg_get_sense_key_str(ucp[8] & 0xf, sizeof(str), str),
ucp[8] & 0xf, ucp[9], ucp[10]);
- printf(" %s\n", sg_get_asc_ascq_str(ucp[9], ucp[10],
- sizeof(str), str));
+ if (ucp[9] || ucp[10])
+ printf(" %s\n", sg_get_asc_ascq_str(ucp[9], ucp[10],
+ sizeof(str), str));
if (verbose) {
printf(" vendor bytes [11 -> 15]: ");
for (m = 0; m < 5; ++m)
@@ -3428,6 +3450,7 @@ show_tape_diag_data_page(unsigned char * resp, int len, int show_pcb)
unsigned int v;
unsigned char * ucp;
char str[PCB_STR_LEN];
+ char b[80];
printf("Tape diagnostics data page (ssc-3) [0x16]\n");
num = len - 4;
@@ -3440,11 +3463,16 @@ show_tape_diag_data_page(unsigned char * resp, int len, int show_pcb)
printf(" Density code: 0x%x\n", ucp[6]);
printf(" Medium type: 0x%x\n", ucp[7]);
v = (ucp[8] << 24) + (ucp[9] << 16) + (ucp[10] << 8) + ucp[11];
- printf(" Lifetime media motion hours: 0x%x\n", v);
+ printf(" Lifetime media motion hours: %u\n", v);
printf(" Repeat: %d\n", !!(ucp[13] & 0x80));
- printf(" Sense key: 0x%x\n", ucp[13] & 0xf);
+ v = ucp[13] & 0xf;
+ printf(" Sense key: 0x%x [%s]\n", v,
+ sg_get_sense_key_str(v, sizeof(b), b));
printf(" Additional sense code: 0x%x\n", ucp[14]);
printf(" Additional sense code qualifier: 0x%x\n", ucp[15]);
+ if (ucp[14] || ucp[15])
+ printf(" [%s]\n", sg_get_asc_ascq_str(ucp[14], ucp[15],
+ sizeof(b), b));
v = (ucp[16] << 24) + (ucp[17] << 16) + (ucp[18] << 8) + ucp[19];
printf(" Vendor specific code qualifier: 0x%x\n", v);
v = (ucp[20] << 24) + (ucp[21] << 16) + (ucp[22] << 8) + ucp[23];
@@ -3480,6 +3508,7 @@ show_mchanger_diag_data_page(unsigned char * resp, int len, int show_pcb)
unsigned int v;
unsigned char * ucp;
char str[PCB_STR_LEN];
+ char b[80];
printf("Media changer diagnostics data page (smc-3) [0x16]\n");
num = len - 4;
@@ -3490,9 +3519,14 @@ show_mchanger_diag_data_page(unsigned char * resp, int len, int show_pcb)
pl = ucp[3] + 4;
printf(" Parameter code: %d\n", pc);
printf(" Repeat: %d\n", !!(ucp[5] & 0x80));
- printf(" Sense key: 0x%x\n", ucp[5] & 0xf);
+ v = ucp[5] & 0xf;
+ printf(" Sense key: 0x%x [%s]\n", v,
+ sg_get_sense_key_str(v, sizeof(b), b));
printf(" Additional sense code: 0x%x\n", ucp[6]);
printf(" Additional sense code qualifier: 0x%x\n", ucp[7]);
+ if (ucp[6] || ucp[7])
+ printf(" [%s]\n", sg_get_asc_ascq_str(ucp[6], ucp[7],
+ sizeof(b), b));
v = (ucp[8] << 24) + (ucp[9] << 16) + (ucp[10] << 8) + ucp[11];
printf(" Vendor specific code qualifier: 0x%x\n", v);
v = (ucp[12] << 24) + (ucp[13] << 16) + (ucp[14] << 8) + ucp[15];
@@ -4009,7 +4043,8 @@ show_ascii_page(unsigned char * resp, int len,
subpg_code = spf ? resp[1] : 0;
if ((SUPP_PAGES_LPAGE != pg_code ) && (SUPP_SPGS_SUBPG == subpg_code)) {
- printf("Supported subpages for log page=0x%x\n", pg_code);
+ printf("Supported subpages for log page=0x%x (spc-4) [0x%x, 0x%x]"
+ "\n", pg_code, pg_code, subpg_code);
for (k = 0; k < num; k += 2)
show_page_name((int)resp[4 + k], (int)resp[4 + k + 1],
inq_dat);
@@ -4018,12 +4053,13 @@ show_ascii_page(unsigned char * resp, int len,
switch (pg_code) {
case SUPP_PAGES_LPAGE: /* 0x0 */
if (spf) {
- printf("Supported log pages and subpages:\n");
+ printf("Supported log pages and subpages (spc-4) [0x%x, 0x%x]:"
+ "\n", pg_code, subpg_code);
for (k = 0; k < num; k += 2)
show_page_name((int)resp[4 + k], (int)resp[4 + k + 1],
inq_dat);
} else {
- printf("Supported log pages:\n");
+ printf("Supported log pages (spc-2) [0x0]:\n");
for (k = 0; k < num; ++k)
show_page_name((int)resp[4 + k], 0, inq_dat);
}
@@ -4238,8 +4274,12 @@ show_ascii_page(unsigned char * resp, int len,
break;
}
if (! done) {
- printf("No ascii information for page = 0x%x, here is hex:\n",
- resp[0] & 0x3f);
+ if (spf)
+ printf("No ascii information for page = 0x%x, subpage = 0x%x, "
+ "here is hex:\n", pg_code, subpg_code);
+ else
+ printf("No ascii information for page = 0x%x, here is hex:\n",
+ pg_code);
if (len > 128) {
dStrHex((const char *)resp, 64, 1);
printf(" ..... [truncated after 64 of %d bytes (use '-H' to "
@@ -4282,8 +4322,8 @@ fetchTemperature(int sg_fd, unsigned char * resp, int max_len,
else
show_ie_page(resp, len, 0, 0);
} else
- fprintf(stderr, "Unable to find temperature in either log page "
- "(temperature or IE)\n");
+ fprintf(stderr, "Unable to find temperature in either "
+ "Temperature or IE log page\n");
}
sg_cmds_close_device(sg_fd);
return (res >= 0) ? res : SG_LIB_CAT_OTHER;