scsi

package module
v0.0.0-...-70f6ba5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2023 License: GPL-2.0, GPL-2.0-or-later Imports: 5 Imported by: 0

README

Package scsi provides a device command interface and the scsi-id example program.

To regenerate CGO definitions of system headers,

$ go generate ./internal/godefs

© 2022 Platina Systems, Inc. All rights reserved. Use of this source code is governed by this BSD-style LICENSE.

Documentation

Overview

Package scsi provides a device command interface.

Index

Constants

View Source
const (
	Page00  = 0x00
	Page80  = 0x80
	Page83  = 0x83
	DataLen = 0xfc
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dev

type Dev struct{ EmbeddedDev }

func Open

func Open(fn string) (Dev, error)

func (Dev) IDs

func (dev Dev) IDs() (dscs []IdDsc, err error)

IDs() returns the identification descriptors from the page 0x83 EVPD inquiry response.

<https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf>

	Table 459 Device Identification VPD page
	┏━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
	┃  Bit┃   7    ┃   6    ┃   5    ┃   4    ┃   3    ┃   2    ┃   1    ┃   0    ┃
	┃Byte ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃
	┣━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┫
	┃ 0   │ PERIPHERAL QUALIFIER     │ PERIPHERAL DEVICE TYPE                     ┃
	┠─────┼──────────────────────────┴────────────────────────────────────────────┨
	┃ 1   │ PAGE CODE (83h)                                                       ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
        ┃ 2   │ (MSB)                                                                 ┃
        ┠─────┤          PAGE LENGTH (n-3)                                            ┃
	┃ 3   │                                                                 (LSB) ┃
	┠─────┴───────────────────────────────────────────────────────────────────────┨
	┃ Identification descriptor list ...                                          ┃
	┠─────┬───────────────────────────────────────────────────────────────────────┨
	┃ 4   │ First Identification Descriptor (see table 460)                       ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
	┃ n   │ Last Identification Descriptor                                        ┃
	┗━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

func (Dev) Inquiry

func (dev Dev) Inquiry(vpd vpd.Request, pagecode byte, data []byte) error

func (Dev) SerialNumber

func (dev Dev) SerialNumber() (sn String, err error)

SerialNumber() returns the `Product Serial Number` field from the page 0x80 EVPD inquiry response.

<https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf>

	Table 484 Unit Serial Number page (80h)
	┏━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
	┃  Bit┃   7    ┃   6    ┃   5    ┃   4    ┃   3    ┃   2    ┃   1    ┃   0    ┃
	┃Byte ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃
	┣━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┫
	┃ 0   │ PERIPHERAL QUALIFIER     │ PERIPHERAL DEVICE TYPE                     ┃
	┠─────┼──────────────────────────┴────────────────────────────────────────────┨
	┃ 1   │ PAGE CODE (80h)                                                       ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
	┃ 2   │ Reserved                                                              ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
	┃ 3   │ PAGE LENGTH                                                           ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
        ┃ 4   │                                                                       ┃
        ┠─────┤                                                                       ┃
        ┃ ... │ Product Serial Number                                                 ┃
        ┠─────┤                                                                       ┃
	┃ n   │                                                                       ┃
	┗━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

func (Dev) StandardInquiry

func (dev Dev) StandardInquiry() (std StdInqData, err error)

func (Dev) VPDs

func (dev Dev) VPDs() (l []byte, err error)

VPDs() returns the `SUPPORTED PAGE LIST` from the page 0x00 EVPD inquiry response.

<https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf>

Table 483 Supported Vital Product Data pages
┏━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃  Bit┃   7    ┃   6    ┃   5    ┃   4    ┃   3    ┃   2    ┃   1    ┃   0    ┃
┃Byte ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃
┣━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┫
┃ 0   │ PERIPHERAL QUALIFIER     │ PERIPHERAL DEVICE TYPE                     ┃
┠─────┼──────────────────────────┴────────────────────────────────────────────┨
┃ 1   │ PAGE CODE (00h)                                                       ┃
┠─────┼───────────────────────────────────────────────────────────────────────┨
┃ 2   │ Reserved                                                              ┃
┠─────┼───────────────────────────────────────────────────────────────────────┨
┃ 3   │ PAGE LENGTH (n-3)                                                     ┃
┠─────┼───────────────────────────────────────────────────────────────────────┨
┃ 4   │                                                                       ┃
┠─────┤                                                                       ┃
┃ ... │ SUPPORTED PAGE LIST                                                   ┃
┠─────┤                                                                       ┃
┃ n   │                                                                       ┃
┗━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

type EmbeddedDev

type EmbeddedDev interface {
	Close() error
	Request(cdb, fromdev []byte, todev ...byte) error
}

type IdDsc

type IdDsc []byte

<https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf>

	Table 460 Identification Descriptor
	┏━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
	┃  Bit┃   7    ┃   6    ┃   5    ┃   4    ┃   3    ┃   2    ┃   1    ┃   0    ┃
	┃Byte ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃
	┣━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┫
	┃ 0   │ PROTOCOL IDENTIFER                │ CODE SET                          ┃
	┠─────┼────────┬────────┬─────────────────┼───────────────────────────────────┨
	┃ 1   │ PIV    │Reserved│ ASSOCIATION     │ IDENTIFIER TYPE                   ┃
	┠─────┼────────┴────────┴─────────────────┴───────────────────────────────────┨
	┃ 2   │ Reserved                                                              ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
	┃ 3   │ IDENTIFIER LENGTH (n-3)                                               ┃
	┠─────┼───────────────────────────────────────────────────────────────────────┨
        ┃ 4   │                                                                       ┃
        ┠─────┤                                                                       ┃
        ┃ ... │ IDENTIFIER                                                            ┃
        ┠─────┤                                                                       ┃
	┃ n   │                                                                       ┃
	┗━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

func (IdDsc) Ascii

func (dsc IdDsc) Ascii() bool

func (IdDsc) Association

func (dsc IdDsc) Association() uint8

func (IdDsc) ID

func (dsc IdDsc) ID() []byte

func (IdDsc) Len

func (dsc IdDsc) Len() int

func (IdDsc) PIV

func (dsc IdDsc) PIV() bool

func (IdDsc) Protocol

func (dsc IdDsc) Protocol() uint8

func (IdDsc) String

func (dsc IdDsc) String() string

func (IdDsc) Type

func (dsc IdDsc) Type() uint8

type StdInqData

type StdInqData []byte

StdIngData provides methods that parse the respective fields of the page 0x00 inquiry response.

<https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf>

Table 59 Standard INQUIRY data format
┏━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃  Bit┃   7    ┃   6    ┃   5    ┃   4    ┃   3    ┃   2    ┃   1    ┃   0    ┃
┃Byte ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃        ┃
┣━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━╇━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┻━━━━━━━━┫
┃ 0   │ PERIPHERAL QUALIFIER     │ PERIPHERAL DEVICE TYPE                     ┃
┠─────┼────────┬─────────────────┴────────────────────────────────────────────┨
┃ 1   │  RMB   │                  Reserved                                    ┃
┠─────┼────────┴──────────────────────────────────────────────────────────────┨
┃ 2   │                              Version                                  ┃
┠─────┼────────┬────────┬─────────────────┬───────────────────────────────────┫
┃ 3   │Obsolete│Obsolete│     Reserved    │         Response Data Format      ┃
┠─────┼────────┴────────┴─────────────────┴───────────────────────────────────┫
┃ 4   │                           Additional Length (n-4)                     ┃
┠─────┼───────────────────────────────────────────────────────────────────────┫
┃ 5   │                           Reserved                                    ┃
┠─────┼───────────────────────────────────────────────────────────────────────┫
┃ 6   │                           Reserved                                    ┃
┠─────┼────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┫
┃ 7   │Obsolete│Obsolete│Obsolete│Obsolete│Obsolete│Obsolete│ CMDQUE │   VS   ┃
┠─────┼────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┫
┃ 8   │ (MSB)                                                                 ┃
┠─────┤                           VENDOR IDENTIFICATION                       ┃
┃ 15  │                                                                 (LSB) ┃
┠─────┼───────────────────────────────────────────────────────────────────────┫
┃ 16  │ (MSB)                                                                 ┃
┠─────┤                           PRODUCT IDENTIFICATION                      ┃
┃ 31  │                                                                 (LSB) ┃
┠─────┼───────────────────────────────────────────────────────────────────────┫
┃ 32  │ (MSB)                                                                 ┃
┠─────┤                           PRODUCT REVISION LEVEL                      ┃
┃ 35  │                                                                 (LSB) ┃
┠─────┼───────────────────────────────────────────────────────────────────────┫
┃ 36  │                                                                       ┃
┠─────┤                           SERIAL NUMBER                               ┃
┃ 43  │                                                                       ┃
┠─────┼───────────────────────────────────────────────────────────────────────┫
┃ 56  │                                                                       ┃
┠─────┤                           Reserved                                    ┃
┃ 95  │                                                                       ┃
┠─────┴───────────────────────────────────────────────────────────────────────┫
┃                             Vendor-Specific Parameters                      ┃
┠─────┬───────────────────────────────────────────────────────────────────────┫
┃ 96  │                                                                       ┃
┠─────┤                           Vendor Specific                             ┃
┃ n   │                                                                       ┃
┗━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

func (StdInqData) ProductID

func (data StdInqData) ProductID() String

func (StdInqData) ProductRev

func (data StdInqData) ProductRev() String

func (StdInqData) SerialNumber

func (data StdInqData) SerialNumber() String

func (StdInqData) Type

func (data StdInqData) Type() Type

func (StdInqData) VendorID

func (data StdInqData) VendorID() String

type String

type String []byte

func (String) String

func (s String) String() string

type Type

type Type byte

func (Type) String

func (t Type) String() string

Directories

Path Synopsis
cmd
internal
godefs
Package godefs generates GO defintions from scsi C include files.
Package godefs generates GO defintions from scsi C include files.
vpd
Vital Product Data request bit
Vital Product Data request bit

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL