usbpassthrough

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package usbpassthrough provides runtime USB passthrough helpers.

It is intended to wrap the private USB controller, XHCI controller, and host passthrough device configuration APIs so callers can capture host USB devices and attach or detach them from a running virtual machine.

The package should cover:

Host device discovery and lookup
Passthrough device capture and release
Live attach and detach through a controller

This package handles runtime USB passthrough. Static USB-backed storage configuration remains separate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeviceSignature

func DeviceSignature(cfg pvz.VZIOUSBHostPassthroughDeviceConfiguration) []byte

DeviceSignature returns the opaque signature bytes for a host passthrough configuration.

func NewControllerConfiguration

func NewControllerConfiguration() pvz.VZXHCIControllerConfiguration

NewControllerConfiguration creates an XHCI controller configuration.

func NewHostPassthroughConfigurationFromLocationID

func NewHostPassthroughConfigurationFromLocationID(locationID uint32) (pvz.VZIOUSBHostPassthroughDeviceConfiguration, error)

NewHostPassthroughConfigurationFromLocationID creates a host passthrough configuration from a location ID.

func NewHostPassthroughConfigurationFromService

func NewHostPassthroughConfigurationFromService(service uint32) (pvz.VZIOUSBHostPassthroughDeviceConfiguration, error)

NewHostPassthroughConfigurationFromService creates a host passthrough configuration from a service ID.

func NewUSBPassthroughConfigurationFromDevice

func NewUSBPassthroughConfigurationFromDevice(device objectivec.IObject) (pvz.VZUSBPassthroughDeviceConfiguration, error)

NewUSBPassthroughConfigurationFromDevice creates a passthrough configuration for an accessory device.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller wraps a live XHCI controller.

func NewController

func NewController(config pvz.VZXHCIControllerConfiguration, vm objectivec.IObject, index uint64, devices objectivec.IObject) (Controller, error)

NewController creates a live XHCI controller for a VM.

func (Controller) Attach

func (c Controller) Attach(ctx context.Context, device objectivec.IObject) error

Attach attaches a device to the controller.

func (Controller) Capture

func (c Controller) Capture(ctx context.Context) error

Capture asks the controller to capture host passthrough devices.

func (Controller) Detach

func (c Controller) Detach(ctx context.Context, device objectivec.IObject) error

Detach detaches a device from the controller.

func (Controller) Raw

Raw returns the underlying controller.

func (Controller) Release

func (c Controller) Release()

Release releases captured passthrough devices.

type HostDevice

type HostDevice struct {
	// contains filtered or unexported fields
}

HostDevice wraps a live host USB passthrough device.

func NewHostDevice

NewHostDevice creates a passthrough device from configuration.

func NewHostDeviceWithLocationID

func NewHostDeviceWithLocationID(locationID uint32) (HostDevice, error)

NewHostDeviceWithLocationID is a convenience wrapper for location-based lookup.

func NewHostDeviceWithService

func NewHostDeviceWithService(service uint32) (HostDevice, error)

NewHostDeviceWithService is a convenience wrapper for service-based lookup.

func (HostDevice) Configuration

Configuration returns the attached configuration, if any.

func (HostDevice) Raw

Raw returns the underlying host passthrough device.

func (HostDevice) Release

func (d HostDevice) Release()

Release asks the device to release the host USB device.

Jump to

Keyboard shortcuts

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