From 4a3fb3ccf1d6bbe78c9059f119093c2a5b8c616f Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 3 Aug 2019 21:17:52 +0200 Subject: [PATCH] split nfcbarcode from iso14443a --- armsrc/Makefile | 4 +++- armsrc/appmain.c | 8 ++++++++ client/cmdhfthinfilm.c | 6 +++--- client/cmdparser.c | 6 ++++++ client/cmdparser.h | 1 + common/Makefile.hal | 2 ++ include/pm3_cmd.h | 3 ++- 7 files changed, 25 insertions(+), 5 deletions(-) diff --git a/armsrc/Makefile b/armsrc/Makefile index 5475b57eb..cd42ae13f 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -27,13 +27,14 @@ APP_CFLAGS = $(PLATFORM_DEFS) \ SRC_LF = lfops.c lfsampling.c pcf7931.c lfdemod.c SRC_ISO15693 = iso15693.c iso15693tools.c -SRC_ISO14443a = iso14443a.c mifareutil.c mifarecmd.c epa.c mifaresim.c thinfilm.c +SRC_ISO14443a = iso14443a.c mifareutil.c mifarecmd.c epa.c mifaresim.c SRC_ISO14443b = iso14443b.c SRC_FELICA = felica.c SRC_CRAPTO1 = crypto1.c des.c desfire_key.c desfire_crypto.c mifaredesfire.c aes.c platform_util.c SRC_CRC = crc.c crc16.c crc32.c SRC_ICLASS = iclass.c optimized_cipher.c SRC_LEGIC = legicrf.c legicrfsim.c legic_prng.c +SRC_NFCBARCODE = thinfilm.c # SRC_BEE = bee.c @@ -114,6 +115,7 @@ THUMBSRC = start.c \ # These are to be compiled in ARM mode ARMSRC = fpgaloader.c \ $(SRC_ISO14443a) \ + $(SRC_NFCBARCODE) \ $(SRC_ISO14443b) \ $(SRC_CRAPTO1) \ $(SRC_ICLASS) \ diff --git a/armsrc/appmain.c b/armsrc/appmain.c index e372f2eec..5d2f2146b 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -527,6 +527,11 @@ void SendCapabilities(void) { #else capabilities.compiled_with_iclass = false; #endif +#ifdef WITH_NFCBARCODE + capabilities.compiled_with_nfcbarcode = true; +#else + capabilities.compiled_with_nfcbarcode = false; +#endif #ifdef WITH_LCD capabilities.compiled_with_lcd = true; #else @@ -1279,6 +1284,9 @@ static void PacketReceived(PacketCommandNG *packet) { DetectNACKbug(); break; } +#endif + +#ifdef WITH_NFCBARCODE case CMD_HF_THINFILM_READ: { ReadThinFilm(); break; diff --git a/client/cmdhfthinfilm.c b/client/cmdhfthinfilm.c index 928660c6e..665802d0e 100644 --- a/client/cmdhfthinfilm.c +++ b/client/cmdhfthinfilm.c @@ -213,9 +213,9 @@ static int CmdHfThinFilmList(const char *Cmd) { static command_t CommandTable[] = { {"help", CmdHelp, AlwaysAvailable, "This help"}, - {"info", CmdHfThinFilmInfo, IfPm3Flash, "Tag information"}, - {"list", CmdHfThinFilmList, AlwaysAvailable, "List ISO 14443A / Thinfilm history - not correct"}, - {"sim", CmdHfThinFilmSim, IfPm3Flash, "Fake Thinfilm tag"}, + {"info", CmdHfThinFilmInfo, IfPm3NfcBarcode, "Tag information"}, + {"list", CmdHfThinFilmList, AlwaysAvailable, "List NFC Barcode / Thinfilm history - not correct"}, + {"sim", CmdHfThinFilmSim, IfPm3NfcBarcode, "Fake Thinfilm tag"}, {NULL, NULL, NULL, NULL} }; diff --git a/client/cmdparser.c b/client/cmdparser.c index 077ba8ac5..be0de1c50 100644 --- a/client/cmdparser.c +++ b/client/cmdparser.c @@ -133,6 +133,12 @@ bool IfPm3Iclass(void) { return pm3_capabilities.compiled_with_iclass; } +bool IfPm3NfcBarcode(void) { + if (!IfPm3Present()) + return false; + return pm3_capabilities.compiled_with_nfcbarcode; +} + bool IfPm3Lcd(void) { if (!IfPm3Present()) return false; diff --git a/client/cmdparser.h b/client/cmdparser.h index c5aa5460e..06eb02848 100644 --- a/client/cmdparser.h +++ b/client/cmdparser.h @@ -38,6 +38,7 @@ bool IfPm3Iso15693(void); bool IfPm3Felica(void); bool IfPm3Legicrf(void); bool IfPm3Iclass(void); +bool IfPm3NfcBarcode(void); bool IfPm3Lcd(void); // Print help for each command in the command array diff --git a/common/Makefile.hal b/common/Makefile.hal index 46154d244..68de2b154 100644 --- a/common/Makefile.hal +++ b/common/Makefile.hal @@ -111,8 +111,10 @@ PLATFORM_DEFS += \ -DWITH_ISO14443a \ -DWITH_ICLASS \ -DWITH_FELICA \ + -DWITH_NFCBARCODE \ -DWITH_HFSNIFF + # Standalone mode ifneq ($(strip $(filter $(PLATFORM_DEFS),$(STANDALONE_REQ_DEFS))),$(strip $(STANDALONE_REQ_DEFS))) $(error Chosen Standalone mode $(STANDALONE) requires $(strip $(STANDALONE_REQ_DEFS)), unsupported by $(PLTNAME)) diff --git a/include/pm3_cmd.h b/include/pm3_cmd.h index bce5c28ed..267ac749a 100644 --- a/include/pm3_cmd.h +++ b/include/pm3_cmd.h @@ -178,6 +178,7 @@ typedef struct { bool compiled_with_felica : 1; bool compiled_with_legicrf : 1; bool compiled_with_iclass : 1; + bool compiled_with_nfcbarcode : 1; // misc bool compiled_with_lcd : 1; @@ -185,7 +186,7 @@ typedef struct { bool hw_available_flash : 1; bool hw_available_smartcard : 1; } PACKED capabilities_t; -#define CAPABILITIES_VERSION 2 +#define CAPABILITIES_VERSION 3 extern capabilities_t pm3_capabilities; // For CMD_LF_T55XX_WRITEBL