Add the keyboard mode flags

This commit is contained in:
wyt8 2026-02-10 16:01:45 +00:00
parent c9032ad97c
commit 1fd4a65f4b
3 changed files with 24 additions and 0 deletions

1
Cargo.lock generated
View File

@ -122,6 +122,7 @@ dependencies = [
name = "aster-console"
version = "0.1.0"
dependencies = [
"bitflags 1.3.2",
"component",
"font8x8",
"int-to-c-enum",

View File

@ -6,6 +6,7 @@ edition.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bitflags.workspace = true
component.workspace = true
font8x8.workspace = true
int-to-c-enum.workspace = true

View File

@ -37,3 +37,25 @@ pub enum KeyboardMode {
/// The off mode (`K_OFF` in Linux).
Off = 4,
}
bitflags::bitflags! {
/// The keyboard mode flags.
///
// Reference: <https://elixir.bootlin.com/linux/v6.17.4/source/include/linux/kbd_kern.h#L53-L58>.
pub struct KeyboardModeFlags: u8 {
/// The application key mode (`VC_APPLIC` in Linux).
const APPLICATION = 1 << 0;
/// The cursor key mode (`VC_CKMODE` in Linux).
const CURSOR_KEY = 1 << 1;
/// The repeat mode (`VC_REPEAT` in Linux).
const REPEAT = 1 << 2;
/// The CRLF mode (`VC_CRLF` in Linux).
///
/// If set, enter key sends `\r\n`; otherwise, it sends `\r` only.
const CRLF = 1 << 3;
/// The meta key mode (`VC_META` in Linux).
///
/// If set, every input character has a prefix with `ESC` (0x1B).
const META = 1 << 4;
}
}