usb

package
v0.0.4 Latest Latest
Warning

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

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

Documentation

Overview

Package usb provides Go bindings for android.hardware.usb.

Index

Constants

View Source
const (
	ActionUsbAccessoryAttached = consts.ActionUsbAccessoryAttached
	ActionUsbAccessoryDetached = consts.ActionUsbAccessoryDetached
	ActionUsbDeviceAttached    = consts.ActionUsbDeviceAttached
	ActionUsbDeviceDetached    = consts.ActionUsbDeviceDetached
	ExtraAccessory             = consts.ExtraAccessory
	ExtraDevice                = consts.ExtraDevice
	ExtraPermissionGranted     = consts.ExtraPermissionGranted
)
View Source
const (
	Creator = consts.Creator
)

Variables

This section is empty.

Functions

func Init

func Init(env *jni.Env) error

Init resolves all JNI class and method references for this package. It is safe to call multiple times (uses sync.Once internally). Exported for E2E testing on Android.

Types

type Device added in v0.0.4

type Device struct {
	VM  *jni.VM
	Obj *jni.GlobalRef
}

Device wraps android.hardware.usb.UsbDevice.

func (*Device) DescribeContents added in v0.0.4

func (m *Device) DescribeContents() (int32, error)

DescribeContents calls android.hardware.usb.UsbDevice.describeContents.

func (*Device) Equals added in v0.0.4

func (m *Device) Equals(arg0 *jni.Object) (bool, error)

Equals calls android.hardware.usb.UsbDevice.equals.

func (*Device) GetConfiguration added in v0.0.4

func (m *Device) GetConfiguration(arg0 int32) (*jni.Object, error)

GetConfiguration calls android.hardware.usb.UsbDevice.getConfiguration.

func (*Device) GetConfigurationCount added in v0.0.4

func (m *Device) GetConfigurationCount() (int32, error)

GetConfigurationCount calls android.hardware.usb.UsbDevice.getConfigurationCount.

func (*Device) GetDeviceClass added in v0.0.4

func (m *Device) GetDeviceClass() (int32, error)

GetDeviceClass calls android.hardware.usb.UsbDevice.getDeviceClass.

func (*Device) GetDeviceId0 added in v0.0.4

func (m *Device) GetDeviceId0() (int32, error)

GetDeviceId0 calls android.hardware.usb.UsbDevice.getDeviceId.

func (*Device) GetDeviceId1_1 added in v0.0.4

func (m *Device) GetDeviceId1_1(arg0 string) (int32, error)

GetDeviceId1_1 calls android.hardware.usb.UsbDevice.getDeviceId.

func (*Device) GetDeviceName0 added in v0.0.4

func (m *Device) GetDeviceName0() (string, error)

GetDeviceName0 calls android.hardware.usb.UsbDevice.getDeviceName.

func (*Device) GetDeviceName1_1 added in v0.0.4

func (m *Device) GetDeviceName1_1(arg0 int32) (string, error)

GetDeviceName1_1 calls android.hardware.usb.UsbDevice.getDeviceName.

func (*Device) GetDeviceProtocol added in v0.0.4

func (m *Device) GetDeviceProtocol() (int32, error)

GetDeviceProtocol calls android.hardware.usb.UsbDevice.getDeviceProtocol.

func (*Device) GetDeviceSubclass added in v0.0.4

func (m *Device) GetDeviceSubclass() (int32, error)

GetDeviceSubclass calls android.hardware.usb.UsbDevice.getDeviceSubclass.

func (*Device) GetInterface added in v0.0.4

func (m *Device) GetInterface(arg0 int32) (*jni.Object, error)

GetInterface calls android.hardware.usb.UsbDevice.getInterface.

func (*Device) GetInterfaceCount added in v0.0.4

func (m *Device) GetInterfaceCount() (int32, error)

GetInterfaceCount calls android.hardware.usb.UsbDevice.getInterfaceCount.

func (*Device) GetManufacturerName added in v0.0.4

func (m *Device) GetManufacturerName() (string, error)

GetManufacturerName calls android.hardware.usb.UsbDevice.getManufacturerName.

func (*Device) GetProductId added in v0.0.4

func (m *Device) GetProductId() (int32, error)

GetProductId calls android.hardware.usb.UsbDevice.getProductId.

