@@ -552,6 +552,8 @@ async def on_domain_start(self, vm, _event, **_kwargs):
552
552
for device in assignment .devices :
553
553
if isinstance (device , qubes .device_protocol .UnknownDevice ):
554
554
continue
555
+ if device .attachment :
556
+ continue
555
557
if not assignment .matches (device ):
556
558
print (
557
559
"Unrecognized identity, skipping attachment of device "
@@ -560,11 +562,9 @@ async def on_domain_start(self, vm, _event, **_kwargs):
560
562
# chose first assignment (the most specific) and ignore rest
561
563
if device not in to_attach :
562
564
# make it unique
563
- to_attach [device ] = assignment .clone (
564
- device = qubes .device_protocol .VirtualDevice (
565
- device .port , device .device_id ))
565
+ to_attach [device ] = assignment .clone (device = device )
566
566
for assignment in to_attach .values ():
567
- await self .attach_and_notify (vm , assignment )
567
+ asyncio . ensure_future ( self .attach_and_notify (vm , assignment ) )
568
568
569
569
async def attach_and_notify (self , vm , assignment ):
570
570
# bypass DeviceCollection logic preventing double attach
@@ -575,7 +575,7 @@ async def attach_and_notify(self, vm, assignment):
575
575
self .on_device_pre_attached_block (
576
576
vm , 'device-pre-attach:block' , device , assignment .options )
577
577
await vm .fire_event_async (
578
- 'device-attach:block' , device = str ( device ) , options = assignment .options )
578
+ 'device-attach:block' , device = device , options = assignment .options )
579
579
580
580
@qubes .ext .handler ('domain-shutdown' )
581
581
async def on_domain_shutdown (self , vm , event , ** _kwargs ):
0 commit comments