There is a race condition when we go from iclass commands to mf command. Especially noticable when eload large files where we used to spam the device with usb packages.\ntry iclass eload, then mf eload, and you see the client hang. With this change we trigger a preload of the fpga image before we start uploading to the device. Current places I could trigger this bug was in eload and gsave. With this patch only the first call takes some time if fpga image must be loaded. The following goes fast.\n\n if you find that the client hangs when going between, this could be the root cause.

This commit is contained in:
iceman1001 2023-07-26 23:47:55 +02:00
commit fc3a518f28
7 changed files with 64 additions and 21 deletions

View file

@ -783,6 +783,15 @@ static void PacketReceived(PacketCommandNG *packet) {
g_reply_via_usb = false;
break;
}
case CMD_SET_FPGAMODE: {
uint8_t mode = packet->data.asBytes[0];
if (mode >= FPGA_BITSTREAM_LF && mode <= FPGA_BITSTREAM_HF_15) {
FpgaDownloadAndGo(mode);
reply_ng(CMD_SET_FPGAMODE, PM3_SUCCESS, NULL, 0);
}
reply_ng(CMD_SET_FPGAMODE, PM3_EINVARG, NULL, 0);
break;
}
// emulator
case CMD_SET_DBGMODE: {
g_dbglevel = packet->data.asBytes[0];