Documentation
¶
Index ¶
- func Enumerate(options ...EnumerateOption) iter.Seq2[*DeviceInfo, error]
- func WithContext(ctx context.Context, device ContextReadWriter) io.ReadWriter
- type ContextReadWriter
- type Device
- type DeviceEvent
- type DeviceEventType
- type DeviceInfo
- type DeviceSnapshot
- type EnumerateOption
- func WithInstanceID(instanceID string) EnumerateOption
- func WithInterfaceNumber(interfaceNbr int) EnumerateOption
- func WithManufacturerString(mfrStr string) EnumerateOption
- func WithParentDeviceID(parentDeviceID string) EnumerateOption
- func WithPath(path string) EnumerateOption
- func WithProductID(productID uint16) EnumerateOption
- func WithProductString(productStr string) EnumerateOption
- func WithReleaseNumber(releaseNbr uint16) EnumerateOption
- func WithSerialNumber(serialNbr string) EnumerateOption
- func WithUsage(usage uint16) EnumerateOption
- func WithUsagePage(usagePage uint16) EnumerateOption
- func WithVendorID(vendorID uint16) EnumerateOption
- type Snapshot
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enumerate ¶
func Enumerate(options ...EnumerateOption) iter.Seq2[*DeviceInfo, error]
func WithContext ¶
func WithContext(ctx context.Context, device ContextReadWriter) io.ReadWriter
WithContext binds ctx to device and adapts it to io.ReadWriter. Read and Write delegate directly to device without adding context checks.
Types ¶
type ContextReadWriter ¶
type ContextReadWriter interface {
Read(context.Context, []byte) (int, error)
Write(context.Context, []byte) (int, error)
}
ContextReadWriter reads and writes HID reports using a context.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func (*Device) SendFeatureReport ¶
type DeviceEvent ¶
type DeviceEvent struct {
Type DeviceEventType
DeviceInfo *DeviceInfo
MetadataErr error
}
type DeviceEventType ¶
type DeviceEventType string
const ( DeviceEventConnected DeviceEventType = "connected" DeviceEventDisconnected DeviceEventType = "disconnected" )
type DeviceInfo ¶
type DeviceInfo struct {
Path string // Platform-Specific Device Path
VendorID uint16 // Device Vendor ID
ProductID uint16 // Device Product ID
SerialNbr string // Serial Number
ReleaseNbr uint16 // Device Version Number
MfrStr string // Manufacturer String
ProductStr string // Product String
UsagePage uint16 // Usage Page for Device/Interface
Usage uint16 // Usage for Device/Interface
InterfaceNbr int // USB Interface Number
InstanceID string
ParentDeviceID string
}
type DeviceSnapshot ¶
type DeviceSnapshot struct {
DeviceInfo *DeviceInfo
MetadataErr error
}
DeviceSnapshot describes one device in a Watcher's initial snapshot. MetadataErr means that the device is present but some metadata is incomplete.
type EnumerateOption ¶
type EnumerateOption func(*enumerateOptions)
func WithInstanceID ¶
func WithInstanceID(instanceID string) EnumerateOption
func WithInterfaceNumber ¶
func WithInterfaceNumber(interfaceNbr int) EnumerateOption
func WithManufacturerString ¶
func WithManufacturerString(mfrStr string) EnumerateOption
func WithParentDeviceID ¶
func WithParentDeviceID(parentDeviceID string) EnumerateOption
func WithPath ¶
func WithPath(path string) EnumerateOption
func WithProductID ¶
func WithProductID(productID uint16) EnumerateOption
func WithProductString ¶
func WithProductString(productStr string) EnumerateOption
func WithReleaseNumber ¶
func WithReleaseNumber(releaseNbr uint16) EnumerateOption
func WithSerialNumber ¶
func WithSerialNumber(serialNbr string) EnumerateOption
func WithUsage ¶
func WithUsage(usage uint16) EnumerateOption
func WithUsagePage ¶
func WithUsagePage(usagePage uint16) EnumerateOption
func WithVendorID ¶
func WithVendorID(vendorID uint16) EnumerateOption
type Snapshot ¶
type Snapshot struct {
Devices []DeviceSnapshot
}
Snapshot is the initial device state captured by Watch.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.