ccid emulation: check connection state to prevent errors due to delayed messages

This commit is contained in:
Eric Wild 2022-02-25 15:46:08 +01:00
parent 421311ef2a
commit b0f1cb176c
1 changed files with 2 additions and 0 deletions

View File

@ -151,8 +151,10 @@ function main(CCID_Emulation_Params pars) runs on CCID_Emulation_CT {
f_usb_submit_xfer(g_ep_in);
/* forward to slot-specific port */
ccid_in := dec_CCID_PDU(tc.data);
if (SLOT[ccid_in.hdr.bSlot].checkstate("Connected")) {
SLOT[ccid_in.hdr.bSlot].send(ccid_in);
}
}
[] USB.receive(tr_UsbXfer_compl(g_ep_irq, USB_TRANSFER_TYPE_INTERRUPT,
USB_TRANSFER_COMPLETED, g_dev_hdl, ?)) -> value tc {
/* Submit another IRQ transfer */