mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 10:43:01 +08:00
fix: LF FDX-B demod - more lenient with max errors. Thanks to @maltehillmann
This commit is contained in:
parent
459835b5ca
commit
5fd98db92d
2 changed files with 13 additions and 10 deletions
|
@ -615,17 +615,20 @@ int Cmdmandecoderaw(const char *Cmd) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//by marshmellow
|
/*
|
||||||
//biphase decode
|
* @author marshmellow
|
||||||
//take 01 or 10 = 0 and 11 or 00 = 1
|
* biphase decode
|
||||||
//takes 2 arguments "offset" default = 0 if 1 it will shift the decode by one bit
|
* decodes 01 or 10 -> ZERO
|
||||||
// and "invert" default = 0 if 1 it will invert output
|
* 11 or 00 -> ONE
|
||||||
// the argument offset allows us to manually shift if the output is incorrect - [EDIT: now auto detects]
|
* param offset adjust start position
|
||||||
|
* param invert invert output
|
||||||
|
* param masxErr maximum tolerated errors
|
||||||
|
*/
|
||||||
int CmdBiphaseDecodeRaw(const char *Cmd) {
|
int CmdBiphaseDecodeRaw(const char *Cmd) {
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
int offset = 0, invert = 0, maxErr = 20, errCnt = 0;
|
int offset = 0, invert = 0, maxErr = 20, errCnt = 0;
|
||||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||||
if (strlen(Cmd) > 3 || cmdp == 'h') return usage_data_biphaserawdecode();
|
if (strlen(Cmd) > 5 || cmdp == 'h') return usage_data_biphaserawdecode();
|
||||||
|
|
||||||
sscanf(Cmd, "%i %i %i", &offset, &invert, &maxErr);
|
sscanf(Cmd, "%i %i %i", &offset, &invert, &maxErr);
|
||||||
if (DemodBufferLen == 0) {
|
if (DemodBufferLen == 0) {
|
||||||
|
@ -665,7 +668,7 @@ int CmdBiphaseDecodeRaw(const char *Cmd) {
|
||||||
// - ASK Demod then Biphase decode GraphBuffer samples
|
// - ASK Demod then Biphase decode GraphBuffer samples
|
||||||
int ASKbiphaseDemod(const char *Cmd, bool verbose) {
|
int ASKbiphaseDemod(const char *Cmd, bool verbose) {
|
||||||
//ask raw demod GraphBuffer first
|
//ask raw demod GraphBuffer first
|
||||||
int offset = 0, clk = 0, invert = 0, maxErr = 0;
|
int offset = 0, clk = 0, invert = 0, maxErr = 100;
|
||||||
sscanf(Cmd, "%i %i %i %i", &offset, &clk, &invert, &maxErr);
|
sscanf(Cmd, "%i %i %i %i", &offset, &clk, &invert, &maxErr);
|
||||||
|
|
||||||
uint8_t BitStream[MAX_DEMOD_BUF_LEN];
|
uint8_t BitStream[MAX_DEMOD_BUF_LEN];
|
||||||
|
|
|
@ -160,7 +160,7 @@ int getFDXBits(uint64_t national_id, uint16_t country, uint8_t isanimal, uint8_t
|
||||||
int CmdFDXBdemodBI(const char *Cmd) {
|
int CmdFDXBdemodBI(const char *Cmd) {
|
||||||
|
|
||||||
int clk = 32;
|
int clk = 32;
|
||||||
int invert = 1, errCnt = 0, offset = 0, maxErr = 0;
|
int invert = 1, errCnt = 0, offset = 0, maxErr = 100;
|
||||||
uint8_t bs[MAX_DEMOD_BUF_LEN];
|
uint8_t bs[MAX_DEMOD_BUF_LEN];
|
||||||
size_t size = getFromGraphBuf(bs);
|
size_t size = getFromGraphBuf(bs);
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ int CmdFdxDemod(const char *Cmd) {
|
||||||
|
|
||||||
//Differential Biphase / di-phase (inverted biphase)
|
//Differential Biphase / di-phase (inverted biphase)
|
||||||
//get binary from ask wave
|
//get binary from ask wave
|
||||||
if (!ASKbiphaseDemod("0 32 1 0", false)) {
|
if (!ASKbiphaseDemod("0 32 1 100", false)) {
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - FDX-B ASKbiphaseDemod failed");
|
PrintAndLogEx(DEBUG, "DEBUG: Error - FDX-B ASKbiphaseDemod failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue