From b89a89c851a69527b5824763d2d927a1833c755e Mon Sep 17 00:00:00 2001 From: Piotr Bartman Date: Mon, 25 Mar 2024 06:58:36 +0100 Subject: [PATCH] q-dev: broder allowance of names --- qubes/device_protocol.py | 8 ++++++-- qubes/ext/pci.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/qubes/device_protocol.py b/qubes/device_protocol.py index bea5e61c3..368267a3b 100644 --- a/qubes/device_protocol.py +++ b/qubes/device_protocol.py @@ -358,7 +358,8 @@ def _load_classes(bus: str): class DeviceInfo(Device): """ Holds all information about a device """ - ALLOWED_CHARS_PARAM = Device.ALLOWED_CHARS_PARAM + string.punctuation + ' ' + ALLOWED_CHARS_KEY = Device.ALLOWED_CHARS_KEY + string.punctuation + ' ' + ALLOWED_CHARS_PARAM = Device.ALLOWED_CHARS_PARAM + string.punctuation + ' ' def __init__( self, @@ -655,7 +656,10 @@ def self_identity(self) -> str: def serialize_str(value: str): - return repr(str(value)) + result = repr(str(value)) + if result.startswith('"'): + result = "'" + result[1:-1] + "'" + return result def deserialize_str(value: str): diff --git a/qubes/ext/pci.py b/qubes/ext/pci.py index 1d76bdc79..9cba325f5 100644 --- a/qubes/ext/pci.py +++ b/qubes/ext/pci.py @@ -299,11 +299,11 @@ def _load_desc(self) -> Dict[str, str]: self._vendor = result["vendor"] = hostdev_xml.findtext( 'capability/vendor') self._vendor_id = result["vendor ID"] = hostdev_xml.xpath( - "//vendor/@id") + "//vendor/@id")[0] self._product = result["product"] = hostdev_xml.findtext( 'capability/product') self._product_id = result["product ID"] = hostdev_xml.xpath( - "//product/@id") + "//product/@id")[0] return result @staticmethod