From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id CF7641FF0DF for ; Thu, 15 Oct 2026 09:54:47 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 346792156C; Thu, 15 Oct 2026 09:54:34 +0200 (CEST) From: Dominik Csapak 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 Message-ID: <20261015075428.572882-5-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261015075428.572882-1-d.csapak@proxmox.com> References: <20261015075428.572882-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.372 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: MF7W5WS2WHUQIFSM2Y4FYTPACD6LIBLE X-Message-ID-Hash: MF7W5WS2WHUQIFSM2Y4FYTPACD6LIBLE X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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