Skip to content

Commit

Permalink
Merge branch 'master' into hitag
Browse files Browse the repository at this point in the history
* master:
  Fix delay in acquisition and DoAcquisition_config usage. Fixes #524
  chg: 'data samples' - colors
  only set new timeout if its faster :)
  • Loading branch information
doegox committed Jan 15, 2020
2 parents 6c0d6f0 + 3303361 commit cfc7609
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion armsrc/lfops.c
Original file line number Diff line number Diff line change
Expand Up @@ -2550,7 +2550,7 @@ void Cotag(uint32_t arg0) {
doCotagAcquisitionManchester();
break;
case 2:
DoAcquisition_config(true, true);
DoAcquisition_config(false, 0);
break;
}

Expand Down
6 changes: 4 additions & 2 deletions armsrc/lfsampling.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ void initSampleBuffer(uint32_t *sample_size) {

data.buffer = BigBuf_get_addr();

memset(data.buffer, 0, *sample_size);
// We can't erase the buffer now, it would drastically delay the acquisition
// memset(data.buffer, 0, *sample_size);
} else {
*sample_size = MIN(*sample_size, BigBuf_max_traceLen());

data.buffer = BigBuf_malloc(*sample_size);

memset(data.buffer, 0, *sample_size);
// We can't erase the buffer now, it would drastically delay the acquisition
// memset(data.buffer, 0, *sample_size);
}

//
Expand Down
3 changes: 2 additions & 1 deletion armsrc/mifareutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ int mifare_classic_authex(struct Crypto1State *pcs, uint32_t uid, uint8_t blockN
uint32_t save_timeout = iso14a_get_timeout();

// set timeout for authentication response
iso14a_set_timeout(106);
if (save_timeout > 106)
iso14a_set_timeout(106);

// Receive 4 byte tag answer
len = ReaderReceive(receivedAnswer, receivedAnswerPar);
Expand Down
10 changes: 5 additions & 5 deletions client/cmddata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,28 +1599,28 @@ int getSamples(uint32_t n, bool verbose) {
if (n == 0 || n > sizeof(got))
n = sizeof(got);

if (verbose) PrintAndLogEx(NORMAL, "Reading %d bytes from device memory\n", n);
if (verbose) PrintAndLogEx(INFO, "Reading " _YELLOW_("%u") "bytes from device memory", n);

PacketResponseNG response;
if (!GetFromDevice(BIG_BUF, got, n, 0, NULL, 0, &response, 10000, true)) {
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
return PM3_ETIMEOUT;
}

if (verbose) PrintAndLogEx(NORMAL, "Data fetched");
if (verbose) PrintAndLogEx(SUCCESS, "Data fetched");

uint8_t bits_per_sample = 8;

//Old devices without this feature would send 0 at arg[0]
if (response.oldarg[0] > 0) {
sample_config *sc = (sample_config *) response.data.asBytes;
if (verbose) PrintAndLogEx(NORMAL, "Samples @ %d bits/smpl, decimation 1:%d ", sc->bits_per_sample, sc->decimation);
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;
}

if (bits_per_sample < 8) {

if (verbose) PrintAndLogEx(NORMAL, "Unpacking...");
if (verbose) PrintAndLogEx(INFO, "Unpacking...");

BitstreamOut bout = { got, bits_per_sample * n, 0};
int j = 0;
Expand All @@ -1630,7 +1630,7 @@ int getSamples(uint32_t n, bool verbose) {
}
GraphTraceLen = j;

if (verbose) PrintAndLogEx(NORMAL, "Unpacked %d samples", j);
if (verbose) PrintAndLogEx(INFO, "Unpacked %d samples", j);

} else {
for (int j = 0; j < n; j++) {
Expand Down

0 comments on commit cfc7609

Please sign in to comment.