mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-13 08:43:01 -07:00
with em410xread, retest if we read our bits the wrong way (1=0 and 0=1)
This commit is contained in:
parent
15db5fb71a
commit
a91ff4c8e7
1 changed files with 17 additions and 5 deletions
|
@ -262,6 +262,7 @@ static void CmdEM410xread(char *str)
|
||||||
int i, j, clock, header, rows, bit, hithigh, hitlow, first, bit2idx, high, low;
|
int i, j, clock, header, rows, bit, hithigh, hitlow, first, bit2idx, high, low;
|
||||||
int parity[4];
|
int parity[4];
|
||||||
char id[11];
|
char id[11];
|
||||||
|
int retested = 0;
|
||||||
int BitStream[MAX_GRAPH_TRACE_LEN];
|
int BitStream[MAX_GRAPH_TRACE_LEN];
|
||||||
high = low = 0;
|
high = low = 0;
|
||||||
|
|
||||||
|
@ -315,6 +316,7 @@ static void CmdEM410xread(char *str)
|
||||||
BitStream[bit2idx++] = bit;
|
BitStream[bit2idx++] = bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retest:
|
||||||
/* We go till 5 before the graph ends because we'll get that far below */
|
/* We go till 5 before the graph ends because we'll get that far below */
|
||||||
for (i = 1; i < bit2idx - 5; i++)
|
for (i = 1; i < bit2idx - 5; i++)
|
||||||
{
|
{
|
||||||
|
@ -363,7 +365,7 @@ static void CmdEM410xread(char *str)
|
||||||
|
|
||||||
/* Stop any loops */
|
/* Stop any loops */
|
||||||
go = 0;
|
go = 0;
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Crap! Incorrect parity or no stop bit, start all over */
|
/* Crap! Incorrect parity or no stop bit, start all over */
|
||||||
|
@ -388,6 +390,16 @@ static void CmdEM410xread(char *str)
|
||||||
header = 0;
|
header = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if we've already retested after flipping bits, return */
|
||||||
|
if (retested++)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* if this didn't work, try flipping bits */
|
||||||
|
for (i = 0; i < bit2idx; i++)
|
||||||
|
BitStream[i] ^= 1;
|
||||||
|
|
||||||
|
goto retest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* emulate an EM410X tag
|
/* emulate an EM410X tag
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue