usbms

package
v0.0.0-...-6437eea Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPodSubcommandUpdateStart    uint8 = 0x90
	IPodSubcommandUpdateChunk    uint8 = 0x91
	IPodSubcommandUpdateEnd      uint8 = 0x92
	IPodSubcommandRepartition    uint8 = 0x94
	IPodSubcommandUpdateFinalize uint8 = 0x31
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CBS

type CBS struct {
	Signature   [4]byte
	Tag         uint32
	DataResidue uint32
	Status      uint8
}

type CBW

type CBW struct {
	Signature          [4]byte
	Tag                uint32
	DataTransferLength uint32
	Flags              uint8
	LUN                uint8
	Length             uint8
	CB                 [16]byte
}

func (*CBW) Bytes

func (c *CBW) Bytes() []byte

type CommandDataBuffer

type CommandDataBuffer struct {
	OperationCode OperationCode
	// Request contains the OperationCode-specific request parameters
	Request []byte
	// ServiceAction can (for certain CDB encodings) contain an additional
	// qualification for the OperationCode.
	ServiceAction *uint8
	// Control contains common CDB metadata
	Control uint8
	// DataTransferDirection contains the direction(s) of the data transfer(s)
	// to be made.
	DataTransferDirection DataTransferDirection
	// Data contains the data to be transferred. If data needs to be received
	// from the device, a buffer needs to be provided here.
	Data []byte
	// Timeout can contain an optional timeout (0 = no timeout) for the command
	Timeout time.Duration
}

CommandDataBuffer represents a command

func (*CommandDataBuffer) Bytes

func (c *CommandDataBuffer) Bytes() ([]byte, error)

Bytes returns the raw CDB to be sent to the device

type DataTransferDirection

type DataTransferDirection uint8
const (
	DataTransferNone DataTransferDirection = iota
	DataTransferToDevice
	DataTransferFromDevice
	DataTransferBidirectional
)

type DeviceInformation

type DeviceInformation struct {
	UpdaterFanilyVersion int    `plist:"UpdaterFamilyVersion"`
	BuildID              string `plist:"BuildID"`
	SerialNumber         string `plist:"SerialNumber"`
}

type Host

type Host struct {
	InEndpoint  *gousb.InEndpoint
	OutEndpoint *gousb.OutEndpoint
	Tag         uint32
}

func (*Host) IPodDeviceInformation

func (h *Host) IPodDeviceInformation() (*DeviceInformation, error)

func (*Host) IPodFinalize

func (h *Host) IPodFinalize(reset bool) error

func (*Host) IPodRepartition

func (h *Host) IPodRepartition(targetSize int) error

func (*Host) IPodUpdateEnd

func (h *Host) IPodUpdateEnd() error

func (*Host) IPodUpdateSendChunk

func (h *Host) IPodUpdateSendChunk(data []byte) error

func (*Host) IPodUpdateSendFull

func (h *Host) IPodUpdateSendFull(kind IPodUpdateKind, data []byte) error

func (*Host) IPodUpdateStart

func (h *Host) IPodUpdateStart(kind IPodUpdateKind, size uint32) error

func (*Host) InquiryVPD

func (h *Host) InquiryVPD(page uint8, allocation uint16) ([]byte, error)

func (*Host) RawCommand

func (h *Host) RawCommand(cbd *CommandDataBuffer) error

type IPodUpdateKind

type IPodUpdateKind uint8
var (
	IPodUpdateBootloader IPodUpdateKind = 1
	IPodUpdateFirmware   IPodUpdateKind = 0
)

type OperationCode

type OperationCode uint8
const (
	InquiryOp        OperationCode = 0x12
	ReadDefectDataOp OperationCode = 0x37
	LogSenseOp       OperationCode = 0x4d
)

Jump to

Keyboard shortcuts

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