CHG: changed to use BigBuff_Eml memory instead of big_buff_malloc.
CHG: downloading eml memory from device should use uint's CHG: "hf legic read" has a different printing. It now prints 32bytes / row
This commit is contained in:
@@ -414,7 +414,7 @@ int CmdLegicRFRead(const char *Cmd) {
|
||||
PrintAndLog("LSB of IV must be SET");
|
||||
}
|
||||
|
||||
//PrintAndLog("Using IV: 0x%02x | Offset: 0x%02x | Len: 0x%02x ", IV, offset, len);
|
||||
//PrintAndLog("Using IV: 0x%02x", IV);
|
||||
|
||||
UsbCommand c = {CMD_READER_LEGIC_RF, {offset, len, IV}};
|
||||
clearCommandBuffer();
|
||||
@@ -424,12 +424,24 @@ int CmdLegicRFRead(const char *Cmd) {
|
||||
uint8_t isOK = resp.arg[0] & 0xFF;
|
||||
uint16_t len = resp.arg[1] & 0x3FF;
|
||||
if ( isOK ) {
|
||||
PrintAndLog("use 'hf legic decode'");
|
||||
|
||||
uint8_t *data = resp.d.asBytes;
|
||||
PrintAndLog("\nData |");
|
||||
uint8_t *data = malloc(len);
|
||||
if ( !data ){
|
||||
PrintAndLog("Cannot allocate memory");
|
||||
return 2;
|
||||
}
|
||||
// copy data from device
|
||||
GetEMLFromBigBuf(data, len, 0);
|
||||
if ( !WaitForResponseTimeout(CMD_ACK, NULL, 2000)){
|
||||
PrintAndLog("Command execute timeout");
|
||||
if ( data )
|
||||
free(data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
PrintAndLog("\nData");
|
||||
PrintAndLog("-----------------------------");
|
||||
PrintAndLog(" %s|\n", sprint_hex(data, len));
|
||||
print_hex_break( data, len, 32);
|
||||
} else {
|
||||
PrintAndLog("failed reading tag");
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ void GetFromBigBuf(uint8_t *dest, int bytes, int start_index) {
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
}
|
||||
void GetEMLFromBigBuf(uint8_t *dest, int bytes, int start_index) {
|
||||
void GetEMLFromBigBuf(uint8_t *dest, uint32_t bytes, uint32_t start_index) {
|
||||
sample_buf = dest;
|
||||
UsbCommand c = {CMD_DOWNLOAD_EML_BIGBUF, {start_index, bytes, 0}};
|
||||
clearCommandBuffer();
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
#include "util.h"
|
||||
extern uint8_t* sample_buf;
|
||||
void GetFromBigBuf(uint8_t *dest, int bytes, int start_index);
|
||||
void GetEMLFromBigBuf(uint8_t *dest, int bytes, int start_index);
|
||||
void GetEMLFromBigBuf(uint8_t *dest, uint32_t bytes, uint32_t start_index);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user