inputd: apply upstream e8f1b1a8 (control-char filter) and c3789b4e (write assert)

- e8f1b1a8 'Do not send TextInputEvent for control characters': set
  K_ESC, K_BKSP, K_ENTER to '\0' in all keymaps (US, GB, Dvorak, Azerty,
  Bepo, IT). Control characters are now produced via fbcond's
  scancode handler (0x1C -> \n, 0x0E -> \x7F) instead of via the
  character field. This pairs with the fbcond 0x1C Enter fix.

- c3789b4e 'only perform a single write and assert the amount written':
  add assertion in write_event that the kernel returned the full
  expected byte count. Prevents silent short writes in the input
  event path.

Per Phase 1.1 of local/docs/SYSTEM-STABILITY-AND-UPSTREAM-SYNC-PLAN.md.
This commit is contained in:
Red Bear OS
2026-07-08 21:44:47 +03:00
parent 596e73a92e
commit 73e44d8104
2 changed files with 21 additions and 19 deletions
+18 -18
View File
@@ -4,7 +4,7 @@ use std::str::FromStr;
mod keymaps {
pub static US: [(u8, [char; 2]); 53] = [
(orbclient::K_ESC, ['\x1B', '\x1B']),
(orbclient::K_ESC, ['\0', '\0']),
(orbclient::K_1, ['1', '!']),
(orbclient::K_2, ['2', '@']),
(orbclient::K_3, ['3', '#']),
@@ -17,7 +17,7 @@ mod keymaps {
(orbclient::K_0, ['0', ')']),
(orbclient::K_MINUS, ['-', '_']),
(orbclient::K_EQUALS, ['=', '+']),
(orbclient::K_BKSP, ['\x7F', '\x7F']),
(orbclient::K_BKSP, ['\0', '\0']),
(orbclient::K_TAB, ['\t', '\t']),
(orbclient::K_Q, ['q', 'Q']),
(orbclient::K_W, ['w', 'W']),
@@ -31,7 +31,7 @@ mod keymaps {
(orbclient::K_P, ['p', 'P']),
(orbclient::K_BRACE_OPEN, ['[', '{']),
(orbclient::K_BRACE_CLOSE, [']', '}']),
(orbclient::K_ENTER, ['\n', '\n']),
(orbclient::K_ENTER, ['\0', '\0']),
(orbclient::K_CTRL, ['\0', '\0']),
(orbclient::K_A, ['a', 'A']),
(orbclient::K_S, ['s', 'S']),
@@ -60,7 +60,7 @@ mod keymaps {
];
pub static GB: [(u8, [char; 2]); 54] = [
(orbclient::K_ESC, ['\x1B', '\x1B']),
(orbclient::K_ESC, ['\0', '\0']),
(orbclient::K_1, ['1', '!']),
(orbclient::K_2, ['2', '"']),
(orbclient::K_3, ['3', '£']),
@@ -73,7 +73,7 @@ mod keymaps {
(orbclient::K_0, ['0', ')']),
(orbclient::K_MINUS, ['-', '_']),
(orbclient::K_EQUALS, ['=', '+']),
(orbclient::K_BKSP, ['\x7F', '\x7F']),
(orbclient::K_BKSP, ['\0', '\0']),
(orbclient::K_TAB, ['\t', '\t']),
(orbclient::K_Q, ['q', 'Q']),
(orbclient::K_W, ['w', 'W']),
@@ -87,7 +87,7 @@ mod keymaps {
(orbclient::K_P, ['p', 'P']),
(orbclient::K_BRACE_OPEN, ['[', '{']),
(orbclient::K_BRACE_CLOSE, [']', '}']),
(orbclient::K_ENTER, ['\n', '\n']),
(orbclient::K_ENTER, ['\0', '\0']),
(orbclient::K_CTRL, ['\0', '\0']),
(orbclient::K_A, ['a', 'A']),
(orbclient::K_S, ['s', 'S']),
@@ -118,7 +118,7 @@ mod keymaps {
];
pub static DVORAK: [(u8, [char; 2]); 53] = [
(orbclient::K_ESC, ['\x1B', '\x1B']),
(orbclient::K_ESC, ['\0', '\0']),
(orbclient::K_1, ['1', '!']),
(orbclient::K_2, ['2', '@']),
(orbclient::K_3, ['3', '#']),
@@ -131,7 +131,7 @@ mod keymaps {
(orbclient::K_0, ['0', ')']),
(orbclient::K_MINUS, ['[', '{']),
(orbclient::K_EQUALS, [']', '}']),
(orbclient::K_BKSP, ['\x7F', '\x7F']),
(orbclient::K_BKSP, ['\0', '\0']),
(orbclient::K_TAB, ['\t', '\t']),
(orbclient::K_Q, ['\'', '"']),
(orbclient::K_W, [',', '<']),
@@ -145,7 +145,7 @@ mod keymaps {
(orbclient::K_P, ['l', 'L']),
(orbclient::K_BRACE_OPEN, ['/', '?']),
(orbclient::K_BRACE_CLOSE, ['=', '+']),
(orbclient::K_ENTER, ['\n', '\n']),
(orbclient::K_ENTER, ['\0', '\0']),
(orbclient::K_CTRL, ['\0', '\0']),
(orbclient::K_A, ['a', 'A']),
(orbclient::K_S, ['o', 'O']),
@@ -174,7 +174,7 @@ mod keymaps {
];
pub static AZERTY: [(u8, [char; 2]); 53] = [
(orbclient::K_ESC, ['\x1B', '\x1B']),
(orbclient::K_ESC, ['\0', '\0']),
(orbclient::K_1, ['&', '1']),
(orbclient::K_2, ['é', '2']),
(orbclient::K_3, ['"', '3']),
@@ -187,7 +187,7 @@ mod keymaps {
(orbclient::K_0, ['à', '0']),
(orbclient::K_MINUS, [')', '°']),
(orbclient::K_EQUALS, ['=', '+']),
(orbclient::K_BKSP, ['\x7F', '\x7F']),
(orbclient::K_BKSP, ['\0', '\0']),
(orbclient::K_TAB, ['\t', '\t']),
(orbclient::K_Q, ['a', 'A']),
(orbclient::K_W, ['z', 'Z']),
@@ -201,7 +201,7 @@ mod keymaps {
(orbclient::K_P, ['p', 'P']),
(orbclient::K_BRACE_OPEN, ['^', '¨']),
(orbclient::K_BRACE_CLOSE, ['$', '£']),
(orbclient::K_ENTER, ['\n', '\n']),
(orbclient::K_ENTER, ['\0', '\0']),
(orbclient::K_CTRL, ['\0', '\0']),
(orbclient::K_A, ['q', 'Q']),
(orbclient::K_S, ['s', 'S']),
@@ -230,7 +230,7 @@ mod keymaps {
];
pub static BEPO: [(u8, [char; 2]); 53] = [
(orbclient::K_ESC, ['\x1B', '\x1B']),
(orbclient::K_ESC, ['\0', '\0']),
(orbclient::K_1, ['"', '1']),
(orbclient::K_2, ['«', '2']),
(orbclient::K_3, ['»', '3']),
@@ -243,7 +243,7 @@ mod keymaps {
(orbclient::K_0, ['*', '0']),
(orbclient::K_MINUS, ['=', '°']),
(orbclient::K_EQUALS, ['%', '`']),
(orbclient::K_BKSP, ['\x7F', '\x7F']),
(orbclient::K_BKSP, ['\0', '\0']),
(orbclient::K_TAB, ['\t', '\t']),
(orbclient::K_Q, ['b', 'B']),
(orbclient::K_W, ['é', 'É']),
@@ -257,7 +257,7 @@ mod keymaps {
(orbclient::K_P, ['j', 'J']),
(orbclient::K_BRACE_OPEN, ['z', 'Z']),
(orbclient::K_BRACE_CLOSE, ['w', 'W']),
(orbclient::K_ENTER, ['\n', '\n']),
(orbclient::K_ENTER, ['\0', '\0']),
(orbclient::K_CTRL, ['\0', '\0']),
(orbclient::K_A, ['a', 'A']),
(orbclient::K_S, ['u', 'U']),
@@ -286,7 +286,7 @@ mod keymaps {
];
pub static IT: [(u8, [char; 2]); 53] = [
(orbclient::K_ESC, ['\x1B', '\x1B']),
(orbclient::K_ESC, ['\0', '\0']),
(orbclient::K_1, ['1', '!']),
(orbclient::K_2, ['2', '"']),
(orbclient::K_3, ['3', '£']),
@@ -299,7 +299,7 @@ mod keymaps {
(orbclient::K_0, ['0', '=']),
(orbclient::K_MINUS, ['?', '\'']),
(orbclient::K_EQUALS, ['ì', '^']),
(orbclient::K_BKSP, ['\x7F', '\x7F']),
(orbclient::K_BKSP, ['\0', '\0']),
(orbclient::K_TAB, ['\t', '\t']),
(orbclient::K_Q, ['q', 'Q']),
(orbclient::K_W, ['w', 'W']),
@@ -313,7 +313,7 @@ mod keymaps {
(orbclient::K_P, ['p', 'P']),
(orbclient::K_BRACE_OPEN, ['è', 'é']),
(orbclient::K_BRACE_CLOSE, ['+', '*']),
(orbclient::K_ENTER, ['\n', '\n']),
(orbclient::K_ENTER, ['\0', '\0']),
(orbclient::K_CTRL, ['\x20', '\x20']),
(orbclient::K_A, ['a', 'A']),
(orbclient::K_S, ['s', 'S']),
+3 -1
View File
@@ -205,7 +205,9 @@ impl ProducerHandle {
}
pub fn write_event(&mut self, event: orbclient::Event) -> io::Result<()> {
self.0.write(&event)?;
let written = self.0.write(&event)?;
assert_eq!(written, std::mem::size_of::<orbclient::Event>() as usize,
"write_event: short write ({} != {})", written, std::mem::size_of::<orbclient::Event>());
Ok(())
}
}