mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-05 07:36:14 +08:00
fix hitag demodulation when first positive period is not detected
This commit is contained in:
parent
b2db893e83
commit
da048ea491
1 changed files with 12 additions and 2 deletions
|
@ -1436,8 +1436,18 @@ void ReaderHitag(hitag_function htf, hitag_data *htd) {
|
||||||
if (waiting_for_first_edge) {
|
if (waiting_for_first_edge) {
|
||||||
// Just break out of loop after an initial time-out (tag is probably not available)
|
// Just break out of loop after an initial time-out (tag is probably not available)
|
||||||
if (periods == 0) break;
|
if (periods == 0) break;
|
||||||
// Register the number of periods that have passed
|
if (tag_modulation == 0) {
|
||||||
response = t_wait_1 - 64 + periods;
|
// hitag replies always start with 11111 == 1010101010, if we see 0
|
||||||
|
// it means we missed the first period, e.g. if the signal never crossed 0 since reader signal
|
||||||
|
// so let's add it:
|
||||||
|
nrz_samples[nrzs++] = tag_modulation ^ 1;
|
||||||
|
// Register the number of periods that have passed
|
||||||
|
// we missed the begin of response but we know it happened one period of 16 earlier
|
||||||
|
response = t_wait_1 - 64 + periods - 16;
|
||||||
|
} else {
|
||||||
|
// Register the number of periods that have passed
|
||||||
|
response = t_wait_1 - 64 + periods;
|
||||||
|
}
|
||||||
// Indicate that we have dealt with the first edge
|
// Indicate that we have dealt with the first edge
|
||||||
waiting_for_first_edge = false;
|
waiting_for_first_edge = false;
|
||||||
// The first edge is always a single NRZ bit, force periods on 16
|
// The first edge is always a single NRZ bit, force periods on 16
|
||||||
|
|
Loading…
Reference in a new issue