[pve-devel] [PATCH] usb2.0 as default + usb-tablet hotplug/unplug

Dietmar Maurer dietmar at proxmox.com
Mon Feb 18 07:11:02 CET 2013


see inline comments:

> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -1100,8 +1100,13 @@ __PACKAGE__->register_method({
>  	    # also redirect stderr (else we get RFB protocol errors)
>  	    my $cmd = ['/bin/nc', '-l', '-p', $port, '-w', $timeout, '-c', "$qmstr
> 2>/dev/null"];
> 
> +	    my $conf = PVE::QemuServer::load_config($vmid);
> +	    PVE::QemuServer::qemu_deviceadd($vmid,
> +"usb-tablet,id=usb-tablet,bus=ehci.0,port=6") if
> +!defined($conf->{tablet});
> +
>  	    PVE::Tools::run_command($cmd);
> 
> +	    PVE::QemuServer::qemu_devicedel($vmid, "usb-tablet") if
> +!defined($conf->{tablet});

What if you have another open console!

> +
>  	    return;
>  	};
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index
> ebd7a83..176b068 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2192,23 +2192,13 @@ sub config_to_command {
> 
>      push @$cmd, '-daemonize';
> 
> -    my $use_usb2 = 0;
> -    for (my $i = 0; $i < $MAX_USB_DEVICES; $i++)  {
> -	next if !$conf->{"usb$i"};
> -	$use_usb2 = 1;
> -    }
>      # include usb device config
> -    push @$devices, '-readconfig', '/usr/share/qemu-server/pve-usb.cfg' if
> $use_usb2;

/usr/share/qemu-server/pve-usb.cfg define several uhci controllers. What happens to them?

> +    $pciaddr = print_pci_addr("ehci", $bridges);
> +    push @$devices, '-device', "usb-ehci,id=ehci$pciaddr";
> 
>      # enable absolute mouse coordinates (needed by vnc)
> -    my $tablet = defined($conf->{tablet}) ? $conf->{tablet} : $defaults-
> >{tablet};

Why do you need this line?

> -    if ($tablet) {
> -	if ($use_usb2) {
> -	    push @$devices, '-device', 'usb-tablet,bus=ehci.0,port=6';
> -	} else {
> -	    push @$devices, '-usbdevice', 'tablet';
> -	}
> -    }
> +    my $tablet = $conf->{tablet} if defined($conf->{tablet});
> +    push @$devices, '-device',
> + 'usb-tablet,id=usb-tablet,bus=ehci.0,port=6' if $tablet;

why not simply: if $conf->{tablet};

> 
>      # host pci devices
>      for (my $i = 0; $i < $MAX_HOSTPCI_DEVICES; $i++)  { @@ -3376,6 +3366,7
> @@ sub print_pci_addr {
>  	net3 => { bus => 0, addr => 21 },
>  	net4 => { bus => 0, addr => 22 },
>  	net5 => { bus => 0, addr => 23 },
> +	ehci => { bus => 0, addr => 29 },
>  	#addr29 : usb-host (pve-usb.cfg)






More information about the pve-devel mailing list