mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-10 17:49:32 +08:00
fix: CMD_DOWNLOAD_BIGBUF for getSamples() and download_trace()
This commit is contained in:
parent
112caec054
commit
4b6653696c
2 changed files with 11 additions and 10 deletions
|
@ -2391,15 +2391,15 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
// arg2 = BigBuf tracelen
|
||||
//Dbprintf("transfer to client parameters: %" PRIu32 " | %" PRIu32 " | %" PRIu32, startidx, numofbytes, packet->oldarg[2]);
|
||||
|
||||
for (size_t i = 0; i < numofbytes; i += PM3_CMD_DATA_SIZE) {
|
||||
size_t len = MIN((numofbytes - i), PM3_CMD_DATA_SIZE);
|
||||
int result = reply_old(CMD_DOWNLOADED_BIGBUF, i, len, BigBuf_get_traceLen(), mem + startidx + i, len);
|
||||
for (size_t offset = 0; offset < numofbytes; offset += PM3_CMD_DATA_SIZE) {
|
||||
size_t len = MIN((numofbytes - offset), PM3_CMD_DATA_SIZE);
|
||||
int result = reply_old(CMD_DOWNLOADED_BIGBUF, offset, len, BigBuf_get_traceLen(), &mem[startidx + offset], len);
|
||||
if (result != PM3_SUCCESS)
|
||||
Dbprintf("transfer to client failed :: | bytes between %d - %d (%d) | result: %d", i, i + len, len, result);
|
||||
Dbprintf("transfer to client failed :: | bytes between %d - %d (%d) | result: %d", offset, offset + len, len, result);
|
||||
}
|
||||
// Trigger a finish downloading signal with an ACK frame
|
||||
// arg0 = status of download transfer
|
||||
reply_mix(CMD_ACK, 1, 0, 0, 0, 0);
|
||||
reply_mix(CMD_ACK, 1, 0, BigBuf_get_traceLen(), NULL, 0);
|
||||
LED_B_OFF();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "graph.h" // for graph data
|
||||
#include "comms.h"
|
||||
#include "lfdemod.h" // for demod code
|
||||
#include "cmdlf.h" // for lf_getconfig
|
||||
#include "loclass/cipherutils.h" // for decimating samples in getsamples
|
||||
#include "cmdlfem410x.h" // askem410xdecode
|
||||
#include "fileutils.h" // searchFile
|
||||
|
@ -1875,13 +1876,13 @@ int getSamplesEx(uint32_t start, uint32_t end, bool verbose, bool ignore_lf_conf
|
|||
|
||||
uint8_t bits_per_sample = 8;
|
||||
|
||||
// Old devices without this feature would send 0 at arg[0]
|
||||
if (resp.oldarg[0] > 0 && (ignore_lf_config == false)) {
|
||||
sample_config *sc = (sample_config *) resp.data.asBytes;
|
||||
if (IfPm3Lf() && ignore_lf_config == false) {
|
||||
sample_config sc;
|
||||
lf_getconfig(&sc);
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "Samples @ " _YELLOW_("%d") " bits/smpl, decimation 1:%d ", sc->bits_per_sample, sc->decimation);
|
||||
PrintAndLogEx(INFO, "Samples @ " _YELLOW_("%d") " bits/smpl, decimation 1:%d ", sc.bits_per_sample, sc.decimation);
|
||||
}
|
||||
bits_per_sample = sc->bits_per_sample;
|
||||
bits_per_sample = sc.bits_per_sample;
|
||||
}
|
||||
|
||||
return getSamplesFromBufEx(got, n, bits_per_sample, verbose);;
|
||||
|
|
Loading…
Reference in a new issue