Commit Graph
14152 Commits
Author SHA1 Message Date
Niel Nielsen ea4d90ebe4 Refactor BWM command handling for clarity and structure
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-05 10:09:23 +02:00
Niel Nielsen 93ea5600f8 Merge branch 'RfidResearchGroup:master' into BWM-work 2026-09-04 17:10:15 +02:00
iceman1001 0aef94c667 fix 'lf hitag reader -@' mode with sending a break afterwards. 2026-09-04 15:18:16 +02:00
Niel Nielsen 7b37171986 Merge pull request #1 from nieldk/bwm-ota-begin-timeout
Give BWM OTA begin enough time to erase, and stop retuning UART for t…
2026-09-04 14:55:00 +02:00
Niel Nielsen cf3730e1b4 Merge branch 'RfidResearchGroup:master' into BWM-work 2026-09-04 14:29:26 +02:00
WillandCursor 22969ec79a Give BWM OTA begin enough time to erase, and stop retuning UART for the transfer
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 08:24:16 -04:00
iceman1001 ace5d63ff9 hitag2: fix simulation against genuine readers, add restore, fix info
Simulation now completes the full exchange with a genuine Paxton reader in
password mode, and crypto mode read/write passes Proxmark-to-Proxmark.

Firmware:
- SOF was one bit period short. The lead-in that compensated for the lost
  head half bit was removed and nothing replaced it, so readers rejected
  every answer with a second START_AUTH. Default is now 6.
- The edge-detect threshold was latched before being measured, so the value
  chosen depended on whether the Proxmark was in a field when sim started.
  It is now measured on field entry and re-armed when the reader leaves.
- The percentile walk latched on run-scoped variables, so one attempt made
  outside a field poisoned every later one.
- Field loss was detected from TIMESTAMP, which is free-running MCU time and
  never stalls. Detect it from receive silence instead.
- Frames of a length the protocol does not have no longer reach the state
  machine; our own modulation tail was resetting the session and breaking
  every write.
- A dropped edge merges two or three reader bit periods into one gap. Those
  bits were discarded; they are now recovered by decomposition, which is what
  made crypto mode work (AUTH decode 15% -> 100%).
- Threshold selection is limited to 20 and 32 and settles in under 25 ms.

Client:
- lf hitag info printed a hardcoded 0x06 and reported 'Password mode' for
  every tag. It now reads page 3, takes -k (4 bytes password, 6 bytes
  crypto), and says so when the config cannot be read.
- lf hitag restore: writes a dump back in dependency order - user pages,
  then key material, then config last - validates the config byte, and
  prints the credential the tag will require afterwards.
- lf hitag crack2 now reports why it failed instead of a bare 'fail'.
- trace list: bit count moved to its own column, relative mode shows a
  Frame Delay Time row rather than renaming Start/End, --frame and -r
  rejected together.
2026-09-04 13:20:29 +02:00
Niel Nielsen a019756bfa Merge branch 'RfidResearchGroup:master' into BWM-work 2026-09-04 12:58:10 +02:00
Niel Nielsen d4e375f50b Move all bmw commands to subgroups
hw bwmautooff	hw bwm autooff
hw bwmcharge	hw bwm charge
hw bwmsetcap	hw bwm setcap
hw bwmupgrade	hw bwm upgrade
hw bwmvchg	hw bwm vchg
hw bwmwifi	hw bwm wifi

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-04 11:57:28 +02:00
iceman1001 d85550c6de text 2026-09-04 10:18:08 +02:00
iceman1001 ff387762b4 text 2026-09-04 10:16:34 +02:00
Niel Nielsen edd5ada64a Increase response timeout and update comments in cmdhw.c
Increase timeout for response when querying BWM version and adjust comments for clarity.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-04 09:47:35 +02:00
Niel Nielsen 81a3c61058 Add progress bar and write delay to OTA function
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-04 09:31:47 +02:00
Niel Nielsen afcfa2168b Update print statement from 'Hello' to 'Goodbye'
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-04 09:28:36 +02:00
Niel Nielsen fa9691d8d0 Update cmdhw.c
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-04 09:25:33 +02:00
Niel Nielsen 1f6e4eed00 Uncomment clearCommandBuffer() for OTA command
Uncommented the clearCommandBuffer() function to ensure the command buffer is cleared before sending OTA commands.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-04 09:22:41 +02:00
Niel Nielsen 36d2ab1198 Refactor OTA handling and improve timeout duration
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-04 09:02:09 +02:00
Niel Nielsen dd35afc886 Update cmdhw.c
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-04 08:54:57 +02:00
Niel Nielsen 1c2a42321a Removed possible unnessecary clearCommandBuffer();
Removed redundant clearCommandBuffer() calls during OTA process.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-04 08:48:14 +02:00
Niel Nielsen 9944e4d161 Implement progress bar for OTA updates
Add progress bar and enhance OTA update handling

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 21:23:26 +02:00
Niel Nielsen 6b41421a4f Implement CmdBWMUpgrade function for firmware updates
Refactor BWM firmware upgrade process and improve error handling.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 21:14:42 +02:00
Niel Nielsen 55424947ea Merge branch 'RfidResearchGroup:master' into BWM-work 2026-09-03 19:22:22 +02:00
iceman1001 b0c1e42720 textual changes and layout changes to 'lf hitag list'. Now it is more uniform with the rest of the annotation formats 2026-09-03 18:15:44 +02:00
Niel Nielsen a0f6efd70a Merge branch 'RfidResearchGroup:master' into BWM-work 2026-09-03 17:52:50 +02:00
iceman1001 54bbff4c8c hf mad: fix aarch64 -Wstringop-overflow false positive in mad encode
GCC on aarch64 vectorizes the sector fill loop in parse_sector_ranges()
into 16-byte NEON stores. When it versions the loop it loses the range
relationship between count and max_sectors, and reports a 16-byte store
into the last 8 bytes of sectors[40]. The code was correct; the guard
was there. Does not reproduce on x86-64 gcc 14.

