Ensure sensible default USB controller model used (#1362)

When users adding devices either via the pass through or USB redirector
approach, ensure a default controller is added using the xhci stack.
This should work for all versions of USB, where as the previous default
of piix3-uhci appears to only work for some USB 1 controllers.

Fixes: #1346
This commit is contained in:
Darragh Bailey
2021-09-27 16:49:15 +01:00
committed by GitHub
parent 5a51c6c617
commit de4721f62e
3 changed files with 68 additions and 6 deletions

View File

@@ -563,7 +563,7 @@ module VagrantPlugins
end
@usbctl_dev[:model] = options[:model]
@usbctl_dev[:ports] = options[:ports]
@usbctl_dev[:ports] = options[:ports] if options[:ports]
end
def usb(options = {})
@@ -915,9 +915,6 @@ module VagrantPlugins
# Watchdog device
@watchdog_dev = {} if @watchdog_dev == UNSET_VALUE
# USB controller
@usbctl_dev = {} if @usbctl_dev == UNSET_VALUE
# USB device passthrough
@usbs = [] if @usbs == UNSET_VALUE
@@ -925,6 +922,11 @@ module VagrantPlugins
@redirdevs = [] if @redirdevs == UNSET_VALUE
@redirfilters = [] if @redirfilters == UNSET_VALUE
# USB controller
if @usbctl_dev == UNSET_VALUE
@usbctl_dev = if !@usbs.empty? or !@redirdevs.empty? then {:model => 'qemu-xhci'} else {} end
end
# smartcard device
@smartcard_dev = {} if @smartcard_dev == UNSET_VALUE