aboutsummaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2018-07-11 09:49:06 +0200
committerKévin Redon <kredon@sysmocom.de>2018-07-11 22:24:46 +0200
commit5f6b8717a4ad0938751dabbf99fe538722490e45 (patch)
tree00760fde8e21fa21dcf85cb981e7abb3390747c1 /firmware
parentac0843af836640979fa5ce62c29fb532ea82bd5b (diff)
fix 'ISO_S_IN_ATR not handled' gcc warning
when building the cardem application GCC would output the following warning: libcommon/source/card_emu.c: In function 'card_emu_process_rx_byte': libcommon/source/card_emu.c:764:2: warning: enumeration value 'ISO_S_IN_ATR' not handled in switch [-Wswitch] switch (ch->state) { ^~~~~~ in card emulation the reader should not send data while the card is sending its ATR. this is true for other states already handled (RESET, ...). in these cases an error message is output. this behaviour is now the default case as data from the reader is only expected in 3 cases: ISO_S_WAIT_TPDU, ISO_S_IN_TPDU, and ISO_S_IN_PTS. Change-Id: Ifbc8dbe1c9f176343304f211c7e6068fb977961e
Diffstat (limited to 'firmware')
-rw-r--r--firmware/libcommon/source/card_emu.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/firmware/libcommon/source/card_emu.c b/firmware/libcommon/source/card_emu.c
index 9291064..94a601a 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -762,14 +762,6 @@ void card_emu_process_rx_byte(struct card_handle *ch, uint8_t byte)
ch->stats.rx_bytes++;
switch (ch->state) {
- case ISO_S_WAIT_POWER:
- case ISO_S_WAIT_CLK:
- case ISO_S_WAIT_RST:
- case ISO_S_WAIT_ATR:
- TRACE_ERROR("%u: Received UART char in invalid 7816 state "
- "%u\r\n", ch->num, ch->state);
- /* we shouldn't receive any data from the reader yet! */
- break;
case ISO_S_WAIT_TPDU:
if (byte == 0xff) {
new_state = process_byte_pts(ch, byte);
@@ -783,6 +775,10 @@ void card_emu_process_rx_byte(struct card_handle *ch, uint8_t byte)
case ISO_S_IN_PTS:
new_state = process_byte_pts(ch, byte);
goto out_silent;
+ default:
+ TRACE_ERROR("%u: Received UART char in invalid 7816 state "
+ "%u\r\n", ch->num, ch->state);
+ break;
}
out_silent: