FIX: thanks @tony, for pointing out a "end" statement inside tnp3sim.lua
ADD: @marshmello42 fixs for t55x7
This commit is contained in:
@@ -36,26 +36,25 @@ static int CmdHelp(const char *Cmd);
|
||||
|
||||
int usage_lf_cmdread()
|
||||
{
|
||||
PrintAndLog("Usage: lf cmdread <delay off> <zero> <one> <cmdbytes> [H] ");
|
||||
PrintAndLog("Usage: lf cmdread <delay off> <zero> <one> <cmdbytes> [H|L]");
|
||||
PrintAndLog("Options: ");
|
||||
PrintAndLog(" h This help");
|
||||
PrintAndLog(" L Low frequency (125 KHz)");
|
||||
PrintAndLog(" H High frequency (134 KHz)");
|
||||
PrintAndLog(" H delay OFF");
|
||||
PrintAndLog(" H time period ZERO");
|
||||
PrintAndLog(" H time period ONE");
|
||||
PrintAndLog(" <delay off> delay offset");
|
||||
PrintAndLog(" <zero> time period ZERO");
|
||||
PrintAndLog(" <one> time period ONE");
|
||||
PrintAndLog(" [H|L] Frequency Low (125 KHz) / High (134 KHz)");
|
||||
PrintAndLog("Examples:");
|
||||
PrintAndLog(" lf cmdread 80 100 200 11000");
|
||||
PrintAndLog(" lf cmdread 80 100 100 11000 H");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* send a command before reading */
|
||||
/* send a LF command before reading */
|
||||
int CmdLFCommandRead(const char *Cmd)
|
||||
{
|
||||
static char dummy[3] = {0x20,0x00,0x00};
|
||||
bool errors = FALSE;
|
||||
uint8_t divisor = 0; //125khz
|
||||
uint8_t divisor = 95; //125khz
|
||||
uint8_t cmdp =0;
|
||||
while(param_getchar(Cmd, cmdp) != 0x00)
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ int usage_pcf7931_write(){
|
||||
PrintAndLog("Options:");
|
||||
PrintAndLog(" h This help");
|
||||
PrintAndLog(" blockaddress Block to save [0-7]");
|
||||
PrintAndLog(" byteaddress Index of byte inside block to write [0-16]");
|
||||
PrintAndLog(" byteaddress Index of byte inside block to write [0-15]");
|
||||
PrintAndLog(" data one byte of data (hex)");
|
||||
PrintAndLog("Examples:");
|
||||
PrintAndLog(" lf pcf7931 write 2 1 FF");
|
||||
@@ -136,7 +136,7 @@ int CmdLFPCF7931Write(const char *Cmd){
|
||||
if ( param_getdec(Cmd, 0, &block) ) return usage_pcf7931_write();
|
||||
if ( param_getdec(Cmd, 1, &bytepos) ) return usage_pcf7931_write();
|
||||
|
||||
if ( (block > 7) || (bytepos > 16) ) return usage_pcf7931_write();
|
||||
if ( (block > 7) || (bytepos > 15) ) return usage_pcf7931_write();
|
||||
|
||||
data = param_get8ex(Cmd, 2, 0, 16);
|
||||
|
||||
@@ -159,8 +159,8 @@ int CmdLFPCF7931Write(const char *Cmd){
|
||||
static command_t CommandTable[] =
|
||||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
{"read", CmdLFPCF7931Read, 1, "Read content of a PCF7931 transponder"},
|
||||
{"write", CmdLFPCF7931Write, 1, "Write data on a PCF7931 transponder."},
|
||||
{"read", CmdLFPCF7931Read, 0, "Read content of a PCF7931 transponder"},
|
||||
{"write", CmdLFPCF7931Write, 0, "Write data on a PCF7931 transponder."},
|
||||
{"config", CmdLFPCF7931Config, 1, "Configure the password, the tags initialization delay and time offsets (optional)"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -262,8 +262,8 @@ int CmdT55xxReadBlock(const char *Cmd) {
|
||||
uint8_t got[12000];
|
||||
GetFromBigBuf(got,sizeof(got),0);
|
||||
WaitForResponse(CMD_ACK,NULL);
|
||||
setGraphBuf(got, 12000);
|
||||
DemodBufferLen=0;
|
||||
setGraphBuf(got, sizeof(got));
|
||||
//DemodBufferLen=0;
|
||||
if (!DecodeT55xxBlock()) return 3;
|
||||
char blk[10]={0};
|
||||
sprintf(blk,"%d", block);
|
||||
@@ -680,8 +680,8 @@ int CmdT55xxWriteBlock(const char *Cmd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {data, block, 0}};
|
||||
UsbCommand resp;
|
||||
c.d.asBytes[0] = 0x0;
|
||||
|
||||
PrintAndLog("Writing to block: %d data : 0x%08X", block, data);
|
||||
|
||||
@@ -197,7 +197,6 @@ local function ValidateCheckSums(blocks)
|
||||
calc = CalcCheckSum(blocks,2,3)
|
||||
if crc == calc then isOk='Ok' else isOk = 'Error' end
|
||||
io.write( ('TYPE 3 area 2: %04x = %04x -- %s\n'):format(crc,calc,isOk))
|
||||
end
|
||||
|
||||
local cmd
|
||||
local blockdata
|
||||
|
||||
Reference in New Issue
Block a user