CHG: the work in progress of making "HF MFU INFO" / "HF MFU DUMP" goes on.

ook @marshmellows changes and remade them a bit. TagTypeUL_t behaves like a flag-enum.
     "HF MFU DUMP" now autodetects tagtype, and the deviceside should report back proper length.
This commit is contained in:
iceman1001 2015-04-30 10:15:52 +02:00
commit 1ec21089b2
3 changed files with 171 additions and 147 deletions

View file

@ -163,9 +163,6 @@ void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
memcpy(key, datain, 16);
// Dbprintf("KEY: %02x %02x %02x %02x %02x %02x %02x %02x", key[0],key[1],key[2],key[3],key[4],key[5],key[6],key[7] );
// Dbprintf("KEY: %02x %02x %02x %02x %02x %02x %02x %02x", key[8],key[9],key[10],key[11],key[12],key[13],key[14],key[15] );
uint8_t a[8] = {1,1,1,1,1,1,1,1 };
uint8_t b[8] = {0x00};
uint8_t enc_b[8] = {0x00};
@ -320,14 +317,14 @@ void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain)
uint8_t sectorNo = arg0;
int Pages = arg1;
int countpages = 0;
byte_t dataout[176] = {0x00};;
uint32_t cuid = 0x00;
uint8_t dataout[176] = {0x00};;
LED_A_ON(); LED_B_OFF(); LED_C_OFF();
LEDsoff();
LED_A_ON();
clear_trace();
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
int len = iso14443a_select_card(NULL, NULL, &cuid);
int len = iso14443a_select_card(NULL, NULL, NULL);
if (!len) {
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%d)",len);
OnError(1);
@ -347,20 +344,21 @@ void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain)
}
}
len = mifare_ultra_halt();
if (len) {
if (mifare_ultra_halt()) {
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Halt error");
OnError(3);
return;
}
if (MF_DBGLEVEL >= MF_DBG_ALL) Dbprintf("Pages read %d", countpages);
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) Dbprintf("Pages read %d", countpages);
len = 16*4; //64 bytes
// Read a UL-C, EV1,
// if lockbits,
if (countpages > 16)
len = Pages*4;
else
len = Pages*4;
// Read a UL-C
if (Pages == 44 && countpages > 16)
len = 176;
cmd_send(CMD_ACK, 1, 0, 0, dataout, len);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);