A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol
C arduinobluetoothcan-busdebuggingeepromesp32flipperzerogpiohardware-hackingi2cjtagopenocdprotocolspwmradiorfidspisubghzuartwifi
handle cardputer scrolling keys in dispatcher user input
Geo9ecd4eac042d
diff --git a/src/Dispatchers/ActionDispatcher.cpp b/src/Dispatchers/ActionDispatcher.cppindex c1fc6ba3..723a07cc 100644--- a/src/Dispatchers/ActionDispatcher.cpp+++ b/src/Dispatchers/ActionDispatcher.cpp@@ -92,6 +92,10 @@ void ActionDispatcher::dispatchCommand(const TerminalCommand& cmd) {// Mode specific commandswitch (state.getCurrentMode()) {case ModeEnum::HIZ:+ if (state.getTerminalMode() == TerminalTypeEnum::Standalone) {+ provider.getTerminalView().println("Type 'mode' to select a mode.");+ return;+ }provider.getTerminalView().println("Type 'help' or 'mode'");break;case ModeEnum::OneWire:@@ -226,6 +230,7 @@ std::string ActionDispatcher::getUserAction() {char c = provider.getTerminalInput().readChar();if (c == KEY_NONE) continue;+ if (handleCardputerEscapeSequence(c, inputLine)) continue;if (handleEscapeSequence(c, inputLine, cursorIndex, mode)) continue;if (handleEnterKey(c, inputLine)) return inputLine;if (handleBackspace(c, inputLine, cursorIndex, mode)) continue;@@ -233,6 +238,21 @@ std::string ActionDispatcher::getUserAction() {}}+/*+User Action: Cardputer Special Arrows+*/+bool ActionDispatcher::handleCardputerEscapeSequence(char c, std::string& inputLine) {+ if (c == CARDPUTER_SPECIAL_ARROW_UP) {+ provider.getTerminalView().print(std::string(1, CARDPUTER_SPECIAL_ARROW_UP));+ } else if (c == CARDPUTER_SPECIAL_ARROW_DOWN) {+ provider.getTerminalView().print(std::string(1, CARDPUTER_SPECIAL_ARROW_DOWN));+ } else {+ return false;+ }++ return true;+}+/*User Action: Escape*/diff --git a/src/Dispatchers/ActionDispatcher.h b/src/Dispatchers/ActionDispatcher.hindex daf4cf70..b990fe16 100644--- a/src/Dispatchers/ActionDispatcher.h+++ b/src/Dispatchers/ActionDispatcher.h@@ -41,6 +41,9 @@ private:// Handle ANSI escape sequences (arrows, etc.)bool handleEscapeSequence(char c, std::string& inputLine, size_t& cursorIndex, const std::string& mode);+ // Handle Cardputer arrows+ bool handleCardputerEscapeSequence(char c, std::string& inputLine);+// Handle backspace logicbool handleBackspace(char c, std::string& inputLine, size_t& cursorIndex, const std::string& mode);