FIX: off-by-one bug in read-byte-loop.
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);
return -1;
}
- legic_prng_forward(4);
+ legic_prng_forward(3);
return byte;
}
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()) {
return 1;
}
- PrintAndLog("\nData");
- PrintAndLog("-----------------------------");
+ PrintAndLog("\n ## | Data");
+ PrintAndLog("-----+-----");
print_hex_break( data, readlen, 32);
} else {
PrintAndLog("failed reading tag");