From 4f7ca20bf40b911c035264d86ef0359d20e7ac88 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 12 Feb 2012 15:34:41 +0100 Subject: simtrace: Inform host of Fi/Di values (and flag change due to PPS) --- firmware/include/simtrace_usb.h | 1 + firmware/src/simtrace/iso7816_uart.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/firmware/include/simtrace_usb.h b/firmware/include/simtrace_usb.h index c020093..b8b62d3 100644 --- a/firmware/include/simtrace_usb.h +++ b/firmware/include/simtrace_usb.h @@ -20,5 +20,6 @@ enum simtrace_usb_msgt { /* flags for MSGT_DATA */ #define SIMTRACE_FLAG_ATR 0x01 /* ATR immediately after reset */ #define SIMTRACE_FLAG_WTIME_EXP 0x04 /* work waiting time expired */ +#define SIMTRACE_FLAG_PPS_FIDI 0x08 /* Fi/Di values in res[2] */ #endif /* SIMTRACE_USB_H */ diff --git a/firmware/src/simtrace/iso7816_uart.c b/firmware/src/simtrace/iso7816_uart.c index 706b5db..09a7aa0 100644 --- a/firmware/src/simtrace/iso7816_uart.c +++ b/firmware/src/simtrace/iso7816_uart.c @@ -175,6 +175,10 @@ static void send_rctx(struct iso7816_3_handle *ih) if (!rctx) return; + /* Put Fi and Di into res[2] array */ + ih->sh.res[0] = ih->fi; + ih->sh.res[1] = ih->di; + /* copy the simtrace header */ memcpy(rctx->data, &ih->sh, sizeof(ih->sh)); @@ -443,6 +447,7 @@ process_byte_pts(struct iso7816_3_handle *ih, u_int8_t byte) ih->fi = byte >> 4; ih->di = byte & 0xf; DEBUGPCR("found Fi=%u Di=%u", ih->fi, ih->di); + ih->sh.flags |= SIMTRACE_FLAG_PPS_FIDI; ih->pts_resp[_PTS1] = byte; break; case PTS_S_WAIT_RESP_PTS2: -- cgit v1.2.3