gadgetconfig

package
v0.0.0-...-af24c9e Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GadgetConfigBasePath = "/sys/kernel/config/usb_gadget"
	UdcPathGlob          = "/sys/class/udc/*"
	StrEnglish           = "0x409"
)

Variables

This section is empty.

Functions

func FindUdc

func FindUdc() []string

Types

type AcmFunction

type AcmFunction struct {
	Name string
}

AcmFunction

func (*AcmFunction) GadgetFunctionCreate

func (fn *AcmFunction) GadgetFunctionCreate() Steps

func (*AcmFunction) GadgetFunctionName

func (fn *AcmFunction) GadgetFunctionName() string

type Action

type Action int

Action

const (
	Noop Action = iota
	Comment
	Mkdir
	MkdirCreateOnly
	Rmdir
	Write
	WriteBinary
	Remove
	Symlink
)

type Config

type Config struct {
	Name          string
	Configuration string
	Functions     []Function
}

Config

type EemFunction

type EemFunction struct {
	Name     string
	DevAddr  string
	HostAddr string
}

EemFunction

func (*EemFunction) GadgetFunctionCreate

func (fn *EemFunction) GadgetFunctionCreate() Steps

func (*EemFunction) GadgetFunctionName

func (fn *EemFunction) GadgetFunctionName() string

func (*EemFunction) Ifname

func (fn *EemFunction) Ifname(g *Gadget) string

type Function

type Function interface {
	GadgetFunctionName() string
	GadgetFunctionCreate() Steps
}

Function

type Gadget

type Gadget struct {
	Name         string
	GadgetPath   string
	IdVendor     int
	IdProduct    int
	SerialNumber string
	Manufacturer string
	Product      string
	UDC          string
	Configs      []Config
}

Gadget

func (*Gadget) Create

func (g *Gadget) Create() error

func (*Gadget) CreateSteps

func (g *Gadget) CreateSteps() (steps Steps)

func (*Gadget) Exists

func (g *Gadget) Exists() bool

func (*Gadget) ReadConfigfsFile

func (g *Gadget) ReadConfigfsFile(elem ...string) (string, error)

func (*Gadget) Remove

func (g *Gadget) Remove() error

func (*Gadget) RemoveSteps

func (g *Gadget) RemoveSteps() Steps

func (*Gadget) ShellCreate

func (g *Gadget) ShellCreate() ShellSteps

func (*Gadget) ShellRemove

func (g *Gadget) ShellRemove() ShellSteps

type HidFunction

type HidFunction struct {
	Name         string
	Protocol     int
	Subclass     int
	ReportLength int
	Descriptor   []byte
}

HidFunction

func (*HidFunction) GadgetFunctionCreate

func (fn *HidFunction) GadgetFunctionCreate() Steps

func (*HidFunction) GadgetFunctionName

func (fn *HidFunction) GadgetFunctionName() string

type MassStorageFunction

type MassStorageFunction struct {
	Name string
	Luns []MassStorageLun
}

MassStorageFunction

func (*MassStorageFunction) GadgetFunctionCreate

func (fn *MassStorageFunction) GadgetFunctionCreate() (steps Steps)

func (*MassStorageFunction) GadgetFunctionName

func (fn *MassStorageFunction) GadgetFunctionName() string

type MassStorageLun

type MassStorageLun struct {
	Name      string
	File      string
	Removable bool
	Cdrom     bool
}

MassStorageLun

type NcmFunction

type NcmFunction struct {
	Name     string
	DevAddr  string
	HostAddr string
}

NcmFunction

func (*NcmFunction) GadgetFunctionCreate

func (fn *NcmFunction) GadgetFunctionCreate() Steps

func (*NcmFunction) GadgetFunctionName

func (fn *NcmFunction) GadgetFunctionName() string

func (*NcmFunction) Ifname

func (fn *NcmFunction) Ifname(g *Gadget) string

type ShellSteps

type ShellSteps [][]string

ShellSteps

func (ShellSteps) Dump

func (shs ShellSteps) Dump(w io.Writer)

type Step

type Step struct {
	Action Action
	Arg0   string
	Arg1   string
}

Step

func (Step) PrependPath

func (s Step) PrependPath(path string) (out Step)

func (Step) Run

func (s Step) Run() error

func (Step) ShellArgs

func (s Step) ShellArgs() []string

func (Step) Undo

func (s Step) Undo() Step

type Steps

type Steps []Step

Steps

func (*Steps) Append

func (ss *Steps) Append(s Step) Steps

func (Steps) Clone

func (steps Steps) Clone() Steps

func (*Steps) Extend

func (ss *Steps) Extend(more Steps) Steps

func (Steps) PrependPath

func (steps Steps) PrependPath(path string) Steps

func (Steps) Reverse

func (steps Steps) Reverse() (rev Steps)

func (Steps) Run

func (steps Steps) Run() error

func (Steps) ShellArgs

func (steps Steps) ShellArgs() ShellSteps

func (Steps) Undo

func (steps Steps) Undo() Steps

Jump to

Keyboard shortcuts

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