Skip to content

Commit 487b8d6

Browse files
committed
q-dev: backward compatibility
1 parent 26c0ca0 commit 487b8d6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

qubesusbproxy/core3ext.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2424

2525
import collections
26+
import dataclasses
2627
import fcntl
2728
import grp
2829
import os
@@ -32,11 +33,12 @@
3233
import sys
3334

3435
import tempfile
35-
from typing import List, Optional, Dict, Tuple
36+
from typing import List, Optional, Dict, Tuple, Any
3637

3738
try:
3839
from qubes.device_protocol import DeviceInfo
3940
from qubes.device_protocol import DeviceInterface
41+
from qubes.device_protocol import Port
4042
from qubes.ext import utils
4143
from qubes.devices import UnrecognizedDevice
4244

@@ -72,6 +74,12 @@ def __init__(self, port):
7274
def frontend_domain(self):
7375
return self.attachment
7476

77+
@dataclasses.dataclass
78+
class Port:
79+
backend_domain: Any
80+
port_id: Any
81+
devclass: Any
82+
7583
class DeviceInterface:
7684
pass
7785

@@ -100,7 +108,7 @@ def __init__(self, backend_domain, port_id):
100108
# the superclass can restrict the allowed characters
101109
self.safe_chars = (string.ascii_letters + string.digits
102110
+ string.punctuation + ' ')
103-
port = qubes.device_protocol.Port(
111+
port = Port(
104112
backend_domain=backend_domain, port_id=port_id, devclass="usb")
105113
super(USBDevice, self).__init__(port)
106114

@@ -558,6 +566,8 @@ def on_device_get_usb(self, vm, event, port_id):
558566
# pylint: disable=unused-argument,no-self-use
559567
if not vm.is_running():
560568
return
569+
570+
print(port_id, file=sys.stderr)
561571
if vm.untrusted_qdb.list(
562572
'/qubes-usb-devices/' + port_id.replace('.', '_')):
563573
yield USBDevice(vm, port_id)

0 commit comments

Comments
 (0)