Replace pm3_max_cmd_data_size() by g_conn.max_cmd_data_size
This commit is contained in:
20 files changed
+60
-65
No files matched your search
+13
-13
@@ -359,8 +359,8 @@ int CmdLFCommandRead(const char *Cmd) {
|
||||
memset(payload.symbol_extra, 0, sizeof(payload.symbol_extra));
|
||||
memset(payload.period_extra, 0, sizeof(payload.period_extra));
|
||||
|
||||
if (cmd_len > (size_t)(pm3_max_cmd_data_size() - PAYLOAD_HEADER_SIZE) - 8 * add_crc_ht - 1) {
|
||||
PrintAndLogEx(ERR, "cmd too long, max length is %zu", (size_t)(pm3_max_cmd_data_size() - PAYLOAD_HEADER_SIZE) - 8 * add_crc_ht - 1);
|
||||
if (cmd_len > (size_t)(g_conn.max_cmd_data_size - PAYLOAD_HEADER_SIZE) - 8 * add_crc_ht - 1) {
|
||||
PrintAndLogEx(ERR, "cmd too long, max length is %zu", (size_t)(g_conn.max_cmd_data_size - PAYLOAD_HEADER_SIZE) - 8 * add_crc_ht - 1);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
@@ -1072,9 +1072,9 @@ int lfsim_upload_gb(void) {
|
||||
|
||||
//can send only 512 bits at a time (1 byte sent per bit...)
|
||||
PrintAndLogEx(INFO, "." NOLF);
|
||||
for (size_t i = 0; i < g_GraphTraceLen; i += pm3_max_cmd_data_size() - 3) {
|
||||
for (size_t i = 0; i < g_GraphTraceLen; i += g_conn.max_cmd_data_size - 3) {
|
||||
|
||||
size_t len = MIN((g_GraphTraceLen - i), (size_t)(pm3_max_cmd_data_size() - 3));
|
||||
size_t len = MIN((g_GraphTraceLen - i), (size_t)(g_conn.max_cmd_data_size - 3));
|
||||
clearCommandBuffer();
|
||||
payload_up.offset = i;
|
||||
|
||||
@@ -1239,10 +1239,10 @@ int CmdLFfskSim(const char *Cmd) {
|
||||
}
|
||||
|
||||
size_t size = g_DemodBufferLen;
|
||||
if (size > (pm3_max_cmd_data_size() - sizeof(lf_fsksim_t))) {
|
||||
PrintAndLogEx(WARNING, "DemodBuffer too long for current implementation - length: %zu - max: %zu", size, (size_t)(pm3_max_cmd_data_size() - sizeof(lf_fsksim_t)));
|
||||
if (size > (g_conn.max_cmd_data_size - sizeof(lf_fsksim_t))) {
|
||||
PrintAndLogEx(WARNING, "DemodBuffer too long for current implementation - length: %zu - max: %zu", size, (size_t)(g_conn.max_cmd_data_size - sizeof(lf_fsksim_t)));
|
||||
PrintAndLogEx(INFO, "Continuing with trimmed down data");
|
||||
size = pm3_max_cmd_data_size() - sizeof(lf_fsksim_t);
|
||||
size = g_conn.max_cmd_data_size - sizeof(lf_fsksim_t);
|
||||
}
|
||||
|
||||
lf_fsksim_t *payload = calloc(1, sizeof(lf_fsksim_t) + size);
|
||||
@@ -1356,10 +1356,10 @@ int CmdLFaskSim(const char *Cmd) {
|
||||
}
|
||||
|
||||
size_t size = g_DemodBufferLen;
|
||||
if (size > (pm3_max_cmd_data_size() - sizeof(lf_asksim_t))) {
|
||||
PrintAndLogEx(WARNING, "DemodBuffer too long for current implementation - length: %zu - max: %zu", size, (size_t)(pm3_max_cmd_data_size() - sizeof(lf_asksim_t)));
|
||||
if (size > (g_conn.max_cmd_data_size - sizeof(lf_asksim_t))) {
|
||||
PrintAndLogEx(WARNING, "DemodBuffer too long for current implementation - length: %zu - max: %zu", size, (size_t)(g_conn.max_cmd_data_size - sizeof(lf_asksim_t)));
|
||||
PrintAndLogEx(INFO, "Continuing with trimmed down data");
|
||||
size = pm3_max_cmd_data_size() - sizeof(lf_asksim_t);
|
||||
size = g_conn.max_cmd_data_size - sizeof(lf_asksim_t);
|
||||
}
|
||||
|
||||
lf_asksim_t *payload = calloc(1, sizeof(lf_asksim_t) + size);
|
||||
@@ -1492,10 +1492,10 @@ int CmdLFpskSim(const char *Cmd) {
|
||||
}
|
||||
|
||||
size_t size = g_DemodBufferLen;
|
||||
if (size > (pm3_max_cmd_data_size() - sizeof(lf_psksim_t))) {
|
||||
PrintAndLogEx(WARNING, "DemodBuffer too long for current implementation - length: %zu - max: %zu", size, (size_t)(pm3_max_cmd_data_size() - sizeof(lf_psksim_t)));
|
||||
if (size > (g_conn.max_cmd_data_size - sizeof(lf_psksim_t))) {
|
||||
PrintAndLogEx(WARNING, "DemodBuffer too long for current implementation - length: %zu - max: %zu", size, (size_t)(g_conn.max_cmd_data_size - sizeof(lf_psksim_t)));
|
||||
PrintAndLogEx(INFO, "Continuing with trimmed down data");
|
||||
size = pm3_max_cmd_data_size() - sizeof(lf_psksim_t);
|
||||
size = g_conn.max_cmd_data_size - sizeof(lf_psksim_t);
|
||||
}
|
||||
|
||||
lf_psksim_t *payload = calloc(1, sizeof(lf_psksim_t) + size);
|
||||
|
||||
Reference in new issue
Block a user