From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server 4/5] usb: factor out the default usb bus of the tablet
Date: Thu, 15 Oct 2026 09:52:18 +0200 [thread overview]
Message-ID: <20261015075428.572882-5-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261015075428.572882-1-d.csapak@proxmox.com>
The bus of the tablet depends on which USB controllers exist, which is
decided in get_usb_controllers. Move the choice next to it, so both can
be adapted together when the controllers change.
No functional change intended.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/PVE/QemuServer.pm | 10 +---------
src/PVE/QemuServer/USB.pm | 9 +++++++++
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 39096199..4a67d3a0 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -1182,15 +1182,7 @@ sub assert_clipboard_config {
sub print_tabletdevice_full {
my ($conf, $arch) = @_;
- my $q35 = PVE::QemuServer::Machine::machine_type_is_q35($conf);
-
- # we use uhci for old VMs because tablet driver was buggy in older qemu
- my $usbbus;
- if ($q35 || $arch eq 'aarch64') {
- $usbbus = 'ehci';
- } else {
- $usbbus = 'uhci';
- }
+ my $usbbus = PVE::QemuServer::USB::get_default_usb_bus($conf, $arch);
return "usb-tablet,id=tablet,bus=$usbbus.0,port=1";
}
diff --git a/src/PVE/QemuServer/USB.pm b/src/PVE/QemuServer/USB.pm
index bf2741f6..0ab43614 100644
--- a/src/PVE/QemuServer/USB.pm
+++ b/src/PVE/QemuServer/USB.pm
@@ -119,6 +119,15 @@ my sub assert_usb_index_is_useable {
return undef;
}
+sub get_default_usb_bus {
+ my ($conf, $arch) = @_;
+
+ my $q35 = PVE::QemuServer::Machine::machine_type_is_q35($conf);
+
+ # we use uhci for old VMs because tablet driver was buggy in older qemu
+ return $q35 || $arch eq 'aarch64' ? 'ehci' : 'uhci';
+}
+
sub get_usb_controllers {
my ($conf, $arch, $machine_version) = @_;
--
2.47.3
next prev parent reply other threads:[~2026-10-15 7:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 7:52 [PATCH qemu-server 0/5] small cleanup/refactor/fixes Dominik Csapak
2026-10-15 7:52 ` [PATCH qemu-server 1/5] helpers: factor out the version parts parsing Dominik Csapak
2026-10-15 7:52 ` [PATCH qemu-server 2/5] usb: drop always-true spice_usb3 feature flag Dominik Csapak
2026-10-15 7:52 ` [PATCH qemu-server 3/5] net: use version guard for the machine version checks of NICs Dominik Csapak
2026-10-15 7:52 ` Dominik Csapak [this message]
2026-10-15 7:52 ` [PATCH qemu-server 5/5] drive device: check the machine version for blockdev only once Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261015075428.572882-5-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.