From 127beb7a2b87f32c12c29f5719b97aa03f425d29 Mon Sep 17 00:00:00 2001 From: Piotr Bartman-Szwarc Date: Wed, 14 Aug 2024 21:58:28 +0200 Subject: [PATCH] q-dev: implements device_id --- qubesmanager/device_list.py | 6 +++--- qubesmanager/settings.py | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/qubesmanager/device_list.py b/qubesmanager/device_list.py index c32fd249..21e6a7d2 100644 --- a/qubesmanager/device_list.py +++ b/qubesmanager/device_list.py @@ -43,10 +43,10 @@ def fill_device_list(self): for i in range(self.dev_list.selected_list.count()): text = self.dev_list.selected_list.item(i).text() - ident = self.dev_list.selected_list.item(i).dev.ident + port_id = self.dev_list.selected_list.item(i).dev.port_id self.device_list.addItem(text) - self.ident_list[text] = ident - if ident in self.no_strict_reset_list: + self.ident_list[text] = port_id + if port_id in self.no_strict_reset_list: self.device_list.item(self.device_list.count()-1).setSelected( True) diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 358d25ec..3a776afa 100644 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -1218,7 +1218,7 @@ def __init_devices_tab__(self): class DevListWidgetItem(QtWidgets.QListWidgetItem): def __init__(self, dev, unknown=False, parent=None): super().__init__(parent) - name = dev.ident.replace('_', ":") + ' ' + dev.description + name = dev.port_id.replace('_', ":") + ' ' + dev.description if unknown: name += ' (unknown)' self.setText(name) @@ -1270,32 +1270,32 @@ def __apply_devices_tab__(self): for dev in new_devs: if dev not in old_devs: options = {} - if dev.ident in self.new_strict_reset_list: + if dev.port_id in self.new_strict_reset_list: options['no-strict-reset'] = True ass = devices.DeviceAssignment( - self.vm.app.domains['dom0'], - dev.ident, devclass='pci', - attach_automatically=True, required=True, + devices.Port( + self.vm.app.domains['dom0'], dev.port_id, 'pci'), + mode='required', options=options) self.vm.devices['pci'].assign(ass) - elif (dev.ident in self.current_strict_reset_list) != \ - (dev.ident in self.new_strict_reset_list): + elif (dev.port_id in self.current_strict_reset_list) != \ + (dev.port_id in self.new_strict_reset_list): current_assignment = None for assignment in self.vm.devices[ 'pci'].get_assigned_devices(required_only=True): - if assignment.ident == dev.ident: + if assignment.port_id == dev.port_id: current_assignment = assignment break if current_assignment is None: # it would be very weird if this happened msg.append(self.tr("Error re-assigning device ") + - dev.ident) + dev.port_id) continue self.vm.devices['pci'].unassign(current_assignment) current_assignment.options['no-strict-reset'] = \ - dev.ident in self.new_strict_reset_list + dev.port_id in self.new_strict_reset_list self.vm.devices['pci'].assign(current_assignment) @@ -1337,7 +1337,7 @@ def define_strict_reset_devices(self): required_only=True): if assignment.options.get('no-strict-reset', False): self.current_strict_reset_list.append( - assignment.ident.replace('_', ':')) + assignment.port_id.replace('_', ':')) self.new_strict_reset_list = self.current_strict_reset_list.copy() def strict_reset_button_pressed(self):