From 5f769805f4ee16fafbb57fb58302e91f6c274e9f Mon Sep 17 00:00:00 2001 From: Piotr Bartman-Szwarc Date: Wed, 21 Aug 2024 20:51:54 +0200 Subject: [PATCH] q-dev: fix block auto-attach --- qubesadmin/device_protocol.py | 4 +++- qubesadmin/events/__init__.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qubesadmin/device_protocol.py b/qubesadmin/device_protocol.py index 1c4c6386..70d01cdc 100644 --- a/qubesadmin/device_protocol.py +++ b/qubesadmin/device_protocol.py @@ -915,7 +915,7 @@ def serialize(self) -> bytes: if getattr(self, key) != getattr(default, key))) if self.attachment: - properties = DeviceSerializer.pack_property( + properties += b' ' + DeviceSerializer.pack_property( 'attachment', self.attachment.name) properties += b' ' + DeviceSerializer.pack_property( @@ -1142,6 +1142,8 @@ def devices(self) -> List[DeviceInfo]: # could return UnknownDevice return [self.backend_domain.devices[self.devclass][self.port_id]] result = [] + if self.device_id == "0000:0000::?******": + return result for dev in self.backend_domain.devices[self.devclass]: if dev.device_id == self.device_id: result.append(dev) diff --git a/qubesadmin/events/__init__.py b/qubesadmin/events/__init__.py index 49feb806..e15ef8ec 100644 --- a/qubesadmin/events/__init__.py +++ b/qubesadmin/events/__init__.py @@ -240,7 +240,7 @@ def handle(self, subject, event, **kwargs): self.app.domains, blind=True) kwargs['device'] = self.app.domains.get_blind( - device.backend_domain).devices[devclass][device.port_id] + device.backend_name).devices[devclass][device.port_id] if 'port' in kwargs: devclass = event.split(':', 1)[1] kwargs['port'] = Port.from_str(