aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMin Xu <min.xu@min-info.net>2014-10-25 21:25:54 +0200
committerHarald Welte <laforge@gnumonks.org>2014-11-11 22:30:55 +0100
commit6bafd0cfb40c2d201f8723a3678dd4f04b380842 (patch)
tree5890ced84cb1ea633a700c443b35dcef46d9dfec
parent7e3c9959e1e140753738be9b6d4142f6c2068e3d (diff)
Don't split req_ctx with ATR payload
The codnition for flushing a req_ctx on UART idle is fixed to flush only if 1) There has been no new data since last check, and 2) There are no req_ctx currently pending to be transmitted to USB, and 3) We did NOT just got a reset and waiting for ATR I saw an ATR split in two different req_ctx prior, presumably flush decided to send req_ctx after ATR but got a new character just before sent). If we did get a RESET, let original logic decide to send the req_ctx -- presumably when ATR data is fully received.
-rw-r--r--firmware/src/simtrace/iso7816_uart.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/firmware/src/simtrace/iso7816_uart.c b/firmware/src/simtrace/iso7816_uart.c
index e37deba..9e8ace9 100644
--- a/firmware/src/simtrace/iso7816_uart.c
+++ b/firmware/src/simtrace/iso7816_uart.c
@@ -591,7 +591,10 @@ void iso_uart_idleflush(void)
static struct req_ctx *last_req = NULL;
static u_int16_t last_len = 0;
- if (last_req == isoh.rctx || last_len == isoh.rctx->tot_len) {
+ if (last_req == isoh.rctx &&
+ last_len == isoh.rctx->tot_len &&
+ req_ctx_count(RCTX_STATE_UDP_EP2_PENDING) == 0 &&
+ (isoh.sh.flags & SIMTRACE_FLAG_ATR) == 0) {
send_rctx(&isoh);
}
last_req = isoh.rctx;