gadget

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: CC0-1.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GadgetFunctionNONE        int64 = 0
	GadgetFunctionADB         int64 = 1
	GadgetFunctionACCESSORY   int64 = (1 << 1)
	GadgetFunctionMTP         int64 = (1 << 2)
	GadgetFunctionMIDI        int64 = (1 << 3)
	GadgetFunctionPTP         int64 = (1 << 4)
	GadgetFunctionRNDIS       int64 = (1 << 5)
	GadgetFunctionAudioSource int64 = (1 << 6)
	GadgetFunctionUVC         int64 = (1 << 7)
	GadgetFunctionNCM         int64 = (1 << 10)
)
View Source
const (
	TransactionIUsbGadgetSetCurrentUsbFunctions = binder.FirstCallTransaction + 0
	TransactionIUsbGadgetGetCurrentUsbFunctions = binder.FirstCallTransaction + 1
	TransactionIUsbGadgetGetUsbSpeed            = binder.FirstCallTransaction + 2
	TransactionIUsbGadgetReset                  = binder.FirstCallTransaction + 3
)
View Source
const (
	MethodIUsbGadgetSetCurrentUsbFunctions = "setCurrentUsbFunctions"
	MethodIUsbGadgetGetCurrentUsbFunctions = "getCurrentUsbFunctions"
	MethodIUsbGadgetGetUsbSpeed            = "getUsbSpeed"
	MethodIUsbGadgetReset                  = "reset"
)
View Source
const (
	TransactionIUsbGadgetCallbackSetCurrentUsbFunctionsCb = binder.FirstCallTransaction + 0
	TransactionIUsbGadgetCallbackGetCurrentUsbFunctionsCb = binder.FirstCallTransaction + 1
	TransactionIUsbGadgetCallbackGetUsbSpeedCb            = binder.FirstCallTransaction + 2
	TransactionIUsbGadgetCallbackResetCb                  = binder.FirstCallTransaction + 3
)
View Source
const (
	MethodIUsbGadgetCallbackSetCurrentUsbFunctionsCb = "setCurrentUsbFunctionsCb"
	MethodIUsbGadgetCallbackGetCurrentUsbFunctionsCb = "getCurrentUsbFunctionsCb"
	MethodIUsbGadgetCallbackGetUsbSpeedCb            = "getUsbSpeedCb"
	MethodIUsbGadgetCallbackResetCb                  = "resetCb"
)
View Source
const DescriptorIUsbGadget = "android.hardware.usb.gadget.IUsbGadget"
View Source
const DescriptorIUsbGadgetCallback = "android.hardware.usb.gadget.IUsbGadgetCallback"

Variables

This section is empty.

Functions

This section is empty.

Types

type GadgetFunction

type GadgetFunction struct {
}

func (*GadgetFunction) MarshalParcel

func (s *GadgetFunction) MarshalParcel(
	p *parcel.Parcel,
) error

func (*GadgetFunction) UnmarshalParcel

func (s *GadgetFunction) UnmarshalParcel(
	p *parcel.Parcel,
) error

type IUsbGadget

type IUsbGadget interface {
	AsBinder() binder.IBinder
	SetCurrentUsbFunctions(ctx context.Context, functions int64, callback IUsbGadgetCallback, timeoutMs int64, transactionId int64) error
	GetCurrentUsbFunctions(ctx context.Context, callback IUsbGadgetCallback, transactionId int64) error
	GetUsbSpeed(ctx context.Context, callback IUsbGadgetCallback, transactionId int64) error
	Reset(ctx context.Context, callback IUsbGadgetCallback, transactionId int64) error
}

func NewUsbGadgetStub

func NewUsbGadgetStub(
	impl IUsbGadgetServer,
) IUsbGadget

NewUsbGadgetStub creates a server-side IUsbGadget wrapping the given server implementation. The returned value satisfies IUsbGadget and can be passed to proxy methods; its AsBinder() returns a *binder.StubBinder that is auto-registered with the binder driver on first use.

type IUsbGadgetCallback

type IUsbGadgetCallback interface {
	AsBinder() binder.IBinder
	SetCurrentUsbFunctionsCb(ctx context.Context, functions int64, status Status, transactionId int64) error
	GetCurrentUsbFunctionsCb(ctx context.Context, functions int64, status Status, transactionId int64) error
	GetUsbSpeedCb(ctx context.Context, speed UsbSpeed, transactionId int64) error
	ResetCb(ctx context.Context, status Status, transactionId int64) error
}

func NewUsbGadgetCallbackStub

func NewUsbGadgetCallbackStub(
	impl IUsbGadgetCallbackServer,
) IUsbGadgetCallback

NewUsbGadgetCallbackStub creates a server-side IUsbGadgetCallback wrapping the given server implementation. The returned value satisfies IUsbGadgetCallback and can be passed to proxy methods; its AsBinder() returns a *binder.StubBinder that is auto-registered with the binder driver on first use.

type IUsbGadgetCallbackServer

type IUsbGadgetCallbackServer interface {
	SetCurrentUsbFunctionsCb(ctx context.Context, functions int64, status Status, transactionId int64) error
	GetCurrentUsbFunctionsCb(ctx context.Context, functions int64, status Status, transactionId int64) error
	GetUsbSpeedCb(ctx context.Context, speed UsbSpeed, transactionId int64) error
	ResetCb(ctx context.Context, status Status, transactionId int64) error
}

IUsbGadgetCallbackServer is the server-side interface that user implementations provide to NewUsbGadgetCallbackStub. It contains only the business methods, without AsBinder (which is provided by the stub itself).

type IUsbGadgetServer

