[Concept,09/19] input: Add Home and End key support for sandbox SDL console

Message ID 20260130035849.3580212-10-simon.glass@canonical.com
State New
Headers
Series Enhanced command-line editing with undo/redo support |

Commit Message

Simon Glass Jan. 30, 2026, 3:58 a.m. UTC
  Add KEY_HOME and KEY_END to the ANSI escape sequence table so that
these keys work in the sandbox SDL console. They generate the escape
sequences ESC [ H and ESC [ F respectively, which are then decoded
by cli_getch.c to move the cursor to the beginning or end of the line.

Also add these keys (plus KEY_DELETE) to the sandbox cros-ec keyboard
matrix so they are recognized by the emulated keyboard controller.

There are no tests for this feature.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 arch/sandbox/dts/cros-ec-keyboard.dtsi | 4 ++++
 drivers/input/input.c                  | 3 +++
 2 files changed, 7 insertions(+)
  

Patch

diff --git a/arch/sandbox/dts/cros-ec-keyboard.dtsi b/arch/sandbox/dts/cros-ec-keyboard.dtsi
index d885a5ecd22..a8a2c790b9a 100644
--- a/arch/sandbox/dts/cros-ec-keyboard.dtsi
+++ b/arch/sandbox/dts/cros-ec-keyboard.dtsi
@@ -110,6 +110,10 @@ 
 			MATRIX_KEY(0x07, 0x09, KEY_O)
 			MATRIX_KEY(0x07, 0x0b, KEY_UP)
 			MATRIX_KEY(0x07, 0x0c, KEY_LEFT)
+
+			MATRIX_KEY(0x00, 0x07, KEY_HOME)
+			MATRIX_KEY(0x00, 0x09, KEY_END)
+			MATRIX_KEY(0x00, 0x0b, KEY_DELETE)
 		>;
 	};
 };
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 5206d6f68d6..5d265837a25 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -188,6 +188,9 @@  static struct {
 	{ KEY_LEFT, "[D"},
 	{ KEY_RIGHT, "[C"},
 	{ KEY_DOWN, "[B"},
+	{ KEY_HOME, "[H"},
+	{ KEY_END, "[F"},
+	{ KEY_DELETE, "[3~"},
 	{ KEY_F1, "OP"},
 	{ KEY_F2, "OQ"},
 	{ KEY_F3, "OR"},