From c15e07f11d954c1816ae56d789a9aca75534a740 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 4 Oct 2016 23:08:39 +0200 Subject: [PATCH 1/1] CHG: making timings a bit tighter == faster read of tag. Like 1ms for whole tag. FIX: off-by-one bug in read-byte-loop. --- armsrc/legicrf.c | 10 ++++++---- client/cmdhflegic.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/armsrc/legicrf.c b/armsrc/legicrf.c index 2d02b636..1b068404 100644 --- a/armsrc/legicrf.c +++ b/armsrc/legicrf.c @@ -395,8 +395,10 @@ int legic_read_byte( uint16_t index, uint8_t cmd_sz) { uint8_t byte, crc, calcCrc = 0; uint32_t cmd = (index << 1) | LEGIC_READ; - //WaitTicks(366); - WaitTicks(330); + //WaitTicks(330); // (4) + WaitTicks(240); // (3) + //WaitTicks(230); //(2) + //WaitTicks(60); //(1) frame_sendAsReader(cmd, cmd_sz); frame_receiveAsReader(¤t_frame, 12); @@ -411,7 +413,7 @@ int legic_read_byte( uint16_t index, uint8_t cmd_sz) { return -1; } - legic_prng_forward(4); + legic_prng_forward(3); return byte; } @@ -505,7 +507,7 @@ int LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv) { setup_phase_reader(iv); LED_B_ON(); - while (i <= len) { + while (i < len) { int r = legic_read_byte(offset + i, card.cmdsize); if (r == -1 || BUTTON_PRESS()) { diff --git a/client/cmdhflegic.c b/client/cmdhflegic.c index 376ec40f..6b880da6 100644 --- a/client/cmdhflegic.c +++ b/client/cmdhflegic.c @@ -440,8 +440,8 @@ int CmdLegicRFRead(const char *Cmd) { return 1; } - PrintAndLog("\nData"); - PrintAndLog("-----------------------------"); + PrintAndLog("\n ## | Data"); + PrintAndLog("-----+-----"); print_hex_break( data, readlen, 32); } else { PrintAndLog("failed reading tag"); -- 2.39.5