Files
Mykhailo ShevchukandClaude Opus 5 a70a69d9d4 RFID: share the duplicated write_data bodies (-992 B of flash) (#1183)
* RFID: share the duplicated write_data bodies (-992 B of flash)

Nearly every LF RFID protocol filled a write request the same way and differed
only in its config word: protocol_viking_write_data() and
protocol_jablotron_write_data() were byte-identical except for four constants,
and six protocols carried a verbatim copy of the same 64-bit reversal loop.

27 call sites across 20 protocols now share two bodies in
protocols/lfrfid_write_fill.c. The block or word count is read out of the
config word's maxblock field rather than passed alongside it - it is the same
number in both places at all 27 sites, and the chip streams what that field
says, so the two could never legitimately disagree.

Behaviour is unchanged. Each original inline loop was transcribed and compared
against the shared body over random vectors for every bit width in use, and the
derived counts were checked against the ones the call sites used to pass.

No API change: the per-protocol callbacks were never exported, and
protocol_dict_get_write_data() and the lfrfid_protocols vtable are untouched.

Left alone on purpose: em4100, electra and h10301 keep their encoded data as a
uint64_t or uint32_t[] rather than an MSB-first byte buffer, so a bit_lib
helper would byte-swap them; and gallagher's EM4305 arm reads its payload one
bit higher than every sibling (#1181), which folding would silently normalise.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoYukcdV7vyusuaXtYcEdu

* upd changelog

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoYukcdV7vyusuaXtYcEdu

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-10-20 21:41:38 +03:00
..
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00
2024-07-15 20:02:45 +03:00