mirror of
https://github.com/utmapp/UTM.git
synced 2026-10-12 02:24:01 +00:00
This change implements USB device passthrough for macOS 15+ using the Virtualization framework private APIs. Changes include: - `UTMIOUSBHostManager`: Uses IOKit to dynamically manage connected USB devices. Instead of relying on private framework headers, it uses Objective-C reflection to safely instantiate `_VZIOUSBHostPassthroughDeviceConfiguration` and `_VZIOUSBHostPassthroughDevice`, and configures delegates for `VZUSBController`. - `UTMIOUSBHostDevice`: Represents an IOKit USB device, conforming to `NSSecureCoding` and `NSCopying`. It safely reads properties such as location ID and port directly from the IORegistry. - `UTMAppleVirtualMachine`: Now initializes `UTMIOUSBHostManager` and restores captured USB devices asynchronously before VM startup. State is archived directly into the registry. - `VMDisplayAppleWindowController`: Added a new USB menu populated with current devices to allow interactively connecting and disconnecting USB devices on the fly. - `UTMRegistryEntry`: Extended to support archiving and unarchiving of connected USB devices. Co-authored-by: Gemini <[email protected]>