Skip to content

Commit

Permalink
q-dev: device protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Mar 20, 2024
1 parent 14a9406 commit 505e4f8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions qubesusbproxy/core3ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import tempfile
from typing import List, Optional, Dict, Tuple

import qubes.device_protocol
import qubes.devices
import qubes.ext
import qubes.vm.adminvm
Expand All @@ -48,7 +49,7 @@
HWDATA_PATH = '/usr/share/hwdata'


class USBDevice(qubes.devices.DeviceInfo):
class USBDevice(qubes.device_protocol.DeviceInfo):
# pylint: disable=too-few-public-methods
def __init__(self, backend_domain, ident):
super(USBDevice, self).__init__(
Expand Down Expand Up @@ -135,7 +136,7 @@ def serial(self) -> str:
return result

@property
def interfaces(self) -> List[qubes.devices.DeviceInterface]:
def interfaces(self) -> List[qubes.device_protocol.DeviceInterface]:
"""
List of device interfaces.
Expand All @@ -148,7 +149,7 @@ def interfaces(self) -> List[qubes.devices.DeviceInterface]:
return result

@property
def parent_device(self) -> Optional[qubes.devices.DeviceInfo]:
def parent_device(self) -> Optional[qubes.device_protocol.DeviceInfo]:
"""
The parent device, if any.
Expand All @@ -157,8 +158,8 @@ def parent_device(self) -> Optional[qubes.devices.DeviceInfo]:
return None

def _load_interfaces_from_qubesdb(self) \
-> List[qubes.devices.DeviceInterface]:
result = [qubes.devices.DeviceInterface.unknown()]
-> List[qubes.device_protocol.DeviceInterface]:
result = [qubes.device_protocol.DeviceInterface.unknown()]
if not self.backend_domain.is_running():
# don't cache this value
return result
Expand All @@ -169,7 +170,7 @@ def _load_interfaces_from_qubesdb(self) \
if not untrusted_interfaces:
return result
self._interfaces = result = [
qubes.devices.DeviceInterface(
qubes.device_protocol.DeviceInterface(
self._sanitize(ifc, safe_chars=string.hexdigits), devclass="usb"
)
for ifc in untrusted_interfaces.split(b':')
Expand Down

0 comments on commit 505e4f8

Please sign in to comment.