chg: hw status - now prints number of dictionary keys loaded. Dont print if zero/default empty 0xffff

This commit is contained in:
iceman1001 2019-05-14 14:57:56 -04:00
parent 586e2ebabd
commit a988c8ffef
3 changed files with 38 additions and 1 deletions

View file

@ -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);

View file

@ -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();
}

View file

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