func (*Device) GetProductName added in v0.0.4

func (m *Device) GetProductName() (string, error)

GetProductName calls android.hardware.usb.UsbDevice.getProductName.

func (*Device) GetSerialNumber added in v0.0.4

func (m *Device) GetSerialNumber() (string, error)

GetSerialNumber calls android.hardware.usb.UsbDevice.getSerialNumber.

func (*Device) GetVendorId added in v0.0.4

func (m *Device) GetVendorId() (int32, error)

GetVendorId calls android.hardware.usb.UsbDevice.getVendorId.

func (*Device) GetVersion added in v0.0.4

func (m *Device) GetVersion() (string, error)

GetVersion calls android.hardware.usb.UsbDevice.getVersion.

func (*Device) HashCode added in v0.0.4

func (m *Device) HashCode() (int32, error)

HashCode calls android.hardware.usb.UsbDevice.hashCode.

func (*Device) ToString added in v0.0.4

func (m *Device) ToString() (string, error)

ToString calls android.hardware.usb.UsbDevice.toString.

func (*Device) WriteToParcel added in v0.0.4

func (m *Device) WriteToParcel(arg0 *jni.Object, arg1 int32) error

WriteToParcel calls android.hardware.usb.UsbDevice.writeToParcel.

type DeviceConnection added in v0.0.4

type DeviceConnection struct {
	VM  *jni.VM
	Obj *jni.GlobalRef
}

DeviceConnection wraps android.hardware.usb.UsbDeviceConnection.

func (*DeviceConnection) BulkTransfer4 added in v0.0.4

func (m *DeviceConnection) BulkTransfer4(
	arg0 *jni.Object,
	arg1 *jni.Object,
	arg2 int32,
	arg3 int32,
) (int32, error)

BulkTransfer4 calls android.hardware.usb.UsbDeviceConnection.bulkTransfer.

func (*DeviceConnection) BulkTransfer5_1 added in v0.0.4

func (m *DeviceConnection) BulkTransfer5_1(
	arg0 *jni.Object,
	arg1 *jni.Object,
	arg2 int32,
	arg3 int32,
	arg4 int32,
) (int32, error)

BulkTransfer5_1 calls android.hardware.usb.UsbDeviceConnection.bulkTransfer.

func (*DeviceConnection) ClaimInterface added in v0.0.4

func (m *DeviceConnection) ClaimInterface(arg0 *jni.Object, arg1 bool) (bool, error)

ClaimInterface calls android.hardware.usb.UsbDeviceConnection.claimInterface.

func (*DeviceConnection) Close added in v0.0.4

func (m *DeviceConnection) Close() error

Close calls android.hardware.usb.UsbDeviceConnection.close.

func (*DeviceConnection) ControlTransfer7 added in v0.0.4

func (m *DeviceConnection) ControlTransfer7(
	arg0 int32,
	arg1 int32,
	arg2 int32,
	arg3 int32,
	arg4 *jni.Object,
	arg5 int32,
	arg6 int32,
) (int32, error)

ControlTransfer7 calls android.hardware.usb.UsbDeviceConnection.controlTransfer.

func (*DeviceConnection) ControlTransfer8_1 added in v0.0.4

func (m *DeviceConnection) ControlTransfer8_1(
	arg0 int32,
	arg1 int32,
	arg2 int32,
	arg3 int32,
	arg4 *jni.Object,
	arg5 int32,
	arg6 int32,
	arg7 int32,
) (int32, error)

ControlTransfer8_1 calls android.hardware.usb.UsbDeviceConnection.controlTransfer.

func (*DeviceConnection) GetFileDescriptor added in v0.0.4

func (m *DeviceConnection) GetFileDescriptor() (int32, error)

GetFileDescriptor calls android.hardware.usb.UsbDeviceConnection.getFileDescriptor.

func (*DeviceConnection) GetRawDescriptors added in v0.0.4

func (m *DeviceConnection) GetRawDescriptors() (*jni.Object, error)

GetRawDescriptors calls android.hardware.usb.UsbDeviceConnection.getRawDescriptors.

func (*DeviceConnection) GetSerial added in v0.0.4

func (m *DeviceConnection) GetSerial() (string, error)

GetSerial calls android.hardware.usb.UsbDeviceConnection.getSerial.

func (*DeviceConnection) ReleaseInterface added in v0.0.4

