aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2018-08-01 10:35:55 +0200
committerKévin Redon <kredon@sysmocom.de>2018-08-01 10:35:55 +0200
commitdd36d9b0100053c7d42fe950d5033ad01ba8d196 (patch)
treef43d5d22031efbba66cfd08ef7db4a870d2b821d
parent8b8e58b00e874ca80b762d24b2a53530a76a778e (diff)
sniff: send incomplete TPDU when reset is asserted
-rw-r--r--firmware/libcommon/source/sniffer.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index 982653c..3cd0b89 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -1050,6 +1050,23 @@ void Sniffer_run(void)
/* Handle flags */
if (change_flags) { /* WARNING this is not synced with the data buffer handling */
if (change_flags & SNIFF_CHANGE_FLAG_RESET_ASSERT) {
+ switch (iso_state) {
+ case ISO7816_S_IN_ATR:
+ led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */
+ usb_send_atr(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete ATR to host software using USB */
+ break;
+ case ISO7816_S_IN_TPDU:
+ led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */
+ usb_send_tpdu(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete PPS to host software using USB */
+ break;
+ case ISO7816_S_IN_PPS_REQ:
+ case ISO7816_S_IN_PPS_RSP:
+ led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */
+ usb_send_pps(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete TPDU to host software using USB */
+ break;
+ default:
+ break;
+ }
if (ISO7816_S_RESET != iso_state) {
change_state(ISO7816_S_RESET);
printf("reset asserted\n\r");