From 8bdb6043b09a32998a2ea16e8aa14bdc815ca7ca Mon Sep 17 00:00:00 2001 From: Oleg Moiseenko Date: Wed, 25 Oct 2017 08:56:03 +0300 Subject: [PATCH] identification fix for magic chinese cards (#444) * fixed #411 --- armsrc/mifarecmd.c | 17 ++++++++++++++++- client/mifarehost.c | 19 ++++++++++--------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index edafe0a3..39029d4e 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -1510,6 +1510,16 @@ void MifareCIdent(){ uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE]; uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE]; + + 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(); + set_tracing(true); ReaderTransmitBitsPar(wupC1,7,0, NULL); if(ReaderReceive(receivedAnswer, receivedAnswerPar) && (receivedAnswer[0] == 0x0a)) { @@ -1523,8 +1533,13 @@ void MifareCIdent(){ // From iceman1001: removed the if, since some magic tags misbehavies and send an answer to it. mifare_classic_halt(NULL, 0); - + + LED_B_ON(); cmd_send(CMD_ACK,isOK,0,0,0,0); + LED_B_OFF(); + + FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); + LEDsoff(); } // diff --git a/client/mifarehost.c b/client/mifarehost.c index a02019a3..ca5d97e1 100644 --- a/client/mifarehost.c +++ b/client/mifarehost.c @@ -542,11 +542,12 @@ int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID) { int mfCIdentify() { - UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}}; - SendCommand(&c); + UsbCommand c; +// UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}}; +// SendCommand(&c); - UsbCommand resp; - WaitForResponse(CMD_ACK,&resp); + 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)); @@ -578,11 +579,11 @@ int mfCIdentify() } // disconnect - c.cmd = CMD_READER_ISO_14443a; - c.arg[0] = 0; - c.arg[1] = 0; - c.arg[2] = 0; - SendCommand(&c); +// 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