device

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package device provides common interfaces and utilities for virtual USB devices.

Index

Constants

View Source
const (
	ExportMetaKey contextKey = iota
	ConnTimerKey
)

Variables

View Source
var ErrWrongDeviceType = errors.New("wrong device type")

Functions

func GetConnTimer

func GetConnTimer(ctx context.Context) *time.Timer

GetConnTimer extracts the connection timer from a device context. Returns nil if the context doesn't contain the timer.

func GetDeviceMeta

func GetDeviceMeta(ctx context.Context) *usbip.ExportMeta

GetDeviceMeta extracts the device metadata from a device context. Returns nil if the context doesn't contain device metadata.

Types

type CreateOptions

type CreateOptions struct {
	IDVendor       *uint16
	IDProduct      *uint16
	DeviceSpecific string
}

type ReportBuilder

type ReportBuilder interface {
	// BuildReport encodes the input state into a byte slice for USB transfer.
	BuildReport() []byte
}

ReportBuilder is an interface for device input states that can build USB reports.

Directories

Path Synopsis
Package keyboard provides a HID keyboard device implementation with full N-key rollover.
Package keyboard provides a HID keyboard device implementation with full N-key rollover.
Package mouse provides a HID mouse device implementation.
Package mouse provides a HID mouse device implementation.
Package ns2pro provides a Nintendo Switch 2 Pro Controller compatible HID device.
Package ns2pro provides a Nintendo Switch 2 Pro Controller compatible HID device.
Package xbox360 provides an Xbox 360 controller device implementation.
Package xbox360 provides an Xbox 360 controller device implementation.

Jump to

Keyboard shortcuts

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