Commit Graph
96 Commits
Author SHA1 Message Date
Iceman 083cd7ac15 Merge pull request #3572 from xianglin1998/improve-sp-send-speed
Improve serialport send speed
2026-09-01 23:30:04 +07:00
dxl 3ea93dfc85 Add the xyield macro function to yield the CPU. 2026-09-02 00:02:14 +08:00
Philippe Teuwen 0cde2124c8 Replace pm3_max_cmd_data_size() by g_conn.max_cmd_data_size 2026-09-01 17:58:14 +02:00
Philippe Teuwen b69fa20233 Precompute max_cmd_data_size in TestProxmark 2026-09-01 17:58:07 +02:00
iceman1001 7556dd8fc0 Resync drain after framing error 2026-08-31 19:45:23 +02:00
Philippe Teuwen c356ce7f14 Restore client and fw capabilities version parity 2026-08-30 22:42:52 +02:00
iceman1001 9e2092fc66 capabilities: report device frame size so the client can adapt
PM3_CMD_DATA_SIZE went 512 -> 624 without a capabilities bump, so a new
client connects to old firmware and every oversized command dies at the
device's length check with no message.

Append max_cmd_data_size, bump to v9. The client now accepts an older
capabilities struct - it only ever grows by appending, so an older layout
is a prefix - and defaults the frame size for pre-v9 firmware.
SendCommandNG bounds by the device value instead of the compile time one.

Also zero init capabilities_t on the device, it leaked stack bytes.
2026-08-30 20:13:38 +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 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 0f11c5c4d1 Phase E - dismantle MIX functionality 2026-08-29 16:50:29 +02:00
iceman1001 7b7ec48bd9 OLD/MIX convert to NG: Phase C10 2026-08-29 15:50:36 +02:00
iceman1001 76181dfb8e sim module firmware is now v4.60, (sim020.bin) it adds a better drain when T=0 exits abnormal (abort). Better waiting time floor, with faster ETU which doesnt shrink with WWT.\n Changes to i2c with SDA timings, also modified the fixed msleep(100) with an idle time waiting which leads to 107 ms off from every iteration.\n Added a ATR cache to remember which TA1 was autonegotiated. This impact i2c comms speed with sim module for same card. 'smart pps' is better documented.\n The sam_common.c now also logs 61xx and GET_RESPONSE :) and generic long-form ASN-1 lengths. trace list -t 7816 now also shows rdr frames in us. \n All in all, this should lead for 'emv reader -w' to go from 5.87sec to 2.78sec. 'hf seos sam' is down to 1.92sec. 'hw ping' is down to 0.57sec. A USB round trip is down from 20.8ms to 1.3ms. It should give a snappier end user experience 2026-08-27 22:37:32 +02:00
iceman1001 5c38ce0a1d added a wake up pipeline to see if sim module actually is doing things or not. Might not work well on Windows machines... proxspace I am looking at you. but in short this would make comms between device and client faster 2026-08-27 15:35:45 +02:00
Philippe Teuwen 7fb8927523 Fix streaming bug affecting mostly the pm5
Bug triggered with:
lf read -s 50000
hw ping

ReadLF_realtime() in lfsampling.c never knew how many samples the client wanted — for the realtime path, lf_sample_payload_t.samples was never populated on the client side, and the ARM handler in appmain.c (CMD_LF_ACQ_RAW_ADC/CMD_LF_SNIFF_RAW_ADC) ignored it anyway. So the device just streamed samples indefinitely, only checking for a stop request roughly once per 64-sample USB burst, and even after noticing it, flushed one more trailing partial burst via async_usb_write_stop().

Meanwhile the client (WaitForRawDataTimeout in comms.c) stops listening in raw mode the instant it has collected exactly the number of bytes it asked for (e.g. 50000), then switches back to normal framed-packet parsing. Since the device kept sending more bytes past that point, those extra bytes sat unread in the pipe and got misinterpreted as a PacketResponseNGPreamble/OLD-frame header, corrupting every subsequent USB exchange (hw ping, etc.) — reproducible even with a plain lf read -s 50000, no trigger/COTAG needed.

