~ubuntu-branches/ubuntu/dapper/sg3-utils/dapper-backports

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
.TH SG_MODES "8" "June 2006" "sg3_utils-1.21" SG3_UTILS
.SH NAME
sg_modes \- reads SCSI MODE SENSE pages
.SH SYNOPSIS
.B sg_modes
[\fI-a\fR] [\fI-A\fR] [\fI-c=<page_control>\fR] [\fI-d\fR] [\fI-D\fR]
[\fI-e\fR] [\fI-f\fR] [\fI-h\fR] [\fI-H\fR] [\fI-l\fR] [\fI-L\fR]
[\fI-p=<page_code>\fR] [\fI-p=<page_code>,<sub_page_code>\fR]
[\fI-r\fR] [\fI-subp=<sub_page_code>\fR] [\fI-v\fR] [\fI-V\fR] [\fI-6\fR]
[\fI-?\fR] [\fI<scsi_device>\fR]
.SH DESCRIPTION
.\" Add any additional description here
.PP
This utility sends a MODE SENSE SCSI command (the 10 byte variant
by default) to the given device and then outputs the response. There
is no facility to change the page or descriptor data with this utility.
If no page is given (and '-l' is not selected) then '-a' is assumed.
.TP
-a
output all the mode pages supported by the given device.
.TP
-A
output all the mode pages and subpages supported by the device.
.TP
-c=page_control
up to four different versions of each page are held by the device:
the current values [0] (i.e. those active at the moment), the changeable
values [1] (bit mask showing which sections could be changed with a MODE
SELECT), default values [2] (the manufacturer's settings) and saved
values [3] (the values that will be re-instated the next time the device
is power cycled). If this option is not given then current values [0]
are assumed.
.TP
-d
disable block descriptors. By default, block descriptors (usually one or
none) are returned in a MODE SENSE response. This option sets the "disable
block descriptors" (DBD) bit in the cdb which instructs the device not
to return any block descriptors in its response. Older devices may not
support this setting and should return an "illegal request" status;
alternatively they may ignore it.
.TP
-D
disable outputting block descriptors. Irrespective of whether block
descriptors are present in the response or not, they are not output.
.TP
-e
examine each mode page in the range 0 through to 62 (inclusive).
If some response is given print out the mode page name or number (in hex)
if the name is not known.
.TP
-f
Be "flexible". Some devices, bridges and/or drivers attempt crude
switches between mode sense 6 and 10 byte commands without correcting
the response. This will cause the response to be mis-interpreted (usually
with an error saying the response is malformed). With this option, the
length of the response is checked, and if it looks wrong, the response
is then decoded as if the other mode sense (cdb length) was sent.
.TP
-h
The default action is to decode known mode page numbers (and subpage
numbers) into text. With this option mode page numbers (and subpage
numbers) are output in hexadecimal.
.TP
-H
same action as the '-h' option.
.TP
-l
lists all common page and subpage codes and their names that are found in
the command set that matches the peripheral type of the given device.
If no device and no page_code is given then the common page and
subpage codes and their names for the disk command set are listed.
If no device is given and a page_code is given then the common page and
subpage codes and their names for the command set whose peripheral device
type matches the value given to page_code are listed. For
example 'sg_mode -l -p=1' lists the command mode pages and subpages for tape
devices. Additionally if a sub_page_code is given then it is interpreted as
a transport identifier and command transport specific mode page codes and
their names are listed following the main mode page list.
Other options are ignored.
.TP
-L
set the Long LBA Accepted (LLBAA) bit in the MODE SENSE (10) cdb. This
bit is not defined in the MODE SENSE (6) cdb so setting the '-L'
and '-6' options is reported as an error. When set the given device
may respond with 16 byte block descriptors as indicated by
the 'LongLBA' field in the response. In almost all cases setting
this option is not needed.
.TP
-p=<page_code>
page code to fetch. Should be a hexadecimal number between 0 and 3f
inclusive (0 to 63 decimal). The default value is 0.
.TP
-p=<page_code>,<sub_page_code>
page code and subpage code values to fetch. The page code should be a
hexadecimal number between 0 and 3f inclusive. The subpage code should
be a hexadecimal number between 0 and ff inclusive. The default value
of both is 0.
.TP
-r
output the selected mode page to stdout a byte per line. Each line contains
two hexadecimal digits (e.g. "0a"). Useful as input (after editing) to
the sg_wr_mode utility.
.TP
-subp=<sub_page_code>
sub page code to fetch. Should be a hexadecimal number between 0 and 
0xff inclusive. The default value is 0.
.TP
-v
verbose: output cdbs in hex before executing them. '-vv'
and '-vvv' are also accepted yielding greater verbosity.
.TP
-V
print out version string
.TP
-6
by default this utility sends out a 10 byte MODE SENSE command. However
some SCSI devices only support 6 byte MODE SENSE commands (e.g. SCSI-2
tape drives). This parameter forces the use of 6 byte MODE SENSE commands.
.TP
-?
output usage message. Ignore all other parameters.
.PP
If the normal sg_modes utility fails with "illegal command
operation code" then try the "-6" parameter.
.PP
Mode pages cannot be modified with this utility. Mode pages (and subpages)
can be modified with the sg_wr_mode and sginfo utilities in the sg3_utils
package. See this sdparm utility and those other utilities that are
listed in the "SEE ALSO" section below.
.PP
This utility performs a SCSI INQUIRY command to determine the peripheral
type of the device (e.g. 0 -> Direct Access Device (disk)) prior to
sending a MODE SENSE command. This helps in decoding the block
descriptor and mode pages.
.PP
In the 2.4 series of Linux kernels the given device must be
a SCSI generic (sg) device. In the 2.6 series block devices (e.g. disks
and SCSI DVDs) can also be specified. For example "sg_modes -a /dev/sda"
will work in the 2.6 series kernels.
.SH EXIT STATUS
The exit status of sg_modes is 0 when it is successful. Otherwise see
the sg3_utils(8) man page.
.SH AUTHOR
Written by Doug Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
Copyright \(co 2000-2006 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.
.SH "SEE ALSO"
.B sdparm(net), sg_wr_mode(sg3_utils), sginfo(sg3_utils),
.B sgmode(scsirastools), scsiinfo(net), scu(net),
.B seatools(seagate)
.PP
All these utilities offer some facility to change mode page (or block
descriptor) parameters.