fix: CMD_DOWNLOAD_BIGBUF for getSamples() and download_trace()

This commit is contained in:
douniwan5788 2024-08-27 22:39:50 +08:00
commit 4b6653696c
2 changed files with 11 additions and 10 deletions

View file

@ -2391,15 +2391,15 @@ static void PacketReceived(PacketCommandNG *packet) {
// arg2 = BigBuf tracelen
//Dbprintf("transfer to client parameters: %" PRIu32 " | %" PRIu32 " | %" PRIu32, startidx, numofbytes, packet->oldarg[2]);
for (size_t i = 0; i < numofbytes; i += PM3_CMD_DATA_SIZE) {
size_t len = MIN((numofbytes - i), PM3_CMD_DATA_SIZE);
int result = reply_old(CMD_DOWNLOADED_BIGBUF, i, len, BigBuf_get_traceLen(), mem + startidx + i, len);
for (size_t offset = 0; offset < numofbytes; offset += PM3_CMD_DATA_SIZE) {
size_t len = MIN((numofbytes - offset), PM3_CMD_DATA_SIZE);
int result = reply_old(CMD_DOWNLOADED_BIGBUF, offset, len, BigBuf_get_traceLen(), &mem[startidx + offset], len);
if (result != PM3_SUCCESS)
Dbprintf("transfer to client failed :: | bytes between %d - %d (%d) | result: %d", i, i + len, len, result);
Dbprintf("transfer to client failed :: | bytes between %d - %d (%d) | result: %d", offset, offset + len, len, result);
}
// Trigger a finish downloading signal with an ACK frame
// arg0 = status of download transfer
reply_mix(CMD_ACK, 1, 0, 0, 0, 0);
reply_mix(CMD_ACK, 1, 0, BigBuf_get_traceLen(), NULL, 0);
LED_B_OFF();
break;
}