Moreover, we make sure the client doesn't stop listening, even briefly, during stream reception.
2026-08-26 20:16:46 +02:00
kormax 75a49716a9 Update to 'hf.field.timeout_sec' 2026-03-31 17:03:23 +03:00
kormax b443fc7723 Add 'hf.field.timeout' to prefs 2026-03-31 12:02:23 +03:00
iceman1001 607f1bb26c style 2025-05-24 22:49:46 +02:00
iceman1001 ad292e8810 unify test - step 2 2025-03-25 10:17:42 +01:00
Philippe Teuwen ad84875afd cppcheck nullPointerOutOfMemory 2025-03-24 23:46:43 +01:00
iceman1001 4c97151ecc style 2025-03-22 15:46:55 +01:00
iceman1001 c8d46a2a7c textual changes, one fix for overflows when sending OLD frames. Now inform and breaks like MIXED/NG does. Improved hf mf autopwn to detect static encrypted nonces and inform user. Last fix is the user abort during check keys steps in autopwn. The device side now detects and cancels if no card is available and on client it also allows to user abort 2025-03-22 13:14:37 +01:00
iceman1001 4d603a4530 unify hint text 2025-03-20 22:55:26 +01:00
iceman1001 b4cc21c68f modified hf 14a apdu to report back when extending time and also added a possibililty to interrupt the extension loop with button press or usb commad. A bunch of minor textual changes 2025-03-20 19:58:13 +01:00
iceman1001 e1fc066f55 style 2024-10-16 09:34:14 +02:00
Iceman a03cde3db5 Merge branch 'master' into reason
Signed-off-by: Iceman <iceman@iuse.se>
2024-09-30 19:00:22 +03:00
douniwan5788 ef0bae7bc6 refactor: cleanup PacketResponseNG init 2024-09-24 21:06:42 +08:00
douniwan5788 96d462acee add: split PacketResponseNG status to status and reason 2024-09-24 03:10:53 +08:00
iceman1001 ba8a68f37c fixes entering bootload messages to be less scary 2024-09-10 14:29:47 +02:00
iceman1001 3e1bd8f50a the BT serial port setup on Windows didnt work properly. By adding the baud rate in the new termios settings the issue seem to be fixed. Also added some extra flushing calls and some more configuration settings for chars. 2024-06-11 14:32:35 +02:00
iceman1001 4bbfc944f3 fix const params, logic, casting 2024-05-14 14:13:13 +02:00
iceman1001 9b8cf1e323 the waitforResponseTimeoutW fct will lock the client in situations like sniffing and if the device locks up there is no way to exit nice. This fix will look for life signs from the device. if lost, we will break. Allowing for the client to handle it better 2024-04-07 23:50:58 +02:00
iceman1001 4e540053e9 style 2024-04-07 11:38:51 +02:00
iceman1001 700d558432 move hitag2 crypto parts to the common folder in order to be able to use it on the client side. Some textual and minor adaptations across the bord 2024-03-27 09:32:00 +01:00
Martijn Plak 6202da367f coding style 2024-01-24 17:05:37 +01:00
Martijn Plak 1d14bc38c5 Rename CMD_READ_MEM_DOWNLOAD flag.
It got included in pm3_cmd.lua but shouldn't be because it's not a command.
Also, the bitshift in the value upsets some versions of lua.
2024-01-24 16:36:52 +01:00
Martijn Plak e35385fde1 Adding processor flash memory reading, viewing and writing to file.
Works when the device is running either osimage or bootloader.

- New memory reading command in osimage and bootloader.
- Extended 'hw readmem' command with length parameter, file writing and hex viewer.
- Introduced '--dumpmem' option to proxmark3 executable to support dumping from bootloader.

Simple interactive examples:
  hw readmem -f flashdump
  hw readmem -l 1024
CLI example:
  ./pm3 --dumpmem flashdump.bin

Reading from arbitrary memory ranges can be unlocked using the 'raw' option.
2024-01-22 16:40:05 +01:00
iceman1001 d906f23a0a text 2024-01-05 19:34:42 +01:00
iceman1001 0c4a1066c1 text 2024-01-05 19:27:38 +01:00
iceman1001 238572c337 style 2024-01-01 21:52:05 +01:00
wh201906 b414081e3e Add throttling in reconnecting thread 2024-01-01 16:09:24 +08:00
wh201906 47376c84ea Disable print when reconnect 2024-01-01 15:55:54 +08:00
iceman1001 20eddd8250 added a thread that starts when a device is detected to be offline. It runs until it finds a device and reconnects to it. Signals the READLINE hook event and the prompt is updated to match current status. This removes the need to type "hw connect" on clients that has been compiled with READLINE lib. 2023-12-31 15:25:58 +01:00
iceman1001 a913b2c662 style 2023-12-01 10:59:18 +01:00
wh201906 3ee13c9ba6 Apply suggestions from @henrygab
Check if memory allocation fails
Fix memory leak
Initialize struct in declaration
Add/Fix some notes
Remove unlikely() in favor of readability
Remove a hard-coded magic number
2023-11-15 18:04:52 +08:00
wh201906 835b7a9150 Add support for trigger threshold 2023-11-14 13:12:35 +08:00
wh201906 8fdf04fcfb Receive raw data on the client 2023-11-14 02:17:45 +08:00
wh201906 de7b6f35bc Clean up the code for timeout
Rename UART_TCP_CLIENT_RX_TIMEOUT_MS to UART_NET_CLIENT_RX_TIMEOUT_MS
Add UART_UDP_LOCAL_CLIENT_RX_TIMEOUT_MS for shorter timeout
Check if the target address is local in uart_open()
2023-10-25 23:45:23 +08:00
Philippe Teuwen b9ae38f888 Add timing to hw ping, reduce sleep to 1ms in WaitForResponse, no impact on CPU 2023-10-20 00:36:46 +02:00
wh201906 d1f916ba25 Reduce the default communication timeout for local IPv6 address 2023-10-17 20:20:21 +08:00
iceman1001 026cd7d53d style 2023-10-15 13:21:16 +02:00