From e17660d5f7dfa44447068e7897ee6454157d2ae1 Mon Sep 17 00:00:00 2001 From: Oleg Moiseenko Date: Thu, 26 Oct 2017 20:09:53 +0300 Subject: [PATCH 1/1] code cleaning (#445) --- armsrc/mifarecmd.c | 2 -- client/cmdhf14a.c | 21 +-------------------- client/mifarehost.c | 38 +++----------------------------------- 3 files changed, 4 insertions(+), 57 deletions(-) diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index 39029d4e..00fd638c 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -1514,8 +1514,6 @@ void MifareCIdent(){ LED_A_ON(); LED_B_OFF(); LED_C_OFF(); -// FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); -// SpinDelay(100); iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN); clear_trace(); diff --git a/client/cmdhf14a.c b/client/cmdhf14a.c index db9ce46e..e3f1a5f1 100644 --- a/client/cmdhf14a.c +++ b/client/cmdhf14a.c @@ -405,27 +405,8 @@ int CmdHF14AReader(const char *Cmd) // try to see if card responses to "chinese magic backdoor" commands. - c.cmd = CMD_MIFARE_CIDENT; - c.arg[0] = 0; - c.arg[1] = 0; - c.arg[2] = 0; - SendCommand(&c); - WaitForResponse(CMD_ACK,&resp); - - uint8_t isGeneration = resp.arg[0] & 0xff; - switch( isGeneration ){ - case 1: PrintAndLog("Answers to chinese magic backdoor commands (GEN 1a): YES"); break; - case 2: PrintAndLog("Answers to chinese magic backdoor commands (GEN 1b): YES"); break; - default: PrintAndLog("Answers to chinese magic backdoor commands: NO"); break; - } + mfCIdentify(); - // disconnect - c.cmd = CMD_READER_ISO_14443a; - c.arg[0] = 0; - c.arg[1] = 0; - c.arg[2] = 0; - SendCommand(&c); - return select_status; } diff --git a/client/mifarehost.c b/client/mifarehost.c index ca5d97e1..fe1a8edb 100644 --- a/client/mifarehost.c +++ b/client/mifarehost.c @@ -540,35 +540,10 @@ int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID) { return 0; } -int mfCIdentify() -{ - UsbCommand c; -// UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}}; -// SendCommand(&c); - - UsbCommand resp; -// WaitForResponse(CMD_ACK,&resp); - - // iso14a_card_select_t card; - // memcpy(&card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t)); - - // uint64_t select_status = resp.arg[0]; // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision - - // if(select_status != 0) { - // uint8_t rats[] = { 0xE0, 0x80 }; // FSDI=8 (FSD=256), CID=0 - // c.arg[0] = ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT; - // c.arg[1] = 2; - // c.arg[2] = 0; - // memcpy(c.d.asBytes, rats, 2); - // SendCommand(&c); - // WaitForResponse(CMD_ACK,&resp); - // } - - c.cmd = CMD_MIFARE_CIDENT; - c.arg[0] = 0; - c.arg[1] = 0; - c.arg[2] = 0; +int mfCIdentify() { + UsbCommand c = {CMD_MIFARE_CIDENT, {0, 0, 0}}; SendCommand(&c); + UsbCommand resp; WaitForResponse(CMD_ACK,&resp); uint8_t isGeneration = resp.arg[0] & 0xff; @@ -578,13 +553,6 @@ int mfCIdentify() default: PrintAndLog("No chinese magic backdoor command detected"); break; } - // disconnect -// c.cmd = CMD_READER_ISO_14443a; -// c.arg[0] = 0; -// c.arg[1] = 0; -// c.arg[2] = 0; -// SendCommand(&c); - return (int) isGeneration; } -- 2.39.5