aboutsummaryrefslogtreecommitdiff
path: root/doc/sg_vpd.8
blob: 94dad610707ee556f0d084888fde9d1a202f493d (plain)
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
.TH SG_VPD "8" "October 2011" "sg3_utils\-1.33" SG3_UTILS
.SH NAME
sg_vpd \- fetches Vital Product Data (VPD) pages using a SCSI INQUIRY command
.SH SYNOPSIS
.B sg_vpd
[\fI\-\-enumerate\fR] [\fI\-\-help\fR] [\fI\-\-hex\fR] [\fI\-\-ident\fR]
[\fI\-\-long\fR] [\fI\-\-maxlen=LEN\fR] [\fI\-\-page=PG\fR]
[\fI\-\-quiet\fR] [\fI\-\-raw\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR]
\fIDEVICE\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
This utility fetches a Vital Product Data page and decodes it or
outputs it in ASCII hexadecimal or binary. VPD pages are fetched
with a SCSI INQUIRY command.
.PP
Probably the most important page is the Device Identification
VPD page (page number: 0x83). Since SPC\-3, support for this page
has been flagged as mandatory. This page can be fetched by
using the \fI\-\-ident\fR option.
.PP
When no options are given, other than a \fIDEVICE\fR, then the "Supported
VPD pages" (0x0) VPD page is fetched and decoded.
.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\-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 after
listing the VPD page names.
.TP
\fB\-h\fR, \fB\-\-help\fR
outputs the usage message summarizing command line options then exits.
Ignores \fIDEVICE\fR if given.
.TP
\fB\-H\fR, \fB\-\-hex\fR
outputs the requested VPD page in ASCII hexadecimal. Can be used multiple
times, see section on the ATA information vpd page.
.TP
\fB\-i\fR, \fB\-\-ident\fR
decode the device identification (0x83) VPD page. When used once this option
has the same effect as '\-\-page=di'. When use twice then the short form of
the device identification VPD page's logical unit designator is decoded. In
the latter case this option has the same effect as '\-\-quiet \-\-page=di_lu'.
.TP
\fB\-l\fR, \fB\-\-long\fR
when decoding some VPD pages, give a little more output. For example the ATA
Information VPD page only shows the signature (in hex) and the IDENTIFY
(PACKET) DEVICE (in hex) when this option is given.
.TP
\fB\-m\fR, \fB\-\-maxlen\fR=\fILEN\fR
where \fILEN\fR is the (maximum) response length in bytes. It is placed in the
cdb's "allocation length" field. If not given (or \fILEN\fR is zero) then
252 is used (apart from the ATA Information VPD page which defaults to 572)
and, if the response indicates this value is insufficient, another INQUIRY
command is sent with a larger value in the cdb's "allocation length" field.
If this option is given and \fILEN\fR is greater than 0 then only one INQUIRY
command is sent. Since many simple devices implement the INQUIRY command
badly (and do not support VPD pages) then the safest value to use for
\fILEN\fR is 36. See the sg_inq man page for the more information.
.TP
\fB\-p\fR, \fB\-\-page\fR=\fIPG\fR
where \fIPG\fR is the VPD page to be decoded or output. The \fIPG\fR argument
can either be an abbreviation, a number or a pair or numbers separated by a
comma. The VPD page abbreviations can be seen by using the \fI\-\-enumerate\fR
option. If a number is given it is assumed to be decimal unless it has a
hexadecimal indicator which is either a leading '0x' or a trailing 'h'. If
one number is given then it is assumed to be a VPD page number. If two
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.
.TP
\fB\-q\fR, \fB\-\-quiet\fR
suppress the amount of decoding output.
.TP
\fB\-r\fR, \fB\-\-raw\fR
output requested VPD page in binary. The output should be piped to a
file or another utility when this option is used. The binary is
sent to stdout, and errors are sent to stderr.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
increases the level or verbosity.
.TP
\fB\-V\fR, \fB\-\-version\fR
print out version string then exit.
.SH ATA INFORMATION VPD PAGE
This VPD page (0x89 or 'ai') is defined by the SCSI to ATA Translation
standard. It contains information about the SAT layer, the "signature" of
the ATA device and the response to the ATA IDENTIFY (PACKET) DEVICE
command. The latter part has 512 bytes of identity, capability and
settings data which the hdparm utility is capable of decoding (so this
utility doesn't decode it).
.PP
To unclutter the output for this page, the signature and the IDENTIFY (PACKET)
DEVICE response are not output unless the \fI\-\-long\fR option (or
\fI\-\-hex\fR or \fI\-\-raw\fR) are given. When the \fI\-\-long\fR option
is given the IDENTIFY (PACKET) DEVICE response is output as 256 (16 bit)
words as is the fashion for ATA devices. To see that response as a string of
bytes use the '\-HH' option. To format the output suitable for hdparm to
decode use either the '\-HHH' or '\-rr' option. For example if 'dev/sdb' is
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
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)
is expanded when the '\-\-long' option is given using the standard INQUIRY
response information (e.g. the PDT and the PROTECT fields). 
.PP
In the 2.4 series of Linux kernels the \fIDEVICE\fR must be
a SCSI generic (sg) device. In the 2.6 series block devices (e.g. disks
and ATAPI DVDs) can also be specified. For example "sg_inq /dev/sda"
will work in the 2.6 series kernels. From lk 2.6.6 other SCSI "char"
device names may be used as well (e.g. "/dev/st0m").
.SH EXIT STATUS
The exit status of sg_vpd is 0 when it is successful. Otherwise see
the sg3_utils(8) man page.
.SH EXAMPLES
The examples in this page use Linux device names. For suitable device
names in other supported Operating Systems see the sg3_utils(8) man page.
.PP
To see the VPD pages that a device supports, use with no options. The
command line invocation is shown first followed by a typical response:
.PP
   # sg_vpd /dev/sdb
.br
Supported VPD pages VPD page:
.br
  Supported VPD pages [sv]
.br
  Unit serial number [sn]
.br
  Device identification [di]
.br
  Extended inquiry data [ei]
.br
  Block limits (SBC) [bl]
.PP
To see the VPD page numbers associated with each supported page then
add the '\-\-long' option to the above command line. To view a
VPD page either its number or abbreviation can be given to
the '\-\-page=' option. The page name abbreviations are shown within
square brackets above. In the next example the Extended inquiry data
VPD page is listed:
.PP
   # sg_vpd \-\-page=ei /dev/sdb
.br
extended INQUIRY data VPD page:
.br
  ACTIVATE_MICROCODE=0 SPT=0 GRD_CHK=0 APP_CHK=0 REF_CHK=0
.br
  UASK_SUP=0 GROUP_SUP=0 PRIOR_SUP=0 HEADSUP=1 ORDSUP=1 SIMPSUP=1
.br
  WU_SUP=0 CRD_SUP=0 NV_SUP=0 V_SUP=0
.br
  P_I_I_SUP=0 LUICLR=0 R_SUP=0 CBCS=0
.br
  Multi I_T nexus microcode download=0
.br
  Extended self\-test completion minutes=0
.br
  POA_SUP=0 HRA_SUP=0 VSA_SUP=0
.PP
Further examples can be found on the http://sg.danny.cz/sg/sg3_utils.html
web page.
.SH AUTHOR
Written by Doug Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
Copyright \(co 2006\-2011 Douglas Gilbert
.br
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"
.B sg_inq(sg3_utils), sg3_utils(sg3_utils), sdparm(sdparm), hdparm(hdparm)