func (m *DeviceConnection) ReleaseInterface(arg0 *jni.Object) (bool, error)

ReleaseInterface calls android.hardware.usb.UsbDeviceConnection.releaseInterface.

func (*DeviceConnection) RequestWait0 added in v0.0.4

func (m *DeviceConnection) RequestWait0() (*jni.Object, error)

RequestWait0 calls android.hardware.usb.UsbDeviceConnection.requestWait.

func (*DeviceConnection) RequestWait1_1 added in v0.0.4

func (m *DeviceConnection) RequestWait1_1(arg0 int64) (*jni.Object, error)

RequestWait1_1 calls android.hardware.usb.UsbDeviceConnection.requestWait.

func (*DeviceConnection) SetConfiguration added in v0.0.4

func (m *DeviceConnection) SetConfiguration(arg0 *jni.Object) (bool, error)

SetConfiguration calls android.hardware.usb.UsbDeviceConnection.setConfiguration.

func (*DeviceConnection) SetInterface added in v0.0.4

func (m *DeviceConnection) SetInterface(arg0 *jni.Object) (bool, error)

SetInterface calls android.hardware.usb.UsbDeviceConnection.setInterface.

type Endpoint added in v0.0.4

type Endpoint struct {
	VM  *jni.VM
	Obj *jni.GlobalRef
}

Endpoint wraps android.hardware.usb.UsbEndpoint.

func (*Endpoint) DescribeContents added in v0.0.4

func (m *Endpoint) DescribeContents() (int32, error)

DescribeContents calls android.hardware.usb.UsbEndpoint.describeContents.

func (*Endpoint) GetAddress added in v0.0.4

func (m *Endpoint) GetAddress() (int32, error)

GetAddress calls android.hardware.usb.UsbEndpoint.getAddress.

func (*Endpoint) GetAttributes added in v0.0.4

func (m *Endpoint) GetAttributes() (int32, error)

GetAttributes calls android.hardware.usb.UsbEndpoint.getAttributes.

func (*Endpoint) GetDirection added in v0.0.4

func (m *Endpoint) GetDirection() (int32, error)

GetDirection calls android.hardware.usb.UsbEndpoint.getDirection.

func (*Endpoint) GetEndpointNumber added in v0.0.4

func (m *Endpoint) GetEndpointNumber() (int32, error)

GetEndpointNumber calls android.hardware.usb.UsbEndpoint.getEndpointNumber.

func (*Endpoint) GetInterval added in v0.0.4

func (m *Endpoint) GetInterval() (int32, error)

GetInterval calls android.hardware.usb.UsbEndpoint.getInterval.

func (*Endpoint) GetMaxPacketSize added in v0.0.4

func (m *Endpoint) GetMaxPacketSize() (int32, error)

GetMaxPacketSize calls android.hardware.usb.UsbEndpoint.getMaxPacketSize.

func (*Endpoint) GetType added in v0.0.4

func (m *Endpoint) GetType() (int32, error)

GetType calls android.hardware.usb.UsbEndpoint.getType.

func (*Endpoint) ToString added in v0.0.4

func (m *Endpoint) ToString() (string, error)

ToString calls android.hardware.usb.UsbEndpoint.toString.

func (*Endpoint) WriteToParcel added in v0.0.4

func (m *Endpoint) WriteToParcel(arg0 *jni.Object, arg1 int32) error

WriteToParcel calls android.hardware.usb.UsbEndpoint.writeToParcel.

type Interface added in v0.0.4

type Interface struct {
	VM  *jni.VM
	Obj *jni.GlobalRef
}

Interface wraps android.hardware.usb.UsbInterface.

func (*Interface) DescribeContents added in v0.0.4

func (m *Interface) DescribeContents() (int32, error)

DescribeContents calls android.hardware.usb.UsbInterface.describeContents.

func (*Interface) GetAlternateSetting added in v0.0.4

func (m *Interface) GetAlternateSetting() (int32, error)

GetAlternateSetting calls android.hardware.usb.UsbInterface.getAlternateSetting.

func (*Interface) GetEndpoint added in v0.0.4

func (m *Interface) GetEndpoint(arg0 int32) (*jni.Object, error)

GetEndpoint calls android.hardware.usb.UsbInterface.getEndpoint.

func (*Interface) GetEndpointCount added in v0.0.4

