[pve-devel] [PATCH] usb-tablet : always use uhci controller

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


usb-tablet on ehci is buggy

also convert uhci controller -usb syntax to -device syntax, to allow hotplug of usb-tablet

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

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 14735d2..451efda 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2192,6 +2192,9 @@ sub config_to_command {
 
     push @$cmd, '-daemonize';
 
+    $pciaddr = print_pci_addr("piix3", $bridges);
+    push @$devices, '-device', "piix3-usb-uhci,id=uhci$pciaddr.0x2";
+
     my $use_usb2 = 0;
     for (my $i = 0; $i < $MAX_USB_DEVICES; $i++)  {
 	next if !$conf->{"usb$i"};
@@ -2202,13 +2205,7 @@ sub config_to_command {
 
     # enable absolute mouse coordinates (needed by vnc)
     my $tablet = defined($conf->{tablet}) ? $conf->{tablet} : $defaults->{tablet};
-    if ($tablet) {
-	if ($use_usb2) {
-	    push @$devices, '-device', 'usb-tablet,bus=ehci.0,port=6';
-	} else {
-	    push @$devices, '-usbdevice', '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++)  {
@@ -2526,7 +2523,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;
     }
@@ -3356,7 +3353,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