Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

add progression log for xmodem

Geob1d1fa9e63b3
diff --git a/src/Controllers/UartController.cpp b/src/Controllers/UartController.cpp
index 97c75032..4422758d 100644
--- a/src/Controllers/UartController.cpp
+++ b/src/Controllers/UartController.cpp
@@ -420,7 +420,8 @@ void UartController::handleXmodemSend(const std::string& path) {
}
// Infos
- terminalView.println(" [INFO] No progress bar will be shown.");
+ terminalView.println(" [INFO] No progress bar will be shown on WEBUI.");
+ terminalView.println(" Progress bar is only visible over USB Serial.");
terminalView.println(" Please be patient during the transfer.\n");
std::stringstream ss;
ss << " Estimated duration: ~"
@@ -459,7 +460,8 @@ void UartController::handleXmodemReceive(const std::string& path) {
// Infos
terminalView.println("");
terminalView.println(" [INFO] XMODEM receive mode is blocking.");
- terminalView.println(" No progress bar will be shown.");
+ terminalView.println(" No progress bar will be shown on WEBUI.");
+ terminalView.println(" Progress bar is only visible over USB Serial.");
terminalView.println(" The device will wait for incoming data");
terminalView.println(" for up to 2 minutes. Once started,");
terminalView.println(" the transfer must complete before exiting.\n");
diff --git a/src/Services/UartService.cpp b/src/Services/UartService.cpp
index 6e8d2a7b..843f56ae 100644
--- a/src/Services/UartService.cpp
+++ b/src/Services/UartService.cpp
@@ -195,16 +195,18 @@ void UartService::blockLookupHandler(void* blk_id, size_t idSize, byte* data, si
}
size_t offset = blockId * dataSize;
-
if (!currentFile->seek(offset)) {
return;
}
+ // Read
size_t readBytes = currentFile->read(data, dataSize);
-
if (readBytes < dataSize) {
memset(data + readBytes, 0x1A, dataSize - readBytes);
}
+
+ // Progression
+ Serial.printf("Sending bloc: %u\n\r", (unsigned int)blockId);
}
bool UartService::receiveBlockHandler(void* blk_id, size_t idSize, byte* data, size_t dataSize) {
@@ -212,6 +214,14 @@ bool UartService::receiveBlockHandler(void* blk_id, size_t idSize, byte* data, s
return false;
}
+ // Progression
+ uint32_t blockId = 0;
+ for (size_t i = 0; i < idSize; ++i) {
+ blockId = (blockId << 8) | ((uint8_t*)blk_id)[i];
+ }
+ Serial.printf("Receiving bloc: %u\r\n", (unsigned int)blockId);
+
+ // Write
return currentFile->write(data, dataSize) == dataSize;
}