|
23 | 23 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
24 | 24 |
|
25 | 25 | import collections
|
| 26 | +import dataclasses |
26 | 27 | import fcntl
|
27 | 28 | import grp
|
28 | 29 | import os
|
|
32 | 33 | import sys
|
33 | 34 |
|
34 | 35 | import tempfile
|
35 |
| -from typing import List, Optional, Dict, Tuple |
| 36 | +from typing import List, Optional, Dict, Tuple, Any |
36 | 37 |
|
37 | 38 | try:
|
38 | 39 | from qubes.device_protocol import DeviceInfo
|
39 | 40 | from qubes.device_protocol import DeviceInterface
|
| 41 | + from qubes.device_protocol import Port |
40 | 42 | from qubes.ext import utils
|
41 | 43 | from qubes.devices import UnrecognizedDevice
|
42 | 44 |
|
@@ -72,6 +74,12 @@ def __init__(self, port):
|
72 | 74 | def frontend_domain(self):
|
73 | 75 | return self.attachment
|
74 | 76 |
|
| 77 | + @dataclasses.dataclass |
| 78 | + class Port: |
| 79 | + backend_domain: Any |
| 80 | + port_id: Any |
| 81 | + devclass: Any |
| 82 | + |
75 | 83 | class DeviceInterface:
|
76 | 84 | pass
|
77 | 85 |
|
@@ -100,7 +108,7 @@ def __init__(self, backend_domain, port_id):
|
100 | 108 | # the superclass can restrict the allowed characters
|
101 | 109 | self.safe_chars = (string.ascii_letters + string.digits
|
102 | 110 | + string.punctuation + ' ')
|
103 |
| - port = qubes.device_protocol.Port( |
| 111 | + port = Port( |
104 | 112 | backend_domain=backend_domain, port_id=port_id, devclass="usb")
|
105 | 113 | super(USBDevice, self).__init__(port)
|
106 | 114 |
|
@@ -558,6 +566,8 @@ def on_device_get_usb(self, vm, event, port_id):
|
558 | 566 | # pylint: disable=unused-argument,no-self-use
|
559 | 567 | if not vm.is_running():
|
560 | 568 | return
|
| 569 | + |
| 570 | + print(port_id, file=sys.stderr) |
561 | 571 | if vm.untrusted_qdb.list(
|
562 | 572 | '/qubes-usb-devices/' + port_id.replace('.', '_')):
|
563 | 573 | yield USBDevice(vm, port_id)
|
|
0 commit comments