A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol
C arduinobluetoothcan-busdebuggingeepromesp32flipperzerogpiohardware-hackingi2cjtagopenocdprotocolspwmradiorfidspisubghzuartwifi
add reboot cmd to sys shell
Geo501c2244e2b0
diff --git a/src/Data/UniversalRemoteCommands.h b/src/Data/UniversalRemoteCommands.hindex a25b3912..faf131fb 100644--- a/src/Data/UniversalRemoteCommands.h+++ b/src/Data/UniversalRemoteCommands.h@@ -9,10 +9,9 @@ struct InfraredCommandStruct{int subdevice;int function;- // ctor utilisable en expression constante+ // constexpr for compile time initializationconstexpr InfraredCommandStruct(InfraredProtocolEnum p, int d, int s, int f): proto(p), device(d), subdevice(s), function(f) {}- // si tu fais des calculs (encode NEC, etc.), assure-toi quβils sont aussi constexpr};inline constexpr InfraredCommandStruct universalOnOff[] = {diff --git a/src/Services/SystemService.cpp b/src/Services/SystemService.cppindex 705635fb..a4bdcd3b 100644--- a/src/Services/SystemService.cpp+++ b/src/Services/SystemService.cpp@@ -361,3 +361,11 @@ std::string SystemService::getNvsEntries() const {return out;}++void SystemService::reboot(bool hard) const {+ if (hard) {+ ESP.restart(); // Arduino-style reset+ } else {+ esp_restart(); // IDF reset+ }+}\ No newline at end of filediff --git a/src/Services/SystemService.h b/src/Services/SystemService.hindex 757ae19b..9c143ecc 100644--- a/src/Services/SystemService.h+++ b/src/Services/SystemService.h@@ -40,18 +40,17 @@ public:// Networkstd::string getBaseMac() const;- // Filesystems LittleFS & SPIFFS+ // Filesystemsbool littlefsBegin(bool autoFormat) const;void littlefsEnd() const;size_t littlefsTotalBytes() const;size_t littlefsUsedBytes() const;- bool spiffsBegin(bool autoFormat) const;- void spiffsEnd() const;- size_t spiffsTotalBytes() const;- size_t spiffsUsedBytes() const;// Formatted outputstd::string getPartitions() const;std::string getNvsStats() const;std::string getNvsEntries() const;++ // Boot+ void reboot(bool hard = false) const;};diff --git a/src/Shells/SysInfoShell.cpp b/src/Shells/SysInfoShell.cppindex 08a7f2f4..5839c261 100644--- a/src/Shells/SysInfoShell.cpp+++ b/src/Shells/SysInfoShell.cpp@@ -31,7 +31,8 @@ void SysInfoShell::run() {case 5: cmdNVS(false); break;case 6: cmdNVS(true); break;case 7: cmdNet(); break;- case 8: // Exit+ case 8: cmdReboot(); break;+ case 9: // Exitdefault:loop = false;break;@@ -181,3 +182,11 @@ void SysInfoShell::cmdNet() {terminalView.println("Status : " + std::string(wlStatusToStr(status)));terminalView.println("Prov enabled : " + std::string(wifiService.isProvisioningEnabled() ? "Yes" : "No"));}++void SysInfoShell::cmdReboot(bool hard) {+ auto confirmation = userInputManager.readYesNo("Reboot the device? (y/n)", false);+ if (confirmation) {+ terminalView.println("\nRebooting, your session will be lost...");+ systemService.reboot(hard);+ }+}\ No newline at end of filediff --git a/src/Shells/SysInfoShell.h b/src/Shells/SysInfoShell.hindex 941eff90..51803932 100644--- a/src/Shells/SysInfoShell.h+++ b/src/Shells/SysInfoShell.h@@ -31,7 +31,8 @@ private:" π§° NVS stats"," π NVS entries"," π Network",- " πͺ Exit"+ " π Reboot",+ "πͺ Exit"};const char* resetReasonToStr(int r) {@@ -99,6 +100,7 @@ private:void cmdFS();void cmdNVS(bool listEntries);void cmdNet();+ void cmdReboot(bool hard = false);ITerminalView& terminalView;IInput& terminalInput;