mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-10 17:49:32 +08:00
chg: lf cmdread - now uses NG
This commit is contained in:
parent
ce4198f5f2
commit
d7f1ab2175
4 changed files with 52 additions and 25 deletions
|
@ -755,9 +755,17 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
reply_old(CMD_ACK, bits, 0, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
case CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K:
|
||||
ModThenAcquireRawAdcSamples125k(packet->oldarg[0], packet->oldarg[1], packet->oldarg[2], packet->data.asBytes);
|
||||
case CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K: {
|
||||
struct p {
|
||||
uint32_t delay;
|
||||
uint16_t ones;
|
||||
uint16_t zeros;
|
||||
} PACKED;
|
||||
struct p *payload;
|
||||
payload = (struct p*)packet->data.asBytes;
|
||||
ModThenAcquireRawAdcSamples125k(payload->delay, payload->zeros, payload->ones, packet->data.asBytes+8);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_SNIFF_RAW_ADC_SAMPLES: {
|
||||
uint32_t bits = SniffLF();
|
||||
reply_old(CMD_ACK, bits, 0, 0, 0, 0);
|
||||
|
|
|
@ -242,7 +242,7 @@ void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint32_t period_0, uint
|
|||
// Turn off antenna
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
// tell client we are done
|
||||
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
|
||||
reply_ng(CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, PM3_SUCCESS, NULL, 0);
|
||||
}
|
||||
|
||||
/* blank r/w tag data stream
|
||||
|
|
|
@ -199,7 +199,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag
|
|||
}
|
||||
|
||||
if (!silent) {
|
||||
Dbprintf("Done, saved %d out of %d seen samples at %d bits/sample", sample_total_saved, sample_total_numbers, bits_per_sample);
|
||||
Dbprintf("Done, saved " _YELLOW_("%d")"out of " _YELLOW_("%d")"seen samples at " _YELLOW_("%d")"bits/sample", sample_total_saved, sample_total_numbers, bits_per_sample);
|
||||
Dbprintf("buffer samples: %02x %02x %02x %02x %02x %02x %02x %02x ...",
|
||||
dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
|
||||
}
|
||||
|
|
|
@ -145,32 +145,37 @@ static int usage_lf_find(void) {
|
|||
int CmdLFCommandRead(const char *Cmd) {
|
||||
|
||||
bool errors = false;
|
||||
|
||||
uint32_t arg0 = 0;
|
||||
uint32_t arg1 = 0;
|
||||
uint32_t arg2 = 0;
|
||||
uint8_t data[PM3_CMD_DATA_SIZE];
|
||||
uint16_t datalen = 0;
|
||||
|
||||
struct p {
|
||||
uint32_t delay;
|
||||
uint16_t ones;
|
||||
uint16_t zeros;
|
||||
uint8_t data[PM3_CMD_DATA_SIZE - 8];
|
||||
} PACKED;
|
||||
|
||||
struct p payload;
|
||||
|
||||
|
||||
uint8_t cmdp = 0;
|
||||
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
||||
switch (tolower(param_getchar(Cmd, cmdp))) {
|
||||
case 'h':
|
||||
return usage_lf_cmdread();
|
||||
case 'c':
|
||||
datalen = param_getstr(Cmd, cmdp + 1, (char *)&data, sizeof(data));
|
||||
case 'c': // cmd bytes 1010
|
||||
datalen = param_getstr(Cmd, cmdp + 1, (char *)&payload.data, sizeof(payload.data));
|
||||
cmdp += 2;
|
||||
break;
|
||||
case 'd':
|
||||
arg0 = param_get32ex(Cmd, cmdp + 1, 0, 10);
|
||||
case 'd': // delay
|
||||
payload.delay = param_get32ex(Cmd, cmdp + 1, 0, 10);
|
||||
cmdp += 2;
|
||||
break;
|
||||
case 'z':
|
||||
arg1 = param_get32ex(Cmd, cmdp + 1, 0, 10) & 0xFFFF;
|
||||
case 'z': // zero
|
||||
payload.zeros = param_get32ex(Cmd, cmdp + 1, 0, 10) & 0xFFFF;
|
||||
cmdp += 2;
|
||||
break;
|
||||
case 'o':
|
||||
arg2 = param_get32ex(Cmd, cmdp + 1, 0, 10) & 0xFFFF;
|
||||
case 'o': // ones
|
||||
payload.ones = param_get32ex(Cmd, cmdp + 1, 0, 10) & 0xFFFF;
|
||||
cmdp += 2;
|
||||
break;
|
||||
default:
|
||||
|
@ -183,12 +188,26 @@ int CmdLFCommandRead(const char *Cmd) {
|
|||
//Validations
|
||||
if (errors || cmdp == 0) return usage_lf_cmdread();
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Sending");
|
||||
clearCommandBuffer();
|
||||
SendCommandOLD(CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, arg0, arg1, arg2, data, datalen);
|
||||
SendCommandNG(CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, (uint8_t*)&payload, 8 + datalen );
|
||||
|
||||
WaitForResponse(CMD_ACK, NULL);
|
||||
printf("\n");
|
||||
uint8_t i = 10;
|
||||
while ( !WaitForResponseTimeout(CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, NULL, 2000 ) && i != 0) {
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
i--;
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if ( i ) {
|
||||
PrintAndLogEx(SUCCESS, "Downloading response signal data");
|
||||
getSamples(0, true);
|
||||
return 0;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||
return PM3_EOPABORTED;
|
||||
}
|
||||
|
||||
int CmdFlexdemod(const char *Cmd) {
|
||||
|
|
Loading…
Reference in a new issue