Skip to content

Commit

Permalink
q-dev: interface matches
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Oct 14, 2024
1 parent ace4332 commit 3dfc8e0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions qubesadmin/device_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,18 @@ def _load_classes(bus: str):

return result

def matches(self, other: 'DeviceInterface') -> bool:
pattern = repr(self)
candidate = repr(other)
if len(pattern) != len(candidate):
return False
for p, c in zip(pattern, candidate):
if p == '*':
continue
if p != c:
return False
return True


class DeviceInfo(VirtualDevice):
""" Holds all information about a device """
Expand Down

0 comments on commit 3dfc8e0

Please sign in to comment.