Commit Graph
22702 Commits
Author SHA1 Message Date
Philippe Teuwen bf32513d1b pm5_battery_test: merge nieldk version and add test scenarios 2026-08-30 13:44:46 +02:00
iceman1001 1d87a6c192 chunk CMD_READ_MEM_DOWNLOADED by the OLD frame size reply_old clamps its payload to PM3_CMD_DATA_SIZE_OLD but the sender still
chunked by PM3_CMD_DATA_SIZE. Identical today, but if the NG size moves the
chunk would be built oversized, truncated on the wire, and still announced
at full length in oldarg[1] - the client would copy past the valid bytes and
advance by the wrong stride. Bound the client's OLD download branch by the
same constant.
2026-08-30 13:33:50 +02:00
iceman1001 ed066d84aa 'hf mfu cchk' - widen 3-pass chkkey nkeys to a full byte
nkeys was a 6 bit field but the client chunked by what fits in a frame -
123 keys in segment mode. nkeys wrapped to 59 while memcpy copied all 123
and the loop advanced by 123, so 64 of every 123 keys were never tested
and never reported. Full key mode was unaffected, it chunks 30.

Give nkeys its own byte. MIFAREU3P_CHKKEY_HEADER goes 18 -> 19, costing
one byte of payload, and segment mode chunks 123 again

Payload layout changed: client and firmware must be updated together.
Thanks Claude!
2026-08-30 13:25:50 +02:00
iceman1001 25d958e5e6 split PM3_CMD_DATA_SIZE_OLD out of PM3_CMD_DATA_SIZE
The OLD frame size was tied to the NG one, but the bootloader only speaks
OLD - growing PM3_CMD_DATA_SIZE would silently change sizeof(PacketCommandOLD)
and break flashing against every deployed bootrom in both directions.

Pin the OLD structs to their own constant and use it on every OLD path:
reply_old and the OLD receive branch on both sides, the bootrom, and the
flasher's write_block/send_finish_write_cmd, which memcpy into a
PacketCommandOLD using the NG size.

No behaviour change - both constants are 512 and armsrc .text is
byte-identical before and after.
2026-08-30 13:03:53 +02:00
iceman1001 50c63690cd iso15693: share one response buffer across the reader helpers
Each helper had its own uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH],
2116 bytes, and the SLIX/AFI helpers nest up to three deep - write_afi
-> set_pass_Slix -> set_pass_SlixRnd put over 6 kB of the 8.4 kB stack
into one chain. No helper reads its response across a nested call, so
one shared buffer serves all of them.

Worst chain from AppMain 6848 -> 4544 bytes, measured with -fstack-usage.
Costs 2120 bytes of bss, so BigBuf goes 35108 -> 32988.

SimTagIso15693 keeps its own buffer, it does not nest.\n Thanks Claude!
2026-08-30 12:06:51 +02:00
iceman1001 2f6cb9e45c text 2026-08-30 11:36:17 +02:00
iceman1001 87cea09fd7 don't inline version info on device side, keeps 1.5kB out of the AppMain stack frame
SendVersion holds three PM3_CMD_DATA_SIZE sized buffers. Inlined into AppMain they sat in its frame for the whole main loop, not just while CMD_VERSION was handled. Marking it noinline makes the frame transient.

AppMain frame 2160 -> 1160 bytes, measured with -fstack-usage.  Thanks Claude!
2026-08-30 11:34:17 +02:00
iceman1001 2714628baf swap to bigbuf_calloc in pcf7939 Write on device side to lessen RAM footprint, Thanks Claude! 2026-08-30 11:29:39 +02:00
iceman1001 27dd62e329 use bigbuf_calloc to dynamic allocate sniffing arrays when iso15693 sniffing. Thanks Claude 2026-08-30 11:27:41 +02:00
iceman1001 d3f1c6dd5e fix proper calloc failure handling. Thanks Claude! 2026-08-30 10:19:59 +02:00
iceman1001 02f2c0ad34 fix a hidden starvation of bigbuf during long running sc sessions. Thanks Claude! 2026-08-30 10:12:33 +02:00
Iceman 26fcf38864 Merge pull request #3551 from Antiklesys/master
NULL-check fix
2026-08-30 14:48:52 +07:00
Antiklesys 49dd2478f1 NULL-check fix
iso14443a.c called BigBuf_calloc() and wrote to the result without checking it:

