fix #1661 - hf sniff shall ignore lf config settings

This commit is contained in:
iceman1001 2022-04-09 19:04:31 +02:00
parent 8d9dd8b346
commit 159d5ffd1a
3 changed files with 7 additions and 7 deletions

View file

@ -1731,17 +1731,17 @@ static uint8_t getByte(uint8_t bits_per_sample, BitstreamOut_t *b) {
}
int getSamples(uint32_t n, bool verbose) {
return getSamplesEx(0, n, verbose);
return getSamplesEx(0, n, verbose, false);
}
int getSamplesEx(uint32_t start, uint32_t end, bool verbose) {
int getSamplesEx(uint32_t start, uint32_t end, bool verbose, bool ignore_lf_config) {
if (end < start) {
PrintAndLogEx(WARNING, "error, end (%u) is smaller than start (%u)", end, start);
return PM3_EINVARG;
}
//If we get all but the last byte in bigbuf,
// If we get all but the last byte in bigbuf,
// we don't have to worry about remaining trash
// in the last byte in case the bits-per-sample
// does not line up on byte boundaries
@ -1766,8 +1766,8 @@ int getSamplesEx(uint32_t start, uint32_t end, bool verbose) {
uint8_t bits_per_sample = 8;
//Old devices without this feature would send 0 at arg[0]
if (response.oldarg[0] > 0) {
// Old devices without this feature would send 0 at arg[0]
if (response.oldarg[0] > 0 && (ignore_lf_config == false)) {
sample_config *sc = (sample_config *) response.data.asBytes;
if (verbose) PrintAndLogEx(INFO, "Samples @ " _YELLOW_("%d") " bits/smpl, decimation 1:%d ", sc->bits_per_sample, sc->decimation);
bits_per_sample = sc->bits_per_sample;

View file

@ -85,7 +85,7 @@ void save_restoreDB(uint8_t saveOpt);// option '1' to save g_DemodBuffer any oth
int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveGrph, bool verbose);
int getSamples(uint32_t n, bool verbose);
int getSamplesEx(uint32_t start, uint32_t end, bool verbose);
int getSamplesEx(uint32_t start, uint32_t end, bool verbose, bool ignore_lf_config);
void setClockGrid(uint32_t clk, int offset);
int directionalThreshold(const int *in, int *out, size_t len, int8_t up, int8_t down);

View file

@ -348,7 +348,7 @@ int CmdHFSniff(const char *Cmd) {
// At the moment, sniff takes all free memory in bigbuff. If this changes,
// we can't start from beginning idx 0 but from that hi-to-start-of-allocated.
uint32_t start = g_pm3_capabilities.bigbuf_size - retval->len;
int res = getSamplesEx(start, start, false);
int res = getSamplesEx(start, start, false, true);
if (res != PM3_SUCCESS) {
PrintAndLogEx(WARNING, "failed to download samples to client");
return res;