From 9996d1404b53d96284dd335a481b4724f01f76f1 Mon Sep 17 00:00:00 2001 From: Piotr Bartman Date: Fri, 12 Apr 2024 05:55:12 +0200 Subject: [PATCH] q-dev: fix global config --- qubes_config/global_config/usb_devices.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qubes_config/global_config/usb_devices.py b/qubes_config/global_config/usb_devices.py index 2d86226f..99a53811 100644 --- a/qubes_config/global_config/usb_devices.py +++ b/qubes_config/global_config/usb_devices.py @@ -24,6 +24,7 @@ from typing import List, Union, Optional, Dict, Tuple, Set from qrexec.policy.parser import Allow +from qubesadmin.device_protocol import DeviceCategory from ..widgets.gtk_widgets import TokenName, TextModeler, VMListModeler from ..widgets.utils import get_feature, apply_feature_change @@ -628,7 +629,7 @@ def __init__(self, qapp: qubesadmin.Qubes, policy_manager: PolicyManager, gtk_builder: Gtk.Builder - ): + ): self.qapp = qapp self.policy_manager = policy_manager @@ -637,8 +638,9 @@ def __init__(self, usb_qubes: Set[qubesadmin.vm.QubesVM] = set() for vm in self.qapp.domains: - for device in vm.devices['pci'].get_attached_devices(): - if device.description.startswith('USB controller'): + for assignment in vm.devices['pci'].get_attached_devices(): + if any(infc.category for infc in assignment.device.interfaces + ) == DeviceCategory.PCI_USB: usb_qubes.add(vm) self.input_handler = InputDeviceHandler(