mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 10:43:01 +08:00
chg: lf read - now uses NG
This commit is contained in:
parent
ab8826fed8
commit
178c922218
2 changed files with 28 additions and 10 deletions
|
@ -751,8 +751,14 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
setSamplingConfig((sample_config *) packet->data.asBytes);
|
setSamplingConfig((sample_config *) packet->data.asBytes);
|
||||||
break;
|
break;
|
||||||
case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K: {
|
case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K: {
|
||||||
uint32_t bits = SampleLF(packet->oldarg[0], packet->oldarg[1]);
|
struct p {
|
||||||
reply_old(CMD_ACK, bits, 0, 0, 0, 0);
|
uint8_t silent;
|
||||||
|
uint32_t samples;
|
||||||
|
} PACKED;
|
||||||
|
struct p *payload;
|
||||||
|
payload = (struct p*)packet->data.asBytes;
|
||||||
|
uint32_t bits = SampleLF(payload->silent, payload->samples);
|
||||||
|
reply_ng(CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, PM3_SUCCESS, (uint8_t *)&bits, sizeof(bits));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K: {
|
case CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K: {
|
||||||
|
|
|
@ -207,7 +207,7 @@ int CmdLFCommandRead(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||||
return PM3_EOPABORTED;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdFlexdemod(const char *Cmd) {
|
int CmdFlexdemod(const char *Cmd) {
|
||||||
|
@ -353,22 +353,34 @@ int CmdLFSetConfig(const char *Cmd) {
|
||||||
|
|
||||||
bool lf_read(bool silent, uint32_t samples) {
|
bool lf_read(bool silent, uint32_t samples) {
|
||||||
if (!session.pm3_present) return false;
|
if (!session.pm3_present) return false;
|
||||||
|
|
||||||
|
struct p {
|
||||||
|
uint8_t silent;
|
||||||
|
uint32_t samples;
|
||||||
|
} PACKED;
|
||||||
|
|
||||||
|
struct p payload;
|
||||||
|
payload.silent = silent;
|
||||||
|
payload.samples = samples;
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandMIX(CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, silent, samples, 0, NULL, 0);
|
SendCommandNG(CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, (uint8_t *)&payload, sizeof(payload));
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (g_lf_threshold_set) {
|
if (g_lf_threshold_set) {
|
||||||
WaitForResponse(CMD_ACK, &resp);
|
WaitForResponse(CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, &resp);
|
||||||
} else {
|
} else {
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) {
|
if (!WaitForResponseTimeout(CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, &resp, 2500)) {
|
||||||
PrintAndLogEx(WARNING, "command execution time out");
|
PrintAndLogEx(WARNING, "command execution time out");
|
||||||
return false;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// resp.oldarg[0] is bits read not bytes read.
|
|
||||||
getSamples(resp.oldarg[0] / 8, silent);
|
|
||||||
|
|
||||||
return true;
|
// resp.oldarg[0] is bits read not bytes read.
|
||||||
|
uint32_t bits = (resp.data.asDwords[0] / 8 );
|
||||||
|
getSamples(bits, silent);
|
||||||
|
|
||||||
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdLFRead(const char *Cmd) {
|
int CmdLFRead(const char *Cmd) {
|
||||||
|
|
Loading…
Reference in a new issue