Accumulate sectors in a uint64_t bitmask instead of an array, so there
is no store for -Wstringop-overflow to mis-size on any target. Sector
numbers are already validated to 1..39, so the bound check is no longer
needed. Supersedes the sectors[48] padding, which only absorbs a
16-byte vector and would regress on wider ones.

Side effect: duplicate sectors within a single --aid argument now
dedupe instead of erroring (E103:1-3,2 encodes 1-3). Conflicts between
different --aid arguments still error.
2026-09-03 16:55:15 +02:00
Niel Nielsen c20d1491f5 Rename printprogress to progressbar
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 15:50:55 +02:00
Niel Nielsen 23eba9491c Change printprogress to static and rename function
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 15:48:36 +02:00
Niel Nielsen 1bcae500fb Update cmdhw.c
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 15:43:39 +02:00
Niel Nielsen 2052dfedd9 Merge branch 'RfidResearchGroup:master' into BWM-work 2026-09-03 15:23:32 +02:00
Niel Nielsen 76e88f3d5d Add write delay parameter to bwm_ota_once function
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 15:14:43 +02:00
Niel Nielsen c4d4bdc99e Refactor OTA command handling and adjust sleep duration
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 15:08:06 +02:00
iceman1001 08a31f01db client now supports tilde sign '~/´ in paths 2026-09-03 14:59:37 +02:00
Niel Nielsen b8d31f0a81 Update cmdhw.c
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 14:43:38 +02:00
Niel Nielsen e2e0dabe3d Update cmdhw.c
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 14:26:36 +02:00
Niel Nielsen 21009dfc37 Increase sleep duration from 10ms to 20ms
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 14:18:50 +02:00
Niel Nielsen af0116bcfa Update cmdhw.c
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 14:04:50 +02:00
Niel Nielsen 8cb8e6d7c0 Update cmdhw.c
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 14:01:17 +02:00
Niel Nielsen 1e2faf0e6c Update cmdhw.c
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 13:59:14 +02:00
Niel Nielsen a911333c61 Extend sleep time during device reboot process
Increased sleep duration to allow for a longer reboot and re-negotiation period.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 13:37:48 +02:00
Niel Nielsen 7c6153d42b Add debug sleep for USB timeout in cmdhw.c
Added a sleep function for USB timeout debugging.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 13:27:06 +02:00
Niel Nielsen e05af0eea7 Refactor OTA reboot handling in cmdhw.c
Removed redundant reboot command and adjusted logging.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 13:04:59 +02:00
Niel Nielsen c98e5fe69f Refactor OTA finalize and version check logic
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 12:53:46 +02:00
Niel Nielsen 24e4181907 Merge branch 'RfidResearchGroup:master' into BWM-work 2026-09-03 12:50:56 +02:00
Niel Nielsen cac9e2d4cc Implement OTA abort handling in cmdhw.c
Added logic to restore fast link and log OTA abort action on firmware update failure.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 10:59:52 +02:00
Niel Nielsen 339f528bba Refactor BWM firmware upgrade process
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 10:45:06 +02:00
Niel Nielsen 8a27354d4b Refactor OTA response handling for clarity
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 09:44:45 +02:00
Niel Nielsen eb34578ea9 Refine maxchunk size calculation in cmdhw.c
Updated maxchunk calculation to consider BWM_OTA_CHUNK_MAX.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 09:17:09 +02:00
Niel Nielsen efed954b25 Update maxchunk calculation to use g_conn structure
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 08:20:33 +02:00
Jason Yuan 25401b6dd5 feat: improve ndef wsc parsing
Adds support for more attribute types and safe
error handling for unknown types. Fixes a bug
where the version attribute didn't increment the
cursor correctly causing an infinite loop.
2026-09-03 02:08:30 -04:00
Niel Nielsen bb42ca8ca7 Remove unused include for comms.h
Removed unused comms.h include from cmdhw.c

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-03 08:03:06 +02:00