Documentation
¶
Overview ¶
Package usbhid provides safe HID input event helpers for Apple Virtualization framework virtual machines.
It wraps the private VZVirtualMachine send* methods with state guards that return errors instead of crashing when the VM is not running or not yet accepting HID reports.
All methods dispatch on the caller-supplied vm.Queue so they are safe to call from any goroutine.
Index ¶
- Variables
- type Sender
- func (s *Sender) Ready() bool
- func (s *Sender) SendDigitizerEvents(events unsafe.Pointer, deviceIndex uint32) error
- func (s *Sender) SendKeyboardEvents(events unsafe.Pointer, keyboardID uint32) error
- func (s *Sender) SendMouseEvents(events unsafe.Pointer, deviceIndex uint32) error
- func (s *Sender) SendPointerNSEvent(event objectivec.IObject, deviceIndex uint32) error
- func (s *Sender) SendScrollWheelEvents(events unsafe.Pointer, deviceIndex uint32) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrVMNotRunning = errors.New("vm not running") ErrNotReady = errors.New("vm not accepting HID reports") )
Functions ¶
This section is empty.
Types ¶
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender sends HID events to a virtual machine.
func NewSender ¶
func NewSender(queue *vm.Queue, vm vz.VZVirtualMachine) *Sender
NewSender creates a new HID event sender for a running VM.
func (*Sender) SendDigitizerEvents ¶
SendDigitizerEvents sends digitizer (mouse/touch) events to the VM. The events parameter is an NSArray of digitizer event objects and deviceIndex identifies which pointing device to target (typically 0).
func (*Sender) SendKeyboardEvents ¶
SendKeyboardEvents sends keyboard events to the VM. The events parameter is an NSArray of keyboard event objects and keyboardID identifies which keyboard device to target (typically 0).
func (*Sender) SendMouseEvents ¶
SendMouseEvents sends mouse events to the VM. The events parameter is an NSArray of mouse event objects and deviceIndex identifies which pointing device to target (typically 0).
func (*Sender) SendPointerNSEvent ¶
func (s *Sender) SendPointerNSEvent(event objectivec.IObject, deviceIndex uint32) error
SendPointerNSEvent forwards an AppKit NSEvent to the VM as pointer input. The event is sent directly (not wrapped in an array) and deviceIndex identifies which pointing device to target (typically 0).
func (*Sender) SendScrollWheelEvents ¶
SendScrollWheelEvents sends scroll wheel events to the VM. The events parameter is an NSArray of scroll wheel event objects and deviceIndex identifies which pointing device to target (typically 0).