@@ -52,6 +52,7 @@ pub async fn start_flow_control_service<
5252 signal_state : Arc :: new ( AsyncMutex :: new ( SignalState :: Idle ) ) ,
5353 svc,
5454 usb_pin_tx : Arc :: new ( AsyncMutex :: new ( None ) ) ,
55+ usb_cred_tx : Arc :: new ( AsyncMutex :: new ( None ) ) ,
5556 usb_event_forwarder_task : Arc :: new ( AsyncMutex :: new ( None ) ) ,
5657 hybrid_event_forwarder_task : Arc :: new ( AsyncMutex :: new ( None ) ) ,
5758 } ,
@@ -72,6 +73,7 @@ struct FlowControlService<H: HybridHandler, U: UsbHandler, UC: UiController> {
7273 signal_state : Arc < AsyncMutex < SignalState > > ,
7374 svc : Arc < AsyncMutex < CredentialService < H , U , UC > > > ,
7475 usb_pin_tx : Arc < AsyncMutex < Option < Sender < String > > > > ,
76+ usb_cred_tx : Arc < AsyncMutex < Option < Sender < String > > > > ,
7577 usb_event_forwarder_task : Arc < AsyncMutex < Option < AbortHandle > > > ,
7678 hybrid_event_forwarder_task : Arc < AsyncMutex < Option < AbortHandle > > > ,
7779}
@@ -181,6 +183,7 @@ where
181183 ) -> fdo:: Result < ( ) > {
182184 let mut stream = self . svc . lock ( ) . await . get_usb_credential ( ) ;
183185 let usb_pin_tx = self . usb_pin_tx . clone ( ) ;
186+ let usb_cred_tx = self . usb_cred_tx . clone ( ) ;
184187 let signal_state = self . signal_state . clone ( ) ;
185188 let object_server = object_server. clone ( ) ;
186189 let task = tokio:: spawn ( async move {
@@ -214,6 +217,10 @@ where
214217 let mut usb_pin_tx = usb_pin_tx. lock ( ) . await ;
215218 let _ = usb_pin_tx. insert ( pin_tx) ;
216219 }
220+ UsbState :: SelectCredential { cred_tx, .. } => {
221+ let mut usb_cred_tx = usb_cred_tx. lock ( ) . await ;
222+ let _ = usb_cred_tx. insert ( cred_tx) ;
223+ }
217224 UsbState :: Completed | UsbState :: Failed ( _) => {
218225 break ;
219226 }
@@ -240,7 +247,10 @@ where
240247 }
241248
242249 async fn select_credential ( & self , credential_id : String ) -> fdo:: Result < ( ) > {
243- todo ! ( )
250+ if let Some ( cred_tx) = self . usb_cred_tx . lock ( ) . await . take ( ) {
251+ cred_tx. send ( credential_id) . await . unwrap ( ) ;
252+ }
253+ Ok ( ( ) )
244254 }
245255
246256 #[ zbus( signal) ]
0 commit comments