aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--doc/sg3_utils.886
-rw-r--r--doc/sg_raw.812
-rw-r--r--src/sg_raw.c43
-rw-r--r--src/sg_referrals.c6
5 files changed, 77 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index fe57b42e..e1dffe9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,13 +2,14 @@ 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.30 [20100913] [svn: r356]
+Changelog for sg3_utils-1.30 [20100915] [svn: r357]
- sg_referrals: new utility for REPORT REFERRALS
- sg_inq: update version descriptor list to spc4r26
- sg_lib: sync asc/ascq list to spc4r25 (no change to r26)
- dStrHex(): trim excess trailing spaces
- sg_read_long: add --readonly option (open() is rw)
- sg_raw: add --readonly option (open() is rw)
+ - relax restriction on bidirectional commands
- sg_vpd: rdac vendor page [0xc8] parse corrections
- sg_ses: expand --date (in) buffer to 2048 bytes
- sg_opcodes: add extended parameter data for TMFs (spc4r26)
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index ee9a9237..586d3db8 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -98,6 +98,47 @@ and alternate device names.
Prior to the Linux kernel 2.6 series these utilities could only use
generic device names (e.g. /dev/sg1 ). In almost all cases in the Linux
kernel 2.6 series, any device name can be used by these utilities.
+.SH WINDOWS DEVICE NAMING
+Storage and related devices can have several device names in Windows.
+Probably the most common in the volume name (e.g. "D:"). There are also
+a "class" device names such as "PhysicalDrive<n>", "CDROM<n>"
+and "TAPE<n>". <n> is an integer starting at 0 allocated in ascending
+order as devices are discovered (and sometimes rediscovered).
+.PP
+Some storage devices have a SCSI lower level device name which starts
+with a SCSI (pseudo) adapter name of the form "SCSI<n>:". To this is added
+sub\-addressing in the form of a "bus" number, a "target" identifier and
+a "lun" (logical unit number). The "bus" number is also known as a "PathId".
+These are assembled to form a device name of the
+form: "SCSI<n>:<bus>,<target>,<lun>". The trailing ",<lun>" may be omitted
+in which case a lun of zero is assumed. This lower level device name cannot
+often be used directly since Windows blocks attempts to use it if a class
+driver has "claimed" the device. There are SCSI device types (e.g.
+Automation/Drive interface type) for which there is no class driver. At
+least two transports ("bus types" in Windows jargon): USB and IEEE 1394 do
+not have a "scsi" device names of this form.
+.PP
+In keeping with DOS file system conventions, the various device names
+can be given in upper, lower or mixed case. Since "PhysicalDrive<n>" is
+tedious to write, a shortened form of "PD<n>" is permitted by all
+utilities in this package.
+.PP
+A single device (e.g. a disk) can have many device names. For
+example: "PD0" can also be "C:", "D:" and "SCSI0:0,1,0". The two volume names
+reflect that the disk has two partitions on it. Disk partitions that are
+not recognised by Windows are not usually given a volume name. However
+Vista does show a volume name for a disk which has no partitions recognised
+by it and when selected invites the user to format it (which may be rather
+unfriendly to other OSes).
+.PP
+These utilities assume a given device name is in the Win32 device namespace.
+To make that explicit "\\\\.\\" can be prepended to the device names mentioned
+in this section. Beware that backslash is an escape character in Unix like
+shells and the C programming language. In a shell like Msys (from MinGW)
+each backslash may need to be typed twice.
+.PP
+The sg_scan utility lists out Windows device names in forms that are
+suitable for other utilities in this package to use.
.SH FREEBSD DEVICE NAMING
SCSI disks have block names of the form /dev/da<num> where <num> is an
integer starting at zero. The "da" is replaced by "sa" for SCSI tape
@@ -142,47 +183,6 @@ the 'format' command" advice works but seems a very dangerous way to list
devices. [It does prompt again before doing any damage.] 'devfsadm -Cv'
cleans out the clutter in the /dev/rdsk directory, only leaving what
is "live". The "cfgadm -v" command looks promising.
-.SH WINDOWS DEVICE NAMING
-Storage and related devices can have several device names in Windows.
-Probably the most common in the volume name (e.g. "D:"). There are also
-a "class" device names such as "PhysicalDrive<n>", "CDROM<n>"
-and "TAPE<n>". <n> is an integer starting at 0 allocated in ascending
-order as devices are discovered (and sometimes rediscovered).
-.PP
-Some storage devices have a SCSI lower level device name which starts
-with a SCSI (pseudo) adapter name of the form "SCSI<n>:". To this is added
-sub\-addressing in the form of a "bus" number, a "target" identifier and
-a "lun" (logical unit number). The "bus" number is also known as a "PathId".
-These are assembled to form a device name of the
-form: "SCSI<n>:<bus>,<target>,<lun>". The trailing ",<lun>" may be omitted
-in which case a lun of zero is assumed. This lower level device name cannot
-often be used directly since Windows blocks attempts to use it if a class
-driver has "claimed" the device. There are SCSI device types (e.g.
-Automation/Drive interface type) for which there is no class driver. At
-least two transports ("bus types" in Windows jargon): USB and IEEE 1394 do
-not have a "scsi" device names of this form.
-.PP
-In keeping with DOS file system conventions, the various device names
-can be given in upper, lower or mixed case. Since "PhysicalDrive<n>" is
-tedious to write, a shortened form of "PD<n>" is permitted by all
-utilities in this package.
-.PP
-A single device (e.g. a disk) can have many device names. For
-example: "PD0" can also be "C:", "D:" and "SCSI0:0,1,0". The two volume names
-reflect that the disk has two partitions on it. Disk partitions that are
-not recognised by Windows are not usually given a volume name. However
-Vista does show a volume name for a disk which has no partitions recognised
-by it and when selected invites the user to format it (which may be rather
-unfriendly to other OSes).
-.PP
-These utilities assume a given device name is in the Win32 device namespace.
-To make that explicit "\\\\.\\" can be prepended to the device names mentioned
-in this section. Beware that backslash is an escape character in Unix like
-shells and the C programming language. In a shell like Msys (from MinGW)
-each backslash may need to be typed twice.
-.PP
-The sg_scan utility lists out Windows device names in forms that are
-suitable for other utilities in this package to use.
.SH EXIT STATUS
To aid scripts that call these utilities, the exit status is set to indicate
success (0) or failure (1 or more). Note that some of the lower values
@@ -382,7 +382,9 @@ Some utilities that the author has found useful have been placed in
the 'utils' subdirectory.
.SH WEB SITE
There is a web page discussing this package at
-http://sg.danny.cz/sg/sg3_utils.html .
+http://sg.danny.cz/sg/sg3_utils.html . The device naming used by this
+package on various operating system is discussed in the page:
+http://sg.danny.cz/sg/device_name.html .
.SH AUTHORS
Written by Douglas Gilbert. Some utilities have been contributed, see the
CREDITS file and individual source files (in the 'src' directory).
diff --git a/doc/sg_raw.8 b/doc/sg_raw.8
index 6600de33..38596433 100644
--- a/doc/sg_raw.8
+++ b/doc/sg_raw.8
@@ -7,7 +7,10 @@ sg_raw \- sends an arbitrary SCSI command to a device
This utility sends an arbitrary SCSI command (between 6 and 256 bytes) to
the \fIDEVICE\fR. There may be no associated data transfer; or data may be
read from a file and sent to the \fIDEVICE\fR; or data may be received from
-the \fIDEVICE\fR and then displayed or written to a file.
+the \fIDEVICE\fR and then displayed or written to a file. If supported
+by the pass through, bidirectional commands may be sent (i.e. containing
+both data to be sent to the \fIDEVICE\fR and received from the
+\fIDEVICE\fR).
.PP
The SCSI command may be between 6 and 256 bytes long. Each command byte is
specified in plain hex format (00..FF) without a prefix or suffix. See
@@ -44,7 +47,7 @@ This option is ignored if \fB\-\-request\fR is not specified.
\fB\-r\fR, \fB\-\-request\fR=\fIRLEN\fR
Expect to receive up to \fIRLEN\fR bytes of data from the \fIDEVICE\fR.
\fIRLEN\fR may be suffixed with 'k' to use kilobytes (1024 bytes) instead
-of bytes. This option and \fB\-\-send\fR are mutually exclusive.
+of bytes.
.TP
\fB\-R\fR, \fB\-\-readonly\fR
Open \fIDEVICE\fR read-only. The default (without this option) is to open
@@ -52,8 +55,7 @@ it read-write.
.TP
\fB\-s\fR, \fB\-\-send\fR=\fISLEN\fR
Read \fISLEN\fR bytes of data, either from stdin or from a file, and send
-them to the \fIDEVICE\fR. This option and \fB\-\-request\fR are mutually
-exclusive.
+them to the \fIDEVICE\fR.
.TP
\fB\-t\fR, \fB\-\-timeout\fR=\fISEC\fR
Wait up to \fISEC\fR seconds for command completion (default: 20).
@@ -75,7 +77,7 @@ Product Pages of a devices which may contain useful information.
.PP
The ability to send more than a 16 byte CDB (in some cases 12 byte CDB)
may be restricted by the pass-through interface, the low level driver
-or the transport. Bidirectional data commands are no yet supported.
+or the transport.
.SH EXAMPLES
These examples use Linux device names. For suitable device names in
other supported Operating Systems see the sg3_utils(8) man page.
diff --git a/src/sg_raw.c b/src/sg_raw.c
index 96c8c696..20632915 100644
--- a/src/sg_raw.c
+++ b/src/sg_raw.c
@@ -25,7 +25,7 @@
#include "sg_lib.h"
#include "sg_pt.h"
-#define SG_RAW_VERSION "0.4.1 (2010-04-29)"
+#define SG_RAW_VERSION "0.4.2 (2010-09-15)"
#define DEFAULT_TIMEOUT 20
#define MIN_SCSI_CDBSZ 6
@@ -98,18 +98,19 @@ usage()
" -n, --nosense Don't display sense information\n"
" -o, --outfile=OFILE Write binary data to OFILE (def: "
"hexdump to stdout)\n"
- " -r, --request=RLEN Request up to RLEN bytes of data\n"
+ " -r, --request=RLEN Request up to RLEN bytes of data "
+ "(data-in)\n"
" -R, --readonly Open DEVICE read-only (default: "
"read-write)\n"
- " -s, --send=SLEN Send SLEN bytes of data\n"
+ " -s, --send=SLEN Send SLEN bytes of data (data-out)\n"
" -t, --timeout=SEC Timeout in seconds (default: 20)\n"
" -v, --verbose Increase verbosity\n"
" -V, --version Show version information and exit\n"
"\n"
- "Between 6 and 256 command bytes (two hex digits each) can be\n"
- "specified and will be sent to DEVICE.\n"
- "\n"
- "Example: Perform INQUIRY on /dev/sg0:\n"
+ "Between 6 and 256 command bytes (two hex digits each) can be "
+ "specified\nand will be sent to DEVICE. Bidirectional commands "
+ "accepted.\n\n"
+ "Simple example: Perform INQUIRY on /dev/sg0:\n"
" sg_raw -r 1k /dev/sg0 12 00 00 00 60 00\n");
}
@@ -196,11 +197,6 @@ process_cl(struct opts_t *optsp, int argc, char *argv[])
}
}
- if (optsp->do_datain && optsp->do_dataout) {
- fprintf(stderr, "Can't use '--request' and '--send' together\n");
- return SG_LIB_SYNTAX_ERROR;
- }
-
if (optind >= argc) {
fprintf(stderr, "No device specified\n");
return SG_LIB_SYNTAX_ERROR;
@@ -390,7 +386,8 @@ main(int argc, char *argv[])
int sg_fd = -1;
struct sg_pt_base *ptvp = NULL;
unsigned char sense_buffer[32];
- unsigned char *dxfer_buffer = NULL;
+ unsigned char * dxfer_buffer_in = NULL;
+ unsigned char * dxfer_buffer_out = NULL;
unsigned char *wrkBuf = NULL;
memset(&opts, 0, sizeof(opts));
@@ -430,20 +427,21 @@ main(int argc, char *argv[])
set_scsi_pt_sense(ptvp, sense_buffer, sizeof(sense_buffer));
if (opts.do_dataout) {
- dxfer_buffer = fetch_dataout(&opts);
- if (dxfer_buffer == NULL) {
+ dxfer_buffer_out = fetch_dataout(&opts);
+ if (dxfer_buffer_out == NULL) {
ret = SG_LIB_CAT_OTHER;
goto done;
}
- set_scsi_pt_data_out(ptvp, dxfer_buffer, opts.dataout_len);
- } else if (opts.do_datain) {
- dxfer_buffer = my_memalign(opts.datain_len, &wrkBuf);
- if (dxfer_buffer == NULL) {
+ set_scsi_pt_data_out(ptvp, dxfer_buffer_out, opts.dataout_len);
+ }
+ if (opts.do_datain) {
+ dxfer_buffer_in = my_memalign(opts.datain_len, &wrkBuf);
+ if (dxfer_buffer_in == NULL) {
perror("malloc");
ret = SG_LIB_CAT_OTHER;
goto done;
}
- set_scsi_pt_data_in(ptvp, dxfer_buffer, opts.datain_len);
+ set_scsi_pt_data_in(ptvp, dxfer_buffer_in, opts.datain_len);
}
ret = do_scsi_pt(ptvp, sg_fd, opts.timeout, opts.do_verbose);
@@ -488,7 +486,7 @@ main(int argc, char *argv[])
} else {
if (opts.datain_file == NULL && !opts.datain_binary) {
fprintf(stderr, "Received %d bytes of data:\n", data_len);
- dStrHex((const char *)dxfer_buffer, data_len, 0);
+ dStrHex((const char *)dxfer_buffer_in, data_len, 0);
} else {
const char * cp = "stdout";
@@ -498,7 +496,8 @@ main(int argc, char *argv[])
cp = opts.datain_file;
fprintf(stderr, "Writing %d bytes of data to %s\n", data_len,
cp);
- ret = write_dataout(opts.datain_file, dxfer_buffer, data_len);
+ ret = write_dataout(opts.datain_file, dxfer_buffer_in,
+ data_len);
if (ret != 0)
goto done;
}
diff --git a/src/sg_referrals.c b/src/sg_referrals.c
index 248faa96..a4f6462d 100644
--- a/src/sg_referrals.c
+++ b/src/sg_referrals.c
@@ -29,7 +29,7 @@
* SCSI device.
*/
-static char * version_str = "1.03 20100812"; /* sbc3r24 */
+static char * version_str = "1.03 20100813"; /* sbc3r24 */
#define MAX_REFER_BUFF_LEN (1024 * 1024)
#define DEF_REFER_BUFF_LEN 256
@@ -105,8 +105,8 @@ usage()
" (def: 0 -> %d bytes)\n",
DEF_REFER_BUFF_LEN );
fprintf(stderr,
- " --one-segment|-s return information about the specified\n"
- " segment only\n"
+ " --one-segment|-s return information about the specified "
+ "segment only\n"
" --raw|-r output in binary\n"
" --verbose|-v increase verbosity\n"
" --version|-V print version string and exit\n\n"