-
Notifications
You must be signed in to change notification settings - Fork 25
/
commands.go
58 lines (48 loc) · 1.46 KB
/
commands.go
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
// Copyright 2017-18 Daniel Swarbrick. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// SCSI command definitions.
package scsi
import (
"fmt"
)
const (
// SCSI commands used by this package
SCSI_INQUIRY = 0x12
SCSI_MODE_SENSE_6 = 0x1a
SCSI_READ_CAPACITY_10 = 0x25
SCSI_ATA_PASSTHRU_16 = 0x85
// Minimum length of standard INQUIRY response
INQ_REPLY_LEN = 36
// SCSI-3 mode pages
RIGID_DISK_DRIVE_GEOMETRY_PAGE = 0x04
// Mode page control field
MPAGE_CONTROL_DEFAULT = 2
)
// SCSI CDB types
type CDB6 [6]byte
type CDB10 [10]byte
type CDB16 [16]byte
// SCSI INQUIRY response
type InquiryResponse struct {
Peripheral byte // peripheral qualifier, device type
_ byte
Version byte
_ [5]byte
VendorIdent [8]byte
ProductIdent [16]byte
ProductRev [4]byte
}
func (inq InquiryResponse) String() string {
return fmt.Sprintf("%.8s %.16s %.4s", inq.VendorIdent, inq.ProductIdent, inq.ProductRev)
}