@@ -512,7 +512,6 @@ def on_domain_init_load(self, vm, event):
512
512
513
513
async def attach_and_notify (self , vm , assignment ):
514
514
# bypass DeviceCollection logic preventing double attach
515
- identity = assignment .device_id
516
515
for device in assignment .devices :
517
516
if not assignment .matches (device ):
518
517
print (
@@ -567,7 +566,6 @@ def on_device_get_usb(self, vm, event, port_id):
567
566
if not vm .is_running ():
568
567
return
569
568
570
- print (port_id , file = sys .stderr )
571
569
if vm .untrusted_qdb .list (
572
570
'/qubes-usb-devices/' + port_id .replace ('.' , '_' )):
573
571
yield USBDevice (vm , port_id )
@@ -676,14 +674,14 @@ async def on_device_detach_usb(self, vm, event, port):
676
674
677
675
# update the cache before the call, to avoid sending duplicated events
678
676
# (one on qubesdb watch and the other by the caller of this method)
679
- backend = attached
680
- self .devices_cache [backend ][attached .port_id ] = None
677
+ backend = attached . backend_domain
678
+ self .devices_cache [backend . name ][attached .port_id ] = None
681
679
682
680
try :
683
- await backend .backend_domain . run_service_for_stdio (
681
+ await backend .run_service_for_stdio (
684
682
'qubes.USBDetach' ,
685
683
user = 'root' ,
686
- input = '{}\n ' .format (backend .port_id ).encode ())
684
+ input = '{}\n ' .format (attached .port_id ).encode ())
687
685
except subprocess .CalledProcessError as e :
688
686
# TODO: sanitize and include stdout
689
687
raise QubesUSBException ('Device detach failed' )
0 commit comments