uint8_t *real_cmd = BigBuf_calloc(cmd_len + 4);
if (real_cmd == NULL) {
    return -1;
}
BigBuf_malloc returns NULL once s_bigbuf_hi - s_trace_len < chunksize. Since clear_trace() is never called anywhere in the SAM path — only from the four standalone 14a entry points — s_trace_len grows monotonically for the life of a session and can eventually starve that allocation. -1 matches the function's existing error convention, and callers already map apdu_len < 2 to PM3_ECARDEXCHANGE.
2026-08-30 14:27:45 +08:00
Philippe Teuwen 0197fe8484 Battery test graph: elapsed time 2026-08-30 00:06:13 +02:00
Philippe Teuwen 8017246fd5 Battery test scripts 2026-08-30 00:06:13 +02:00
Iceman 1d035e8643 Merge pull request #3498 from 0x6r1an0y/20260823-ndefnlen
Correct NLEN log message and empty record example
2026-08-30 04:28:30 +07:00
歐歪 910f6ba41f Update cmdhf14a.c
Signed-off-by: 歐歪 <brian20020925@gmail.com>
2026-08-30 03:46:41 +08:00
iceman1001 a1053ad70d New individual json dump file formats for ht1, ht2, htS, htU. '.bin' / binary format for hitag has been deprecated 2026-08-29 20:58:59 +02:00
Iceman dda9d7dd1c Merge pull request #3548 from nieldk/master
add hw bwmwifi status
2026-08-30 01:51:45 +07:00
iceman1001 009490134b revert 2026-08-29 20:37:18 +02:00
iceman1001 d1386baae2 honor T=x framing 2026-08-29 20:29:09 +02:00
iceman1001 d9b8f75b0c make T=0 / T=1 autonegate over sim... 2026-08-29 20:05:19 +02:00
Niel Nielsen 03bbf292dc Enhance CLI with WiFi status check and timeout adjustment
Added status option to CLI for checking WiFi connection state and IP address. Updated command timeout for join and DHCP wait.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-29 20:03:12 +02:00
Niel Nielsen 1b92f7e026 Increase DHCP wait time to 20000 ms
Increased the DHCP wait time from 10 seconds to 20 seconds to allow more time for lease acquisition.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-29 20:01:24 +02:00
Niel Nielsen 2572326440 Add bwm_wifi_forward_status function for WiFi status
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-29 20:00:36 +02:00
Niel Nielsen 7d6ca7ba91 Add BWM_WIFI_ACTION_STATUS definition
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-29 19:59:21 +02:00
Niel Nielsen 1faf1662a0 Handle WiFi actions in CMD_PM5_BWM_WIFI case
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-29 19:56:20 +02:00
Iceman bb18ff0e49 Merge pull request #3547 from nieldk/master
Refine low battery shutdown conditions
2026-08-30 00:42:33 +07:00
Niel Nielsen d49a5299b0 Refine low battery shutdown conditions
Update low battery shutdown logic to require corroboration from both voltage and SoC.

Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-08-29 19:10:08 +02:00
Philippe Teuwen 09bf8fb04e doc 2026-08-29 18:33:01 +02:00
iceman1001 7fade30465 remove commented out code 2026-08-29 17:48:25 +02:00
iceman1001 b0125c036e removed CMD_SMART_SETBAUD since we dont use it any more. Thanks Claude! 2026-08-29 17:46:06 +02:00
iceman1001 35c098d489 make style 2026-08-29 17:42:29 +02:00
iceman1001 a0a3eb4bbf remove CMD_LF_SIMULATE_BIDIR, never implemented 2026-08-29 17:38:41 +02:00
iceman1001 026a1c7648 fixed missing waits for return OPcodes 2026-08-29 17:30:07 +02:00
iceman1001 297d5cef4b fix argparser 2026-08-29 17:15:52 +02:00
iceman1001 0a0d7f19c3 fixed another MIX command laying around 2026-08-29 17:11:43 +02:00
iceman1001 c5ee0ea3d5 fix leftover oldarg in lua scripts 2026-08-29 17:07:33 +02:00
iceman1001 0fbd4aa6a7 text 2026-08-29 17:06:38 +02:00
iceman1001 1ee41ecf95 fix leftover oldargs 2026-08-29 17:06:24 +02:00
iceman1001 87b5ee37c9 stablize download trace more 2026-08-29 17:02:15 +02:00
iceman1001 0f11c5c4d1 Phase E - dismantle MIX functionality 2026-08-29 16:50:29 +02:00
iceman1001 07a0ff70db fix string formatting CodeQL 2026-08-29 16:42:01 +02:00
iceman1001 ff56ec85f9 missed one 2026-08-29 16:35:13 +02:00
iceman1001 11f5e58136 text 2026-08-29 16:34:47 +02:00
iceman1001 177d240ee3 dangling code parts 2026-08-29 16:34:08 +02:00
iceman1001 094bed1176 remove MIX bindings in lua 2026-08-29 16:33:16 +02:00
iceman1001 bd20f7cc81 OLD/MIX convert to NG: Phase D. reworked all lua scripts to handle and behavie same way. Thanks Claude 2026-08-29 16:31:01 +02:00
iceman1001 24a9a686ea Update doc with lessons. Thanks Claude 2026-08-29 16:09:45 +02:00
iceman1001 85ce9c94c4 OLD/MIX convert to NG: Phase C11 2026-08-29 16:03:00 +02:00