@@ -118,6 +118,7 @@ typedef struct {
#define INPUT_STATE_LEFTOPENBRACKET 0x04
#define INPUT_STATE_O 0x08
#define INPUT_STATE_2 0x10
+#define INPUT_STATE_LEFTOPENBRACKET_2 0x20
#define RESET_STATE_DEFAULT 0x00
#define RESET_STATE_ESC_R 0x01
@@ -1397,6 +1397,12 @@ UnicodeToEfiKey (
TerminalDevice->TerminalType == VTUTF8TYPE ||
TerminalDevice->TerminalType == TTYTERMTYPE) {
switch (UnicodeChar) {
+ case '3':
+ if (TerminalDevice->TerminalType == TTYTERMTYPE) {
+ TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET_2;
+ continue;
+ }
+ break;
case 'A':
Key.ScanCode = SCAN_UP;
break;
@@ -1527,6 +1533,33 @@ UnicodeToEfiKey (
break;
+ case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET | INPUT_STATE_LEFTOPENBRACKET_2:
+
+ Key.ScanCode = SCAN_NULL;
+
+ if (TerminalDevice->TerminalType == TTYTERMTYPE) {
+ switch (UnicodeChar) {
+ case '~':
+ Key.ScanCode = SCAN_DELETE;
+ break;
+ }
+ }
+
+ TerminalDevice->ResetState = RESET_STATE_DEFAULT;
+
+ if (Key.ScanCode != SCAN_NULL) {
+ Key.UnicodeChar = 0;
+ EfiKeyFiFoInsertOneKey (TerminalDevice, &Key);
+ TerminalDevice->InputState = INPUT_STATE_DEFAULT;
+ UnicodeToEfiKeyFlushState (TerminalDevice);
+ continue;
+ }
+
+ UnicodeToEfiKeyFlushState (TerminalDevice);
+
+ break;
+
+
default:
//
// Invalid state. This should never happen.
Accept the VT200 escape code [3~ as backspace for TtyTerm terminals. This is sent by many Linux terminals by default. This is the first 3 charactar escape sequency handled, so a new state is added to the escape sequence handling state machine. Signed-off-by: Roy Franz <roy.franz@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 --- MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h | 1 + MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+)