hf thinfilm sim: let a second simulation wait for its own end

Enter leaves a simulation running on the device, by design. The next
hf thinfilm sim stopped it, took the PM3_EOPABORTED reply left behind
for its own and printed "Done!" at once. A ping round trip before
starting drops that reply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Gabriele GristinaandClaude Opus 5.5 committed 2026-11-06 22:43:09 +01:00
1 parent f90d0d0bf9
commit 59ec032d03
2 files changed
+10 -1

No files matched your search

+9 -1
View File
@@ -179,9 +179,17 @@ int CmdHfThinFilmSim(const char *Cmd) {
data[data_len++] = b1;
}
// end a simulation still running from an earlier call and drop its reply
PacketResponseNG resp;
clearCommandBuffer();
SendCommandNG(CMD_PING, NULL, 0);
if (WaitForResponseTimeout(CMD_PING, &resp, 3000) == false) {
PrintAndLogEx(WARNING, "command execution time out");
return PM3_ETIMEOUT;
}
clearCommandBuffer();
SendCommandNG(CMD_HF_THINFILM_SIMULATE, (uint8_t *)&data, data_len);
PacketResponseNG resp;
PrintAndLogEx(SUCCESS, "press " _GREEN_("pm3 button") " to abort simulation");
int ret;