[PATCH container 1/1] Signed-off-by: Hugo Lecourt <hugo.lecourt at hugolecourt.fr>

Hugo Lecourt hugo.lecourt at hugolecourt.fr
Mon Mar 25 18:07:44 CET 2019


BUG 1:
All usb port is pass to the command line of qemu with "bus=xhci.0"
So all USB 2/3 are add as USB 3

BUG 2:
If BUG 1 solved and vm machine type is q35 (only q35-pc-2.11 tested),
then USB 2 have no bus definition and are add as USB 3
---
 PVE/QemuServer/USB.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/PVE/QemuServer/USB.pm b/PVE/QemuServer/USB.pm
index 9eaaccc..d68fefc 100644
--- a/PVE/QemuServer/USB.pm
+++ b/PVE/QemuServer/USB.pm
@@ -90,6 +90,12 @@ sub get_usb_devices {
 	if (defined($d->{host})) {
 	    my $hostdevice = parse_usb_device($d->{host});
 	    $hostdevice->{usb3} = $d->{usb3};
+
+      # define by default $d->{usb3} to 0
+      if (!defined($d->{usb3})) {
+        $d->{usb3} = 0;
+      }
+
 	    if (defined($hostdevice->{spice}) && $hostdevice->{spice}) {
 		# usb redir support for spice, currently no usb3
 		push @$devices, '-chardev', "spicevmc,id=usbredirchardev$i,name=usbredir";
@@ -112,6 +118,8 @@ sub print_usbdevice_full {
     # if it is a usb3 device, attach it to the xhci controller, else omit the bus option
     if($device->{usb3}) {
 	$usbdevice .= ",bus=xhci.0";
+    } else {
+  $usbdevice .= ",bus=ehci.0"; #define bus to ehci.0, else usb2 in q35 is add as usb3
     }
 
     if (defined($device->{vendorid}) && defined($device->{productid})) {
-- 
2.17.1




More information about the pve-user mailing list