Change in simtrace2[master]: fix 'ISO_S_IN_ATR not handled' gcc warning

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Kévin Redon gerrit-no-reply at lists.osmocom.org
Wed Jul 11 18:22:45 UTC 2018


Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/9965


Change subject: fix 'ISO_S_IN_ATR not handled' gcc warning
......................................................................

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
---
M firmware/libcommon/source/card_emu.c
1 file changed, 4 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/65/9965/1

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 @@
 	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 @@
 	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:

-- 
To view, visit https://gerrit.osmocom.org/9965
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbc8dbe1c9f176343304f211c7e6068fb977961e
Gerrit-Change-Number: 9965
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180711/5fef7585/attachment.htm>


More information about the gerrit-log mailing list