Commit Graph
11 Commits
Author SHA1 Message Date
towelbyte c9a2946e83 lf cotag sim: passive mode: catch a re-activation right after a field drop
Some COTAG readers produce two ON(x),OFF(y),ON(z) activations in a row, with
a very short gap in between, but they actually listen for the card response
only after the second activation.

Real COTAG tags respond to both activations, but correctly
detect a field drop after the first ON(z) and reset.

The proxmark COTAG sim code was detecting a field drop, but due to various
delays (unnecessary settle, possible printouts) in such cases then missed
the second activation.

Fix the problematic delays. Also, optimize the activation
detection by carrying the adaptive threshold across calls.
2026-11-08 13:10:45 +01:00
towelbyte 93631d06d7 lf cotag sim: COTAG simulation improvements
- Implemented passive mode for COTAG sim:
- load modulation with an fc/2 subcarrier locked to the reader carrier.
    - This mode is now a default as it has several advantages:
        - phase coherent response,
        - can detect reader field drop mid frame "transmission" and restart
          immediately -- important with some readers that may drop field
          early and send reactivation shortly afterwards expecting the
          tag to respond there as well.

- "active tx mode" is now via CLI toggle --active: it may give better range,
but may not work with all readers.

- Improved COTAG activation sequence detection for a wider range of COTAG
readers that may vary slightly in activation sequence timings (thresholds
for the rise-to-rise mode).
2026-11-08 13:10:45 +01:00
towelbyte 294fb3c504 Simulate COTAG tag implementation
New CLI command `lf cotag sim` with COTAG tag simulation implementation.

Detects COTAG reader activation sequence and emulates a COTAG tag.

Signed-off-by: andrej@towelbyte.net
2026-10-14 17:14:56 +02:00
towelbyte 2f6a767edf Fix/improve 'lf cotag demod'
Fix/improve 'lf cotag demod' auto threshold estimation
and demodulation of COTAG traces with high value spikes and
COTAG traces with very low amplitude values.
2026-07-09 01:04:35 +02:00
towelbyte 78b621264c Fix (limit) 'lf cotag demod' custom clock argument 2026-06-26 20:23:13 +02:00
towelbyte 2e9a92e967 Fix 'lf search' COTAG false positive
The bug was due to a bool/int ret-val mixup
and accidentally always returning PM3_SUCCESS.
2026-06-15 16:37:10 +02:00
towelbyte 2e35b95a7c Fix: Replace VLAs with heap alloc in lfdemod signal helpers
Using "data load" on very large trace files (e.g. dumps with 700k samples,
such as COTAG dumps) was causing crashes on some platforms due to stack overflow
since VLA temporary buffers were used.

Replace VLAs in computeSignalProperties() and removeSignalOffset() with
heap-allocated buffers instead.
2026-06-13 00:33:24 +02:00
towelbyte e3d2797411 CHANGELOG.md: Add COTAG improvement changelog entry 2026-06-12 22:53:08 +02:00
towelbyte 85c029b8fd pm3_tests.sh: Adapt COTAG tests for the new implementation
"lf cotag demod" now works directly on g_GraphBuffer:
Thus, adapt the existing test. Additionally, add 3 more cotag tests.
2026-06-12 22:49:07 +02:00
towelbyte 0ef1d35891 Added a few COTAG trace dumps. 2026-06-12 22:49:06 +02:00
towelbyte c1cefd6e38 Complete and working reimplementation of COTAG support
- "lf cotag reader": now behaves mostly the same as "lf read",
   except it is dedicated for COTAG.
	- It makes sure to send COTAG start sequence and to use
          real time sampling mode to get enough samples.

- "lf cotag demod": Working client-side COTAG demodulation implementation
   (high-low raw demod + Manchester demodulation from high/low demod).
	- Now uses samples directly from g_GraphBuffer
	- Supports 3 types of COTAG preamble (1 active, 2 passive), which
          can start anywhere in the samples.
	- Prints full 128-bits of COTAG tag data in 3 formats: raw,
          groupped by nibbles, and in hex, and identifies and
          prints out the card number.

Signed-off-by: andrej@towelbyte.net
2026-06-12 22:49:06 +02:00