func (m *Interface) GetEndpointCount() (int32, error)

GetEndpointCount calls android.hardware.usb.UsbInterface.getEndpointCount.

func (*Interface) GetId added in v0.0.4

func (m *Interface) GetId() (int32, error)

GetId calls android.hardware.usb.UsbInterface.getId.

func (*Interface) GetInterfaceClass added in v0.0.4

func (m *Interface) GetInterfaceClass() (int32, error)

GetInterfaceClass calls android.hardware.usb.UsbInterface.getInterfaceClass.

func (*Interface) GetInterfaceProtocol added in v0.0.4

func (m *Interface) GetInterfaceProtocol() (int32, error)

GetInterfaceProtocol calls android.hardware.usb.UsbInterface.getInterfaceProtocol.

func (*Interface) GetInterfaceSubclass added in v0.0.4

func (m *Interface) GetInterfaceSubclass() (int32, error)

GetInterfaceSubclass calls android.hardware.usb.UsbInterface.getInterfaceSubclass.

func (*Interface) GetName added in v0.0.4

func (m *Interface) GetName() (string, error)

GetName calls android.hardware.usb.UsbInterface.getName.

func (*Interface) ToString added in v0.0.4

func (m *Interface) ToString() (string, error)

ToString calls android.hardware.usb.UsbInterface.toString.

func (*Interface) WriteToParcel added in v0.0.4

func (m *Interface) WriteToParcel(arg0 *jni.Object, arg1 int32) error

WriteToParcel calls android.hardware.usb.UsbInterface.writeToParcel.

type Manager added in v0.0.4

type Manager struct {
	VM  *jni.VM
	Ctx *app.Context
	Obj *jni.GlobalRef
}

Manager wraps android.hardware.usb.UsbManager.

func NewManager added in v0.0.4

func NewManager(ctx *app.Context) (*Manager, error)

NewManager obtains android.hardware.usb.UsbManager from the Android system service manager.

func (*Manager) Close added in v0.0.4

func (m *Manager) Close()

Close releases the global reference to the underlying Java object. After Close, the Manager must not be used.

func (*Manager) GetAccessoryList added in v0.0.4

func (m *Manager) GetAccessoryList() (*jni.Object, error)

GetAccessoryList calls android.hardware.usb.UsbManager.getAccessoryList.

func (*Manager) HasPermission1 added in v0.0.4

func (m *Manager) HasPermission1(arg0 *jni.Object) (bool, error)

HasPermission1 calls android.hardware.usb.UsbManager.hasPermission.

func (*Manager) HasPermission1_1 added in v0.0.4

func (m *Manager) HasPermission1_1(arg0 *jni.Object) (bool, error)

HasPermission1_1 calls android.hardware.usb.UsbManager.hasPermission.

func (*Manager) OpenAccessory added in v0.0.4

func (m *Manager) OpenAccessory(arg0 *jni.Object) (*jni.Object, error)

OpenAccessory calls android.hardware.usb.UsbManager.openAccessory.

func (*Manager) OpenAccessoryInputStream added in v0.0.4

func (m *Manager) OpenAccessoryInputStream(arg0 *jni.Object) (*jni.Object, error)

OpenAccessoryInputStream calls android.hardware.usb.UsbManager.openAccessoryInputStream.

func (*Manager) OpenAccessoryOutputStream added in v0.0.4

func (m *Manager) OpenAccessoryOutputStream(arg0 *jni.Object) (*jni.Object, error)

OpenAccessoryOutputStream calls android.hardware.usb.UsbManager.openAccessoryOutputStream.

func (*Manager) OpenDevice added in v0.0.4

func (m *Manager) OpenDevice(arg0 *jni.Object) (*jni.Object, error)

OpenDevice calls android.hardware.usb.UsbManager.openDevice.

func (*Manager) RequestPermission2 added in v0.0.4

func (m *Manager) RequestPermission2(arg0 *jni.Object, arg1 *jni.Object) error

RequestPermission2 calls android.hardware.usb.UsbManager.requestPermission.

func (*Manager) RequestPermission2_1 added in v0.0.4

func (m *Manager) RequestPermission2_1(arg0 *jni.Object, arg1 *jni.Object) error

RequestPermission2_1 calls android.hardware.usb.UsbManager.requestPermission.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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