A few less hardcoded 40000 samples

This commit is contained in:
Philippe Teuwen committed 2026-09-01 19:54:05 +02:00
1 parent 0d8b99b2a1
commit 38e0c068d9
7 files changed
+22 -16

No files matched your search

+4
View File
@@ -1940,6 +1940,10 @@ static int CmdSamples(const char *Cmd) {
int n = arg_get_int_def(ctx, 1, 0);
bool verbose = arg_get_lit(ctx, 2);
CLIParserFree(ctx);
if (n < 0 || n > MIN(g_pm3_capabilities.bigbuf_size - 1, MAX_GRAPH_TRACE_LEN)) {
PrintAndLogEx(WARNING, "invalid number of samples, must be between 0 and %d", MIN(g_pm3_capabilities.bigbuf_size - 1, MAX_GRAPH_TRACE_LEN));
return PM3_EINVARG;
}
return getSamples(n, verbose);
}
+10 -10
View File
@@ -872,7 +872,7 @@ int CmdLFRead(const char *Cmd) {
"Sniff low frequency signal.\n"
" - use " _YELLOW_("`lf config`") _CYAN_(" to set parameters.\n")
_CYAN_(" - use ") _YELLOW_("`data plot`") _CYAN_(" to look at it.\n")
_CYAN_("If the number of samples is more than the device memory limit (40000 now), ")
_CYAN_("If the number of samples is more than the device memory limit, ")
_CYAN_("it will try to use the real-time sampling mode."),
"lf read -v -s 12000 --> collect 12000 samples\n"
"lf read -s 3000 -@ --> oscilloscope style \n"
@@ -891,9 +891,9 @@ int CmdLFRead(const char *Cmd) {
bool cm = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
// the 40000 there should be the result of BigBuf_max_traceLen(),
// it should be the result of BigBuf_max_traceLen(),
// but IDK how to get it.
bool realtime = samples > 40000;
bool realtime = samples >= g_pm3_capabilities.bigbuf_size;
if (g_session.pm3_present == false)
return PM3_ENOTTY;
@@ -1000,7 +1000,7 @@ int CmdLFSniff(const char *Cmd) {
" - use " _YELLOW_("`lf config`") _CYAN_(" to set parameters.\n")
_CYAN_(" - use ") _YELLOW_("`data plot`") _CYAN_(" to look at sniff signal.\n")
_CYAN_(" - use ") _YELLOW_("`lf search -1`") _CYAN_(" to see if signal can be automatic decoded.\n")
_CYAN_("If the number of samples is more than the device memory limit (40000 now), ")
_CYAN_("If the number of samples is more than the device memory limit, ")
_CYAN_("it will try to use the real-time sampling mode."),
"lf sniff -v\n"
"lf sniff -s 3000 -@ --> oscilloscope style \n"
@@ -1019,9 +1019,9 @@ int CmdLFSniff(const char *Cmd) {
bool cm = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
// the 40000 there should be the result of BigBuf_max_traceLen(),
// it should be the result of BigBuf_max_traceLen(),
// but IDK how to get it.
bool realtime = samples > 40000;
bool realtime = samples >= g_pm3_capabilities.bigbuf_size;
if (g_session.pm3_present == false)
return PM3_ENOTTY;
@@ -1847,14 +1847,14 @@ int CmdLFRelay(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "lf relay",
"Relay LF signal between two Proxmark3 devices over TCP.\n"
"By default it uses PORT 8000 and uses 40000 samples from Graphbuffer\n"
"By default it uses PORT 8000 and uses 30000 samples from Graphbuffer\n"
" --rdr : Reading device, act as IP client and reads LF tag and sends data\n"
" --tag : Simulation device, act as IP server and simulates relayed data\n",
_WHITE_("Device A, reading LF tag, client") "\n"
"lf relay --rdr --ip 192.168.1.141 -> Client, connect to IP 192.168.1.141:8000\n"
"lf relay --rdr --ip 192.168.1.141 -p 18111 -> Client, connect to IP 192.168.1.141:18111 \n\n"
_WHITE_("Device B, simulate LF tag, server") "\n"
"lf relay --tag -p 8111 -> Server listening port 8111, recv 40000 samples\n"
"lf relay --tag -p 8111 -> Server listening port 8111, recv 30000 samples\n"
"lf relay --tag -s 10000 -> Server listening port 8000, recv 10000 samples\n"
);
@@ -1863,7 +1863,7 @@ int CmdLFRelay(const char *Cmd) {
arg_lit0(NULL, "tag", "Simulation device, act as Server"),
arg_lit0(NULL, "rdr", "Sniffing device, act as client"),
arg_str0("i", "ip", "<ipaddr>", "Target IPv4 address to send data to. Used with `--rdr`"),
arg_u64_0("s", "samples", "<dec>", "Number of samples to collect (def: 40000)"),
arg_u64_0("s", "samples", "<dec>", "Number of samples to collect (def: 30000)"),
arg_u64_0("p", "port", "<dec>", "Port number (def: 8000)"),
arg_param_end
};
@@ -1877,7 +1877,7 @@ int CmdLFRelay(const char *Cmd) {
char ip[256] = { 0 };
CLIParamStrToBuf(arg_get_str(ctx, 3), (uint8_t *)ip, sizeof(ip), &iplen);
uint64_t samples = arg_get_u64_def(ctx, 4, 40000);
uint64_t samples = arg_get_u64_def(ctx, 4, 30000);
uint16_t port = arg_get_u32_def(ctx, 5, 8000) & 0xFFFF;
CLIParserFree(ctx);
+2 -2
View File
@@ -452,7 +452,7 @@ static int CmdCOTAGReader(const char *Cmd) {
"(which is assumed " STR(LF_COTAG_DIVISOR) " for cotag. Use --divisor to override).\n")
_CYAN_(" - use ") _YELLOW_("`data plot`") _CYAN_(" to look at it.\n")
_CYAN_(" - use ") _YELLOW_("`lf cotag demod`") _CYAN_(" to try to demodulate it.\n")
_CYAN_("If the number of samples is more than the device memory limit (40000 now), ")
_CYAN_("If the number of samples is more than the device memory limit, ")
_CYAN_("it will try to use the real-time sampling mode.\n\n")
_CYAN_("Note: Cotag has an extremely slow data rate - RF/" STR(LF_COTAG_CLOCK) " ")
_CYAN_("-- capturing a full " STR(LF_COTAG_DATA_LEN) " bit card read requires a minimum of ")
@@ -477,7 +477,7 @@ static int CmdCOTAGReader(const char *Cmd) {
int16_t divisor = arg_get_int_def(ctx, 4, -1);
CLIParserFree(ctx);
bool realtime = (samples > 40000);
bool realtime = (samples >= g_pm3_capabilities.bigbuf_size);
if (divisor > -1 && (divisor < 19 || divisor > 255)) {
PrintAndLogEx(ERR, "divisor must be between 19 and 255");
+2 -1
View File
@@ -50,6 +50,7 @@
#include "preferences.h"
#include "cliparser.h"
#include "cmdmqtt.h"
#include "graph.h" // MAX_GRAPH_TRACE_LEN
static int CmdHelp(const char *Cmd);
@@ -175,7 +176,7 @@ static int CmdAuto(const char *Cmd) {
CmdPlot("");
lf_read(false, 40000);
lf_read(false, MIN(g_pm3_capabilities.bigbuf_size - 1, MAX_GRAPH_TRACE_LEN));
char *fname = calloc(100, sizeof(uint8_t));
if (fname == NULL) {
+2 -1
View File
@@ -21,6 +21,7 @@
#include <stdbool.h>
#include "common.h"
#include "graph.h" // MAX_GRAPH_TRACE_LEN
#ifdef __cplusplus
extern "C" {
@@ -28,7 +29,7 @@ extern "C" {
#define PM3_DSP_MAX_FFT 262144
#define PM3_DSP_DC_GUARD 2
#define PM3_DSP_MAX_RESAMPLE (40000 * 32)
#define PM3_DSP_MAX_RESAMPLE (MAX_GRAPH_TRACE_LEN * 32)
#define PM3_DSP_NYQUIST_CLK 2.5
#define PM3_DSP_ENVELOPE_SMOOTH 8
#define PM3_DSP_ENVELOPE_DEPTH 0.6
+1 -1
View File
@@ -627,7 +627,7 @@ pm3 --> lf t55xx wipe
## Data
^[Top](#top)
Get raw samples [512-40000]
Get raw samples, between 512 and Bigbuf_size
```
pm3 --> data samples -n <size>
```
+1 -1
View File
@@ -331,7 +331,7 @@ hw bwmwifi --stop
- Bulk transfers over BLE/WiFi (`lf read`, `mem dump`, trace download) are paced by
the BWM flow control so they don't drop — expect them to be **slower than USB**.
- COTAG / large realtime LF reads (**> 40000 samples**) use a separate streaming
- COTAG / large realtime LF reads use a separate streaming
path and are **not** covered by this flow control.
- All BWM commands are **PM5-only** and require the firmware built with
`PLATFORM_EXTRAS=BWM`.