diff --git a/qubesadmin/device_protocol.py b/qubesadmin/device_protocol.py index 55e7c7f8..4e031c5d 100644 --- a/qubesadmin/device_protocol.py +++ b/qubesadmin/device_protocol.py @@ -534,7 +534,7 @@ def serialize(self) -> bytes: ('devclass', self.devclass))) properties += b' ' + DeviceSerializer.pack_property( - 'backend_domain', self.backend_domain.name) + 'backend_domain', self.backend_name) return properties @@ -1252,12 +1252,12 @@ def _deserialize( return cls(**properties) def matches(self, device: VirtualDevice) -> bool: + if self.devclass != device.devclass: + return False if self.backend_domain != '*' and self.backend_domain != device.backend_domain: return False if self.port_id != '*' and self.port_id != device.port_id: return False - if self.devclass != '*' and self.devclass != device.devclass: - return False if self.device_id != '*' and self.device_id != device.device_id: return False return True diff --git a/qubesadmin/tools/qvm_device.py b/qubesadmin/tools/qvm_device.py index 70954926..151f6799 100644 --- a/qubesadmin/tools/qvm_device.py +++ b/qubesadmin/tools/qvm_device.py @@ -223,7 +223,7 @@ def assign_device(args): if args.only_port: device.device_id = None if args.only_device: - device.port = None + device.port = Port(None, None, device.devclass) options = dict(opt.split('=', 1) for opt in args.option or []) if args.ro: options['read-only'] = 'yes'