From a988c8ffefe401d4eb03464b85dce771a19cc98a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 14 May 2019 14:57:56 -0400 Subject: [PATCH] chg: hw status - now prints number of dictionary keys loaded. Dont print if zero/default empty 0xffff --- armsrc/appmain.c | 3 ++- armsrc/flashmem.c | 35 +++++++++++++++++++++++++++++++++++ armsrc/flashmem.h | 1 + 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 883d735d1..e86360849 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -412,6 +412,7 @@ void SendStatus(void) { DbpString(_BLUE_("Installed StandAlone Mode")); ModInfo(); + Flashmem_print_info(); reply_old(CMD_ACK, 1, 0, 0, 0, 0); } @@ -1647,7 +1648,7 @@ void __attribute__((noreturn)) AppMain(void) { // Check if there is a packet available PacketCommandNG rx; memset(&rx.data, 0, sizeof(rx.data)); - + int ret = receive_ng(&rx); if (ret == PM3_SUCCESS) { PacketReceived(&rx); diff --git a/armsrc/flashmem.c b/armsrc/flashmem.c index a134ebbd0..fcfc9bcb2 100644 --- a/armsrc/flashmem.c +++ b/armsrc/flashmem.c @@ -551,3 +551,38 @@ void Flashmem_print_status(void) { FlashStop(); } + +void Flashmem_print_info(void) { + if (!FlashInit()) return; + + DbpString(_BLUE_("Flash memory dictionary loaded")); + + // load dictionary offsets. + uint8_t keysum[2]; + uint16_t num; + + uint16_t isok = Flash_ReadDataCont(DEFAULT_MF_KEYS_OFFSET, keysum, 2); + if (isok == 2) { + num = ((keysum[1] << 8) | keysum[0]); + if (num != 0xFFFF && num != 0x0) + Dbprintf(" Mifare................%d keys", num); + } + + isok = Flash_ReadDataCont(DEFAULT_T55XX_KEYS_OFFSET, keysum, 2); + if (isok == 2) { + num = ((keysum[1] << 8) | keysum[0]); + if (num != 0xFFFF && num != 0x0) + Dbprintf(" T55x7.................%d keys", num); + } + + isok = Flash_ReadDataCont(DEFAULT_ICLASS_KEYS_OFFSET, keysum, 2); + if (isok == 2) { + num = ((keysum[1] << 8) | keysum[0]); + if (num != 0xFFFF && num != 0x0) + Dbprintf(" iClass................%d keys", num); + } + + FlashStop(); +} + + diff --git a/armsrc/flashmem.h b/armsrc/flashmem.h index db0c70790..4016e66bd 100644 --- a/armsrc/flashmem.h +++ b/armsrc/flashmem.h @@ -141,5 +141,6 @@ uint16_t Flash_Write(uint32_t address, uint8_t *in, uint16_t len); uint16_t Flash_WriteData(uint32_t address, uint8_t *in, uint16_t len); uint16_t Flash_WriteDataCont(uint32_t address, uint8_t *in, uint16_t len); void Flashmem_print_status(void); +void Flashmem_print_info(void); #endif