diff --git a/Cargo.lock b/Cargo.lock index 4efcb4046..c1a2ba35f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -122,6 +122,7 @@ dependencies = [ name = "aster-console" version = "0.1.0" dependencies = [ + "bitflags 1.3.2", "component", "font8x8", "int-to-c-enum", diff --git a/kernel/comps/console/Cargo.toml b/kernel/comps/console/Cargo.toml index cd45a36f7..a84a0c2d9 100644 --- a/kernel/comps/console/Cargo.toml +++ b/kernel/comps/console/Cargo.toml @@ -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 diff --git a/kernel/comps/console/src/mode.rs b/kernel/comps/console/src/mode.rs index 709155b1c..849eb21d6 100644 --- a/kernel/comps/console/src/mode.rs +++ b/kernel/comps/console/src/mode.rs @@ -37,3 +37,25 @@ pub enum KeyboardMode { /// The off mode (`K_OFF` in Linux). Off = 4, } + +bitflags::bitflags! { + /// The keyboard mode flags. + /// + // Reference: . + 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; + } +}