mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Prep spiffs for bigger data files
- added spiffs check after flase wipe to force it to update its status - added spiffs write and append to write in 8192 byte chunks to allow spiffs space to be freed in time. - fixed spiffs dump to correctly handle issues if it could not allocate bugbuff space.
This commit is contained in:
parent
bebfe0ad2f
commit
d8c18e6db8
4 changed files with 52 additions and 14 deletions
|
@ -2166,20 +2166,26 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
uint32_t size = packet->oldarg[1];
|
||||
|
||||
uint8_t *buff = BigBuf_malloc(size);
|
||||
rdv40_spiffs_read_as_filetype((char *)filename, (uint8_t *)buff, size, RDV40_SPIFFS_SAFETY_SAFE);
|
||||
if (buff == NULL) {
|
||||
if (g_dbglevel >= DBG_DEBUG) Dbprintf ("Could not allocate buffer");
|
||||
// Trigger a finish downloading signal with an PM3_EMALLOC
|
||||
reply_ng(CMD_SPIFFS_DOWNLOAD, PM3_EMALLOC, NULL, 0);
|
||||
} else {
|
||||
rdv40_spiffs_read_as_filetype((char *)filename, (uint8_t *)buff, size, RDV40_SPIFFS_SAFETY_SAFE);
|
||||
// arg0 = filename
|
||||
// arg1 = size
|
||||
// arg2 = RFU
|
||||
|
||||
// arg0 = filename
|
||||
// arg1 = size
|
||||
// arg2 = RFU
|
||||
|
||||
for (size_t i = 0; i < size; i += PM3_CMD_DATA_SIZE) {
|
||||
size_t len = MIN((size - i), PM3_CMD_DATA_SIZE);
|
||||
int result = reply_old(CMD_SPIFFS_DOWNLOADED, i, len, 0, buff + i, len);
|
||||
if (result != PM3_SUCCESS)
|
||||
Dbprintf("transfer to client failed :: | bytes between %d - %d (%d) | result: %d", i, i + len, len, result);
|
||||
for (size_t i = 0; i < size; i += PM3_CMD_DATA_SIZE) {
|
||||
size_t len = MIN((size - i), PM3_CMD_DATA_SIZE);
|
||||
int result = reply_old(CMD_SPIFFS_DOWNLOADED, i, len, 0, buff + i, len);
|
||||
if (result != PM3_SUCCESS)
|
||||
Dbprintf("transfer to client failed :: | bytes between %d - %d (%d) | result: %d", i, i + len, len, result);
|
||||
}
|
||||
// Trigger a finish downloading signal with an ACK frame
|
||||
reply_ng(CMD_SPIFFS_DOWNLOAD, PM3_SUCCESS, NULL, 0);
|
||||
BigBuf_free ();
|
||||
}
|
||||
// Trigger a finish downloading signal with an ACK frame
|
||||
reply_ng(CMD_SPIFFS_DOWNLOAD, PM3_SUCCESS, NULL, 0);
|
||||
LED_B_OFF();
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue