mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-20 21:33:19 -07:00
fix USB send data timing issue in CMD_DOWNLOADED_SIM_SAMPLES_125K
This commit is contained in:
parent
13a79da4e9
commit
6982ac2612
2 changed files with 20 additions and 9 deletions
|
@ -716,9 +716,12 @@ void UsbPacketReceived(BYTE *packet, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
case CMD_DOWNLOADED_SIM_SAMPLES_125K: {
|
case CMD_DOWNLOADED_SIM_SAMPLES_125K: {
|
||||||
|
UsbCommand ack;
|
||||||
BYTE *b = (BYTE *)BigBuf;
|
BYTE *b = (BYTE *)BigBuf;
|
||||||
memcpy(b+c->arg[0], c->d.asBytes, 48);
|
memcpy(b+c->arg[0], c->d.asBytes, 48);
|
||||||
//Dbprintf("copied 48 bytes to %i",b+c->arg[0]);
|
//Dbprintf("copied 48 bytes to %i",b+c->arg[0]);
|
||||||
|
ack.cmd = CMD_ACK;
|
||||||
|
UsbSendPacket((BYTE*)&ack, sizeof(ack));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -688,6 +688,7 @@ static void CmdLosim(char *str)
|
||||||
/* convert to bitstream if necessary */
|
/* convert to bitstream if necessary */
|
||||||
ChkBitstream(str);
|
ChkBitstream(str);
|
||||||
|
|
||||||
|
PrintToScrollback("Sending data, please wait...");
|
||||||
for (i = 0; i < GraphTraceLen; i += 48) {
|
for (i = 0; i < GraphTraceLen; i += 48) {
|
||||||
UsbCommand c={CMD_DOWNLOADED_SIM_SAMPLES_125K, {i, 0, 0}};
|
UsbCommand c={CMD_DOWNLOADED_SIM_SAMPLES_125K, {i, 0, 0}};
|
||||||
int j;
|
int j;
|
||||||
|
@ -695,8 +696,10 @@ static void CmdLosim(char *str)
|
||||||
c.d.asBytes[j] = GraphBuffer[i+j];
|
c.d.asBytes[j] = GraphBuffer[i+j];
|
||||||
}
|
}
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
|
wait_for_response(CMD_ACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrintToScrollback("Starting simulator...");
|
||||||
UsbCommand c={CMD_SIMULATE_TAG_125K, {GraphTraceLen, gap, 0}};
|
UsbCommand c={CMD_SIMULATE_TAG_125K, {GraphTraceLen, gap, 0}};
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
}
|
}
|
||||||
|
@ -3068,6 +3071,11 @@ void UsbCommandReceived(UsbCommand *c)
|
||||||
for(i=0; i<48; i++) sample_buf[i] = c->d.asBytes[i];
|
for(i=0; i<48; i++) sample_buf[i] = c->d.asBytes[i];
|
||||||
received_command = c->cmd;
|
received_command = c->cmd;
|
||||||
return;
|
return;
|
||||||
|
case CMD_DOWNLOADED_SIM_SAMPLES_125K:
|
||||||
|
if (c->cmd != CMD_ACK) goto unexpected_response;
|
||||||
|
// got ACK
|
||||||
|
received_command = c->cmd;
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
unexpected_response:
|
unexpected_response:
|
||||||
PrintToScrollback("unrecognized command %08x\n", c->cmd);
|
PrintToScrollback("unrecognized command %08x\n", c->cmd);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue