[pve-devel] [PATCH] don't use usb2 as default and always plug table on usb1

Alexandre Derumier aderumier at odiso.com
Fri Feb 22 10:15:22 CET 2013


- Only use ehci if usb-passthrough is needed
- always plug tablet on uhci

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 5e02734..07b1754 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2194,11 +2194,20 @@ sub config_to_command {
 
     push @$cmd, '-daemonize';
 
-    push @$devices, '-readconfig', '/usr/share/qemu-server/pve-usb.cfg';
+    my $use_usb2 = 0;
+    for (my $i = 0; $i < $MAX_USB_DEVICES; $i++)  {
+	next if !$conf->{"usb$i"};
+	$use_usb2 = 1;
+    }
+
+    $pciaddr = print_pci_addr("piix3", $bridges);
+    push @$devices, '-device', "piix3-usb-uhci,id=uhci$pciaddr.0x2";
+
+    push @$devices, '-readconfig', '/usr/share/qemu-server/pve-usb.cfg' if $use_usb2;
 
     # enable absolute mouse coordinates (needed by vnc)
     my $tablet = defined($conf->{tablet}) ? $conf->{tablet} : $defaults->{tablet};
-    push @$devices, '-device', 'usb-tablet,id=tablet,bus=ehci.0,port=6' if $tablet;
+    push @$devices, '-device', 'usb-tablet,id=tablet,bus=uhci.0,port=2' if $tablet;
 
     # host pci devices
     for (my $i = 0; $i < $MAX_HOSTPCI_DEVICES; $i++)  {
@@ -2516,7 +2525,7 @@ sub vm_deviceplug {
     return 1 if !check_running($vmid);
 
     if ($deviceid eq 'tablet') {
-	my $devicefull = "usb-tablet,id=tablet,bus=ehci.0,port=6";
+	my $devicefull = "usb-tablet,id=tablet,bus=uhci.0,port=2";
 	qemu_deviceadd($vmid, $devicefull);
 	return 1;
     }
@@ -3348,7 +3357,7 @@ sub print_pci_addr {
 
     my $res = '';
     my $devices = {
-	#addr1 : ide,parallel,serial (motherboard)
+	piix3 => { bus => 0, addr => 1 },
 	#addr2 : first videocard
 	balloon0 => { bus => 0, addr => 3 },
 	watchdog => { bus => 0, addr => 4 },
-- 
1.7.10.4




More information about the pve-devel mailing list