type IUsbGadgetServer interface {
	SetCurrentUsbFunctions(ctx context.Context, functions int64, callback IUsbGadgetCallback, timeoutMs int64, transactionId int64) error
	GetCurrentUsbFunctions(ctx context.Context, callback IUsbGadgetCallback, transactionId int64) error
	GetUsbSpeed(ctx context.Context, callback IUsbGadgetCallback, transactionId int64) error
	Reset(ctx context.Context, callback IUsbGadgetCallback, transactionId int64) error
}

IUsbGadgetServer is the server-side interface that user implementations provide to NewUsbGadgetStub. It contains only the business methods, without AsBinder (which is provided by the stub itself).

type Status

type Status int32
const (
	StatusSUCCESS                   Status = 0
	StatusERROR                     Status = 1
	StatusFunctionsApplied          Status = 2
	StatusFunctionsNotApplied       Status = 3
	StatusConfigurationNotSupported Status = 4
)

type UsbGadgetCallbackProxy

type UsbGadgetCallbackProxy struct {
	Remote binder.IBinder
}

func NewUsbGadgetCallbackProxy

func NewUsbGadgetCallbackProxy(
	remote binder.IBinder,
) *UsbGadgetCallbackProxy

func (*UsbGadgetCallbackProxy) AsBinder

func (p *UsbGadgetCallbackProxy) AsBinder() binder.IBinder

func (*UsbGadgetCallbackProxy) GetCurrentUsbFunctionsCb

func (p *UsbGadgetCallbackProxy) GetCurrentUsbFunctionsCb(
	ctx context.Context,
	functions int64,
	status Status,
	transactionId int64,
) error

func (*UsbGadgetCallbackProxy) GetUsbSpeedCb

func (p *UsbGadgetCallbackProxy) GetUsbSpeedCb(
	ctx context.Context,
	speed UsbSpeed,
	transactionId int64,
) error

func (*UsbGadgetCallbackProxy) ResetCb

func (p *UsbGadgetCallbackProxy) ResetCb(
	ctx context.Context,
	status Status,
	transactionId int64,
) error

func (*UsbGadgetCallbackProxy) SetCurrentUsbFunctionsCb

func (p *UsbGadgetCallbackProxy) SetCurrentUsbFunctionsCb(
	ctx context.Context,
	functions int64,
	status Status,
	transactionId int64,
) error

type UsbGadgetCallbackStub

type UsbGadgetCallbackStub struct {
	Impl      IUsbGadgetCallback
	Transport binder.VersionAwareTransport
}

UsbGadgetCallbackStub dispatches incoming binder transactions to a typed IUsbGadgetCallback implementation.

func (*UsbGadgetCallbackStub) Descriptor

func (s *UsbGadgetCallbackStub) Descriptor() string

func (*UsbGadgetCallbackStub) OnTransaction

func (s *UsbGadgetCallbackStub) OnTransaction(
	ctx context.Context,
	code binder.TransactionCode,
	_data *parcel.Parcel,
) (*parcel.Parcel, error)

type UsbGadgetProxy

type UsbGadgetProxy struct {
	Remote binder.IBinder
}

func NewUsbGadgetProxy

func NewUsbGadgetProxy(
	remote binder.IBinder,
) *UsbGadgetProxy

func (*UsbGadgetProxy) AsBinder

func (p *UsbGadgetProxy) AsBinder() binder.IBinder

func (*UsbGadgetProxy) GetCurrentUsbFunctions

func (p *UsbGadgetProxy) GetCurrentUsbFunctions(
	ctx context.Context,
	callback IUsbGadgetCallback,
	transactionId int64,
) error

func (*UsbGadgetProxy) GetUsbSpeed

func (p *UsbGadgetProxy) GetUsbSpeed(
	ctx context.Context,
	callback IUsbGadgetCallback,
	transactionId int64,
) error

func (*UsbGadgetProxy) Reset

func (p *UsbGadgetProxy) Reset(
	ctx context.Context,
	callback IUsbGadgetCallback,
	transactionId int64,
) error

func (*UsbGadgetProxy) SetCurrentUsbFunctions

func (p *UsbGadgetProxy) SetCurrentUsbFunctions(
	ctx context.Context,
	functions int64,
	callback IUsbGadgetCallback,
	timeoutMs int64,
	transactionId int64,
) error

type UsbGadgetStub

type UsbGadgetStub struct {
	Impl      IUsbGadget
	Transport binder.VersionAwareTransport
}

UsbGadgetStub dispatches incoming binder transactions to a typed IUsbGadget implementation.

func (*UsbGadgetStub) Descriptor

func (s *UsbGadgetStub) Descriptor() string

func (*UsbGadgetStub) OnTransaction

func (s *UsbGadgetStub) OnTransaction(
	ctx context.Context,
	code binder.TransactionCode,
	_data *parcel.Parcel,
) (*parcel.Parcel, error)

type UsbSpeed

type UsbSpeed int32
const (
	UsbSpeedUNKNOWN         UsbSpeed = -1
	UsbSpeedLOWSPEED        UsbSpeed = 0
	UsbSpeedFULLSPEED       UsbSpeed = 1
	UsbSpeedHIGHSPEED       UsbSpeed = 2
	UsbSpeedSUPERSPEED      UsbSpeed = 3
	UsbSpeedSUPERSPEED_10Gb UsbSpeed = 4
	UsbSpeedSUPERSPEED_20Gb UsbSpeed = 5
	UsbSpeedUSB4_GEN2_10Gb  UsbSpeed = 6
	UsbSpeedUSB4_GEN2_20Gb  UsbSpeed = 7
	UsbSpeedUSB4_GEN3_20Gb  UsbSpeed = 8
	UsbSpeedUSB4_GEN3_40Gb  UsbSpeed = 9
)

Jump to

Keyboard shortcuts

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