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-10-25 21:36:20 +0200
commitbb1e52cfde28ccc4ced585b01b3dc5b44ecef62c (patch)
tree5f6ca6c41dbc12b1634d6ff3155e10b24b16b885
parent1978c2e799914641a2b26a2da69e1322c06ec0d8 (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;