mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2025-01-25 06:03:52 +03:00
add qemu_usb_hotplug
this adds a function for hotplugging usb devices Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
deb091c500
commit
16521d6353
@ -3598,6 +3598,31 @@ sub qemu_netdevdel {
|
||||
vm_mon_cmd($vmid, "netdev_del", id => $deviceid);
|
||||
}
|
||||
|
||||
sub qemu_usb_hotplug {
|
||||
my ($storecfg, $conf, $vmid, $deviceid, $device) = @_;
|
||||
|
||||
return if !$device;
|
||||
|
||||
# remove the old one first
|
||||
vm_deviceunplug($vmid, $conf, $deviceid);
|
||||
|
||||
# check if xhci controller is necessary and available
|
||||
if ($device->{usb3}) {
|
||||
|
||||
my $devicelist = vm_devices_list($vmid);
|
||||
|
||||
if (!$devicelist->{xhci}) {
|
||||
my $pciaddr = print_pci_addr("xhci");
|
||||
qemu_deviceadd($vmid, "nec-usb-xhci,id=xhci$pciaddr");
|
||||
}
|
||||
}
|
||||
my $d = parse_usb_device($device->{host});
|
||||
$d->{usb3} = $device->{usb3};
|
||||
|
||||
# add the new one
|
||||
vm_deviceplug($storecfg, $conf, $vmid, $deviceid, $d);
|
||||
}
|
||||
|
||||
sub qemu_cpu_hotplug {
|
||||
my ($vmid, $conf, $vcpus) = @_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user