X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/660d641a03456e99ea83c68dbd3d03bae2b64573..e772353f72729f0dfc80a4d93c3a7bd2ac5ea775:/armsrc/mifarecmd.c diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index e7850b3f..f328b123 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -82,7 +82,7 @@ void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) // memcpy(ack.d.asBytes, dataoutbuf, 16); LED_B_ON(); - cmd_send(CMD_ACK,isOK,0,0,0,0); + cmd_send(CMD_ACK,isOK,0,0,dataoutbuf,16); // UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand)); LED_B_OFF(); @@ -493,7 +493,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain) } LED_B_ON(); -// SpinDelay(100); + SpinDelay(100); cmd_send(CMD_ACK,0,ncount,targetBlockNo + (targetKeyType * 0x100),buf,48); // UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand)); LED_B_OFF(); @@ -507,7 +507,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain) // memset(ack.d.asBytes, 0x00, sizeof(ack.d.asBytes)); LED_B_ON(); -// SpinDelay(300); + SpinDelay(300); // UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand)); cmd_send(CMD_ACK,1,0,0,0,0); LED_B_OFF(); @@ -801,7 +801,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai // reset chip if (needWipe){ - ReaderTransmitShort(wupC1); + ReaderTransmitBitsPar(wupC1,7,0); if(!ReaderReceive(receivedAnswer) || (receivedAnswer[0] != 0x0a)) { if (MF_DBGLEVEL >= 1) Dbprintf("wupC1 error"); break; @@ -821,7 +821,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai // write block if (workFlags & 0x02) { - ReaderTransmitShort(wupC1); + ReaderTransmitBitsPar(wupC1,7,0); if(!ReaderReceive(receivedAnswer) || (receivedAnswer[0] != 0x0a)) { if (MF_DBGLEVEL >= 1) Dbprintf("wupC1 error"); break; @@ -863,8 +863,14 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai // if (isOK) memcpy(ack.d.asBytes, uid, 4); // add trace trailer - memset(uid, 0x44, 4); - LogTrace(uid, 4, 0, 0, TRUE); + /** + * Removed by Martin, the uid is overwritten with 0x44, + * which can 't be intended. + * + * memset(uid, 0x44, 4); + * LogTrace(uid, 4, 0, 0, TRUE); + **/ + LED_B_ON(); cmd_send(CMD_ACK,isOK,0,0,uid,4); @@ -919,7 +925,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai while (true) { if (workFlags & 0x02) { - ReaderTransmitShort(wupC1); + ReaderTransmitBitsPar(wupC1,7,0); if(!ReaderReceive(receivedAnswer) || (receivedAnswer[0] != 0x0a)) { if (MF_DBGLEVEL >= 1) Dbprintf("wupC1 error"); break; @@ -954,9 +960,13 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai // if (isOK) memcpy(ack.d.asBytes, data, 18); // add trace trailer - memset(data, 0x44, 4); - LogTrace(data, 4, 0, 0, TRUE); - + /* + * Removed by Martin, this piece of overwrites the 'data' variable + * which is sent two lines down, and is obviously not correct. + * + * memset(data, 0x44, 4); + * LogTrace(data, 4, 0, 0, TRUE); + */ LED_B_ON(); cmd_send(CMD_ACK,isOK,0,0,data,18); // UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand));