From ff4da0015d44cf5545ec6a75c417910a571bbb05 Mon Sep 17 00:00:00 2001 From: Douglas Gilbert Date: Tue, 28 Apr 2015 18:08:10 +0000 Subject: sg_senddiag: add support for -HHH; autogen.sh: to buildconf 20091223 git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@642 6180dd3e-e324-4e3e-922d-17de1ae2f315 --- ChangeLog | 4 +- README | 2 +- autogen.sh | 287 +++++++++++++++++++++++++++++++++++------------------- debian/changelog | 2 +- doc/sg_senddiag.8 | 13 ++- sg3_utils.spec | 2 +- src/sg_inq.c | 5 +- src/sg_senddiag.c | 15 ++- 8 files changed, 216 insertions(+), 114 deletions(-) diff --git a/ChangeLog b/ChangeLog index d64c5c1b..2707ec1e 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.41 [20150410] [svn: r641] +Changelog for sg3_utils-1.41 [20150428] [svn: r642] - sg_zone: new utility for open, close and finish zone commands introduced in zbc-r02 - sg_rep_zones and sg_reset_wp: change opcodes as @@ -25,6 +25,7 @@ Changelog for sg3_utils-1.41 [20150410] [svn: r641] alignment value; spc5r02 additions - sg_readcap: add support for ZBC's rc_basis field - sg_senddiag: fix bug with --raw option + - add support for -HHH for output suitable for --raw - sg_ses: enclosure element: add failure and warning acronyms, fix warning indication output - additional element status dpage: add PCIe/NVMe @@ -44,6 +45,7 @@ Changelog for sg3_utils-1.41 [20150410] [svn: r641] - examples/sg-simple_aio.c: remove - sg_lib_data: sync asc/ascq codes with T10 20150406 - Makefile cleanup + - autogen.sh: upgrade to buildconf 20091223 version Changelog for sg3_utils-1.40 [20141110] [svn: r620] - sg_write_verify: new utility for WRITE AND VERIFY diff --git a/README b/README index 7c180b1b..151293a8 100644 --- a/README +++ b/README @@ -412,4 +412,4 @@ See http://sg.danny.cz/sg/tools.html Douglas Gilbert -10th April 2015 +28th April 2015 diff --git a/autogen.sh b/autogen.sh index 7a9c5ef7..5bce9bab 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,7 +1,7 @@ #!/bin/sh # a u t o g e n . s h # -# Copyright (c) 2005-2007 United States Government as represented by +# Copyright (c) 2005-2009 United States Government as represented by # the U.S. Army Research Laboratory. # # Redistribution and use in source and binary forms, with or without @@ -35,7 +35,7 @@ ### # # Script for automatically preparing the sources for compilation by -# performing the myrid of necessary steps. The script attempts to +# performing the myriad of necessary steps. The script attempts to # detect proper version support, and outputs warnings about particular # systems that have autotool peculiarities. # @@ -69,19 +69,23 @@ # To verbosely try running with an older (unsupported) autoconf: # AUTOCONF_VERSION=2.50 ./autogen.sh --verbose # -# Author: Christopher Sean Morrison +# Author: +# Christopher Sean Morrison +# +# Patches: +# Sebastian Pipping # ###################################################################### -# set to minimum acceptible version of autoconf +# set to minimum acceptable version of autoconf if [ "x$AUTOCONF_VERSION" = "x" ] ; then AUTOCONF_VERSION=2.52 fi -# set to minimum acceptible version of automake +# set to minimum acceptable version of automake if [ "x$AUTOMAKE_VERSION" = "x" ] ; then AUTOMAKE_VERSION=1.6.0 fi -# set to minimum acceptible version of libtool +# set to minimum acceptable version of libtool if [ "x$LIBTOOL_VERSION" = "x" ] ; then LIBTOOL_VERSION=1.4.2 fi @@ -98,13 +102,14 @@ ident ( ) { fi # extract version from CVS Id string - __id="$Id: autogen.sh,v 14.97 2007/06/18 22:25:02 brlcad Exp $" + __id="$Id: autogen.sh 33925 2009-03-01 23:27:06Z brlcad $" __version="`echo $__id | sed 's/.*\([0-9][0-9][0-9][0-9]\)[-\/]\([0-9][0-9]\)[-\/]\([0-9][0-9]\).*/\1\2\3/'`" if [ "x$__version" = "x" ] ; then __version="" fi echo "autogen.sh build preparation script by Christopher Sean Morrison" + echo " + config.guess download patch by Sebastian Pipping (2008-12-03)" echo "revised 3-clause BSD-style license, copyright (c) $__copyright" echo "script version $__version, ISO/IEC 9945 POSIX shell script" } @@ -114,11 +119,12 @@ ident ( ) { # USAGE FUNCTION # ################## usage ( ) { - echo "Usage: $AUTOGEN_SH [-h|--help] [-v|--verbose] [-q|--quiet] [--version]" - echo " --help Help on $NAME_OF_AUTOGEN usage" - echo " --verbose Verbose progress output" - echo " --quiet Quiet suppressed progress output" - echo " --version Only perform GNU Build System version checks" + echo "Usage: $AUTOGEN_SH [-h|--help] [-v|--verbose] [-q|--quiet] [-d|--download] [--version]" + echo " --help Help on $NAME_OF_AUTOGEN usage" + echo " --verbose Verbose progress output" + echo " --quiet Quiet suppressed progress output" + echo " --download Download the latest config.guess from gnulib" + echo " --version Only perform GNU Build System version checks" echo echo "Description: This script will validate that minimum versions of the" echo "GNU Build System tools are installed and then run autoreconf for you." @@ -268,6 +274,9 @@ fi if [ "x$VERSION_ONLY" = "x" ] ; then VERSION_ONLY=no fi +if [ "x$DOWNLOAD" = "x" ] ; then + DOWNLOAD=no +fi if [ "x$AUTORECONF_OPTIONS" = "x" ] ; then AUTORECONF_OPTIONS="-i -f" fi @@ -288,6 +297,9 @@ fi if [ "x$AUTOHEADER_OPTIONS" = "x" ] ; then AUTOHEADER_OPTIONS="" fi +if [ "x$CONFIG_GUESS_URL" = "x" ] ; then + CONFIG_GUESS_URL="http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/config.guess;hb=HEAD" +fi for arg in $ARGS ; do case "x$arg" in x--help) HELP=yes ;; @@ -295,6 +307,8 @@ for arg in $ARGS ; do x--quiet) QUIET=yes ;; x-[qQ]) QUIET=yes ;; x--verbose) VERBOSE=yes ;; + x-[dD]) DOWNLOAD=yes ;; + x--download) DOWNLOAD=yes ;; x-[vV]) VERBOSE=yes ;; x--version) VERSION_ONLY=yes ;; *) @@ -584,7 +598,7 @@ else _version="0.0.0" fi $ECHO "Found GNU Automake version $_version" - version_check "$AUTOMAKE_VERSION" "$_version" + version_check "$AUTOMAKE_VERSION" "$_version" if [ $? -ne 0 ] ; then _report_error=yes fi @@ -686,7 +700,7 @@ else _version="0.0.0" fi $ECHO "Found GNU Libtool version $_version" - version_check "$LIBTOOL_VERSION" "$_version" + version_check "$LIBTOOL_VERSION" "$_version" if [ $? -ne 0 ] ; then _report_error=yes fi @@ -756,24 +770,17 @@ protect_from_clobber ( ) { # prevalent behavior, so we protect against it by keeping a backup # of the file that can later be restored. - if test -f COPYING ; then - if test -f COPYING.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "Already backed up COPYING in `pwd`" - else - $VERBOSE_ECHO "Backing up COPYING in `pwd`" - $VERBOSE_ECHO "cp -p COPYING COPYING.$$.protect_from_automake.backup" - cp -p COPYING COPYING.$$.protect_from_automake.backup - fi - fi - if test -f INSTALL ; then - if test -f INSTALL.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "Already backed up INSTALL in `pwd`" - else - $VERBOSE_ECHO "Backing up INSTALL in `pwd`" - $VERBOSE_ECHO "cp -p INSTALL INSTALL.$$.protect_from_automake.backup" - cp -p INSTALL INSTALL.$$.protect_from_automake.backup + for file in COPYING INSTALL ; do + if test -f ${file} ; then + if test -f ${file}.$$.protect_from_automake.backup ; then + $VERBOSE_ECHO "Already backed up ${file} in `pwd`" + else + $VERBOSE_ECHO "Backing up ${file} in `pwd`" + $VERBOSE_ECHO "cp -p ${file} ${file}.$$.protect_from_automake.backup" + cp -p ${file} ${file}.$$.protect_from_automake.backup + fi fi - fi + done } @@ -840,57 +847,32 @@ restore_clobbered ( ) { spacer=no - # COPYING - if test -f COPYING.$$.protect_from_automake.backup ; then - if test -f COPYING ; then - # compare entire content, restore if needed - if test "x`cat COPYING`" != "x`cat COPYING.$$.protect_from_automake.backup`" ; then - if test "x$spacer" = "xno" ; then - $VERBOSE_ECHO - spacer=yes - fi - # restore the backup - $VERBOSE_ECHO "Restoring COPYING from backup (automake -f likely clobbered it)" - $VERBOSE_ECHO "rm -f COPYING" - rm -f COPYING - $VERBOSE_ECHO "mv COPYING.$$.protect_from_automake.backup COPYING" - mv COPYING.$$.protect_from_automake.backup COPYING - fi # check contents - elif test -f COPYING.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "mv COPYING.$$.protect_from_automake.backup COPYING" - mv COPYING.$$.protect_from_automake.backup COPYING - fi # -f COPYING - - # just in case - $VERBOSE_ECHO "rm -f COPYING.$$.protect_from_automake.backup" - rm -f COPYING.$$.protect_from_automake.backup - fi # -f COPYING.$$.protect_from_automake.backup - - # INSTALL - if test -f INSTALL.$$.protect_from_automake.backup ; then - if test -f INSTALL ; then + for file in COPYING INSTALL ; do + if test -f ${file}.$$.protect_from_automake.backup ; then + if test -f ${file} ; then # compare entire content, restore if needed - if test "x`cat INSTALL`" != "x`cat INSTALL.$$.protect_from_automake.backup`" ; then + if test "x`cat ${file}`" != "x`cat ${file}.$$.protect_from_automake.backup`" ; then if test "x$spacer" = "xno" ; then $VERBOSE_ECHO spacer=yes fi # restore the backup - $VERBOSE_ECHO "Restoring INSTALL from backup (automake -f likely clobbered it)" - $VERBOSE_ECHO "rm -f INSTALL" - rm -f INSTALL - $VERBOSE_ECHO "mv INSTALL.$$.protect_from_automake.backup INSTALL" - mv INSTALL.$$.protect_from_automake.backup INSTALL + $VERBOSE_ECHO "Restoring ${file} from backup (automake -f likely clobbered it)" + $VERBOSE_ECHO "rm -f ${file}" + rm -f ${file} + $VERBOSE_ECHO "mv ${file}.$$.protect_from_automake.backup ${file}" + mv ${file}.$$.protect_from_automake.backup ${file} fi # check contents - elif test -f INSTALL.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "mv INSTALL.$$.protect_from_automake.backup INSTALL" - mv INSTALL.$$.protect_from_automake.backup INSTALL - fi # -f INSTALL - - # just in case - $VERBOSE_ECHO "rm -f INSTALL.$$.protect_from_automake.backup" - rm -f INSTALL.$$.protect_from_automake.backup - fi # -f INSTALL.$$.protect_from_automake.backup + elif test -f ${file}.$$.protect_from_automake.backup ; then + $VERBOSE_ECHO "mv ${file}.$$.protect_from_automake.backup ${file}" + mv ${file}.$$.protect_from_automake.backup ${file} + fi # -f ${file} + + # just in case + $VERBOSE_ECHO "rm -f ${file}.$$.protect_from_automake.backup" + rm -f ${file}.$$.protect_from_automake.backup + fi # -f ${file}.$$.protect_from_automake.backup + done CONFIGURE="`locate_configure_template`" if [ "x$CONFIGURE" = "x" ] ; then @@ -1003,15 +985,50 @@ initialize ( ) { fi done - ########################################## - # make sure certain required files exist # - ########################################## - for file in AUTHORS COPYING ChangeLog INSTALL NEWS README ; do - if test ! -f $file ; then - $VERBOSE_ECHO "Touching ${file} since it does not exist" - touch $file + ########################################################### + # make sure certain required files exist for GNU projects # + ########################################################### + _marker_found="" + _marker_found_message_intro='Detected non-GNU marker "' + _marker_found_message_mid='" in ' + for marker in foreign cygnus ; do + _marker_found_message=${_marker_found_message_intro}${marker}${_marker_found_message_mid} + _marker_found="`grep 'AM_INIT_AUTOMAKE.*'${marker} $CONFIGURE`" + if [ ! "x$_marker_found" = "x" ] ; then + $VERBOSE_ECHO "${_marker_found_message}`basename \"$CONFIGURE\"`" + break + fi + if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then + _marker_found="`grep 'AUTOMAKE_OPTIONS.*'${marker} Makefile.am`" + if [ ! "x$_marker_found" = "x" ] ; then + $VERBOSE_ECHO "${_marker_found_message}Makefile.am" + break + fi fi done + if [ "x${_marker_found}" = "x" ] ; then + _suggest_foreign=no + for file in AUTHORS COPYING ChangeLog INSTALL NEWS README ; do + if [ ! -f $file ] ; then + $VERBOSE_ECHO "Touching ${file} since it does not exist" + _suggest_foreign=yes + touch $file + fi + done + + if [ "x${_suggest_foreign}" = "xyes" ] ; then + $ECHO + $ECHO "Warning: Several files expected of projects that conform to the GNU" + $ECHO "coding standards were not found. The files were automatically added" + $ECHO "for you since you do not have a 'foreign' declaration specified." + $ECHO + $ECHO "Considered adding 'foreign' to AM_INIT_AUTOMAKE in `basename \"$CONFIGURE\"`" + if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then + $ECHO "or to AUTOMAKE_OPTIONS in your top-level Makefile.am file." + fi + $ECHO + fi + fi ################################################## # make sure certain generated files do not exist # @@ -1072,6 +1089,75 @@ cd "$START_PATH" initialize +######################################### +# DOWNLOAD_GNULIB_CONFIG_GUESS FUNCTION # +######################################### + +# TODO - should make sure wget/curl exist and/or work before trying to +# use them. + +download_gnulib_config_guess () { + # abuse gitweb to download gnulib's latest config.guess via HTTP + config_guess_temp="config.guess.$$.download" + ret=1 + for __cmd in wget curl fetch ; do + $VERBOSE_ECHO "Checking for command ${__cmd}" + ${__cmd} --version > /dev/null 2>&1 + ret=$? + if [ ! $ret = 0 ] ; then + continue + fi + + __cmd_version=`${__cmd} --version | head -n 1 | sed -e 's/^[^0-9]\+//' -e 's/ .*//'` + $VERBOSE_ECHO "Found ${__cmd} ${__cmd_version}" + + opts="" + case ${__cmd} in + wget) + opts="-O" + ;; + curl) + opts="-o" + ;; + fetch) + opts="-t 5 -f" + ;; + esac + + $VERBOSE_ECHO "Running $__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\"" + eval "$__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\"" > /dev/null 2>&1 + if [ $? = 0 ] ; then + mv -f "${config_guess_temp}" ${_aux_dir}/config.guess + ret=0 + break + fi + done + + if [ ! $ret = 0 ] ; then + $ECHO "Warning: config.guess download failed from: $CONFIG_GUESS_URL" + rm -f "${config_guess_temp}" + fi +} + + +############################## +# LIBTOOLIZE_NEEDED FUNCTION # +############################## +libtoolize_needed () { + ret=1 # means no, don't need libtoolize + for feature in AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT ; do + $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" + found="`grep \"^$feature.*\" $CONFIGURE`" + if [ ! "x$found" = "x" ] ; then + ret=0 # means yes, need to run libtoolize + break + fi + done + return ${ret} +} + + + ############################################ # prepare build via autoreconf or manually # ############################################ @@ -1115,6 +1201,12 @@ if [ "x$HAVE_AUTORECONF" = "xyes" ] ; then $ECHO "Attempting to run the preparation steps individually" reconfigure_manually=yes + else + if [ "x$DOWNLOAD" = "xyes" ] ; then + if libtoolize_needed ; then + download_gnulib_config_guess + fi + fi fi else reconfigure_manually=yes @@ -1193,22 +1285,13 @@ manual_autogen ( ) { ############## # libtoolize # ############## - need_libtoolize=no - for feature in AC_PROG_LIBTOOL LT_INIT ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - need_libtoolize=yes - break - fi - done - if [ "x$need_libtoolize" = "xyes" ] ; then + if libtoolize_needed ; then if [ "x$HAVE_LIBTOOLIZE" = "xyes" ] ; then $VERBOSE_ECHO "$LIBTOOLIZE $LIBTOOLIZE_OPTIONS" libtoolize_output="`$LIBTOOLIZE $LIBTOOLIZE_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$libtoolize_output" - + if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi else if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then @@ -1216,7 +1299,7 @@ manual_autogen ( ) { libtoolize_output="`$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$libtoolize_output" - + if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi fi fi @@ -1244,7 +1327,11 @@ manual_autogen ( ) { $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C" fi fi # ltmain.sh - fi # need_libtoolize + + if [ "x$DOWNLOAD" = "xyes" ] ; then + download_gnulib_config_guess + fi + fi # libtoolize_needed ############ # autoconf # @@ -1264,7 +1351,7 @@ manual_autogen ( ) { macros_to_search="" ac_major="`echo ${AUTOCONF_VERSION}. | cut -d. -f1 | sed 's/[^0-9]//g'`" ac_minor="`echo ${AUTOCONF_VERSION}. | cut -d. -f2 | sed 's/[^0-9]//g'`" - + if [ $ac_major -lt 2 ] ; then macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros" else @@ -1293,7 +1380,7 @@ manual_autogen ( ) { $ECHO $ECHO "Warning: Unsupported macros were found in $CONFIGURE" $ECHO - $ECHO "The `echo $CONFIGURE | basename` file was scanned in order to determine if any" + $ECHO "The `basename \"$CONFIGURE\"` file was scanned in order to determine if any" $ECHO "unsupported macros are used that exceed the minimum version" $ECHO "settings specified within this file. As such, the following macros" $ECHO "should be removed from configure.ac or the version numbers in this" @@ -1337,7 +1424,7 @@ EOF $ECHO " $AUTOGEN_SH --verbose" else $ECHO "reviewing the minimum GNU Autotools version settings contained in" - $ECHO "this script along with the macros being used in your `echo $CONFIGURE | basename` file." + $ECHO "this script along with the macros being used in your `basename \"$CONFIGURE\"` file." fi $ECHO $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C" @@ -1382,7 +1469,7 @@ EOF automake_output="`$AUTOMAKE $AUTOMAKE_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$automake_output" - + if [ ! $ret = 0 ] ; then ################### @@ -1394,7 +1481,7 @@ EOF automake_output="`$AUTOMAKE $ALT_AUTOMAKE_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$automake_output" - + if [ ! $ret = 0 ] ; then # test if libtool is busted libtool_failure "$automake_output" diff --git a/debian/changelog b/debian/changelog index b6ee5b0c..0f7db92d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ sg3-utils (1.41-0.1) unstable; urgency=low * New upstream version - -- Douglas Gilbert Fri, 10 Apr 2015 14:00:00 +0200 + -- Douglas Gilbert Tue, 28 Apr 2015 11:00:00 -0400 sg3-utils (1.40-0.1) unstable; urgency=low diff --git a/doc/sg_senddiag.8 b/doc/sg_senddiag.8 index 76de1dc5..511ec7ed 100644 --- a/doc/sg_senddiag.8 +++ b/doc/sg_senddiag.8 @@ -1,4 +1,4 @@ -.TH SG_SENDDIAG "8" "September 2014" "sg3_utils\-1.40" SG3_UTILS +.TH SG_SENDDIAG "8" "April 2015" "sg3_utils\-1.41" SG3_UTILS .SH NAME sg_senddiag \- performs a SCSI SEND DIAGNOSTIC command .SH SYNOPSIS @@ -49,6 +49,15 @@ print usage message then exit. .TP \fB\-H\fR, \fB\-\-hex\fR outputs response from RECEIVE DIAGNOSTIC RESULTS in hex rather than decode it. +Only the Supported Diagnostic Pages diagnostic page (i.e. page_code=0) is +decoded; other pages (e.g. those used by SES) are output in hex. +.br +If \fI\-\-hex\fR is used once, the hex output has a relative address at the +start of each line. If \fI\-\-hex\fR is used twice, then ASCII is shown to +the right of each line of hex. If \fI\-\-hex\fR is used three time or more, +only the hex is output, in two character pairs (i.e. a byte) space separated +and up to 16 bytes per line. This latter form, if placed in a file or piped +through to another invocation, is suitable for the \fI\-\-raw=\-\fR option. .TP \fB\-l\fR, \fB\-\-list\fR when a \fIDEVICE\fR is also given lists the names of all diagnostic pages @@ -267,7 +276,7 @@ Written by Douglas Gilbert .SH "REPORTING BUGS" Report bugs to . .SH COPYRIGHT -Copyright \(co 2003\-2014 Douglas Gilbert +Copyright \(co 2003\-2015 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/sg3_utils.spec b/sg3_utils.spec index 3a9f23b6..52d9dbe1 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -79,7 +79,7 @@ fi %{_libdir}/*.la %changelog -* Fri Apr 10 2015 - dgilbert at interlog dot com +* Tue Apr 28 2015 - dgilbert at interlog dot com - track t10 changes * sg3_utils-1.41 diff --git a/src/sg_inq.c b/src/sg_inq.c index 8c51af70..1623ccb2 100644 --- a/src/sg_inq.c +++ b/src/sg_inq.c @@ -41,7 +41,7 @@ #include "sg_cmds_basic.h" #include "sg_pt.h" -static const char * version_str = "1.46 20150407"; /* SPC-5 rev 02 */ +static const char * version_str = "1.47 20150421"; /* SPC-5 rev 02 */ /* INQUIRY notes: * It is recommended that the initial allocation length given to a @@ -2358,8 +2358,7 @@ decode_b0_vpd(unsigned char * buff, int len, int do_hex) if (len > 19) { /* added in sbc3r09 */ u = (buff[16] << 24) | (buff[17] << 16) | (buff[18] << 8) | buff[19]; - printf(" Maximum prefetch, xdread, xdwrite transfer length: " - "%u blocks\n", u); + printf(" Maximum prefetch transfer length: %u blocks\n", u); } if (len > 27) { /* added in sbc3r18 */ u = ((unsigned int)buff[20] << 24) | (buff[21] << 16) | diff --git a/src/sg_senddiag.c b/src/sg_senddiag.c index 1a7c6e1e..83013a0e 100644 --- a/src/sg_senddiag.c +++ b/src/sg_senddiag.c @@ -1,5 +1,5 @@ /* A utility program originally written for the Linux OS SCSI subsystem -* Copyright (C) 2003-2014 D. Gilbert +* Copyright (C) 2003-2015 D. Gilbert * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) @@ -27,7 +27,7 @@ #include "sg_unaligned.h" -static const char * version_str = "0.45 20141219"; +static const char * version_str = "0.46 20150427"; #define ME "sg_senddiag: " @@ -89,13 +89,15 @@ usage() " --extdur|-e duration of an extended self-test (from mode " "page 0xa)\n" " --help|-h print usage message then exit\n" - " --hex|-H output in hex\n" + " --hex|-H output RDR in hex; twice: plus ASCII; thrice: " + "suitable\n" + " for '--raw=-' with later invocation\n" " --list|-l list supported page codes (with or without " "DEVICE)\n" " --maxlen=LEN|-m LEN parameter list length or maximum " "allocation\n" " length (default: 4096 bytes)\n" - " --page=PG|-p PG do RECEIVE DIAGNOSTIC RESULTS only, set " + " --page=PG|-P PG do RECEIVE DIAGNOSTIC RESULTS only, set " "PCV\n" " --pf|-p set PF bit (def: 0)\n" " --raw=H,H...|-r H,H... sequence of hex bytes to form " @@ -786,7 +788,10 @@ main(int argc, char * argv[]) ((pg >= 0x0) ? pg : 0), rsp_buff, rsp_buff_size, 1, op->do_verbose)) { rsp_len = sg_get_unaligned_be16(rsp_buff + 2) + 4; - if (pg < 0x1) { + if (op->do_hex > 1) + dStrHex((const char *)rsp_buff, rsp_len, + (2 == op->do_hex) ? 0 : -1); + else if (pg < 0x1) { printf("Supported diagnostic pages response:\n"); if (op->do_hex) dStrHex((const char *)rsp_buff, rsp_len, 1); -- cgit v1.2.3