Skip to content

Commit

Permalink
q-dev: update device_protocol.py
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Oct 15, 2024
1 parent cc65d08 commit be25600
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions qubes/device_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def __eq__(self, other):
def __lt__(self, other):
if isinstance(other, Port):
return (self.backend_name, self.devclass, self.port_id) < \
(self.backend_name, other.devclass, other.port_id)
(other.backend_name, other.devclass, other.port_id)
raise TypeError(f"Comparing instances of 'Port' and '{type(other)}' "
"is not supported")

Expand Down Expand Up @@ -1167,13 +1167,14 @@ def device_id(self) -> str:
def devices(self) -> List[DeviceInfo]:
"""Get DeviceInfo objects corresponding to this DeviceAssignment"""
if self.port_id != '*':
# could return UnknownDevice
return [self.backend_domain.devices[self.devclass][self.port_id]]
dv = self.backend_domain.devices[self.devclass][self.port_id]
if isinstance(dv, UnknownDevice) or dv.device_id == self.device_id:
return [dv]
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:
if self.matches(dev):
result.append(dev)
return result

Expand Down

0 comments on commit be25600

Please sign in to comment.