Skip to content

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

add spi eeprom shell to controller

Geoe96b49c2beab
diff --git a/src/Controllers/SpiController.cpp b/src/Controllers/SpiController.cpp
index f80d40c2..e297ec54 100644
--- a/src/Controllers/SpiController.cpp
+++ b/src/Controllers/SpiController.cpp
@@ -6,7 +6,7 @@ Constructor
SpiController::SpiController(ITerminalView& terminalView, IInput& terminalInput,
SpiService& spiService, SdService& sdService, ArgTransformer& argTransformer,
UserInputManager& userInputManager, BinaryAnalyzeManager& binaryAnalyzeManager,
- SdCardShell& sdCardShell, SpiFlashShell& spiFlashShell)
+ SdCardShell& sdCardShell, SpiFlashShell& spiFlashShell, SpiEepromShell& spiEepromShell)
: terminalView(terminalView),
terminalInput(terminalInput),
spiService(spiService),
@@ -15,7 +15,8 @@ SpiController::SpiController(ITerminalView& terminalView, IInput& terminalInput,
userInputManager(userInputManager),
binaryAnalyzeManager(binaryAnalyzeManager),
sdCardShell(sdCardShell),
- spiFlashShell(spiFlashShell)
+ spiFlashShell(spiFlashShell),
+ spiEepromShell(spiEepromShell)
{}
/*
@@ -61,7 +62,10 @@ void SpiController::handleFlash(const TerminalCommand& cmd) {
EEPROM
*/
void SpiController::handleEeprom(const TerminalCommand& cmd) {
- terminalView.println("EEPROM operations [NYI]");
+ terminalView.println("\n[WARNING] SPI EEPROM is not fully implemented. Don't use it for real operations.");
+ terminalInput.waitPress();
+ spiEepromShell.run();
+ ensureConfigured();
}
/*
diff --git a/src/Controllers/SpiController.h b/src/Controllers/SpiController.h
index 20165a0c..b8ea3b17 100644
--- a/src/Controllers/SpiController.h
+++ b/src/Controllers/SpiController.h
@@ -13,6 +13,7 @@
#include "Shells/SpiFlashShell.h"
#include "States/GlobalState.h"
#include "Data/FlashDatabase.h"
+#include "Shells/SpiEepromShell.h"
class SpiController {
public:
@@ -25,7 +26,8 @@ public:
UserInputManager& userInputManager,
BinaryAnalyzeManager& binaryAnalyzeManager,
SdCardShell& sdCardShell,
- SpiFlashShell& spiFlashShell
+ SpiFlashShell& spiFlashShell,
+ SpiEepromShell& spiEepromShell
);
// Entry point for handle raw user command
@@ -47,6 +49,7 @@ private:
BinaryAnalyzeManager& binaryAnalyzeManager;
SdCardShell& sdCardShell;
SpiFlashShell& spiFlashShell;
+ SpiEepromShell& spiEepromShell;
GlobalState& state = GlobalState::getInstance();
bool configured = false;