r_efi/protocols/
simple_text_input_ex.rs

1//! Extended Simple Text Input Protocol
2//!
3//! The simple-text-input-ex protocol extends the simple-text-input protocol by allowing more
4//! details reporting about modifiers, etc.
5
6pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
7    0xdd9e7534,
8    0x7762,
9    0x4698,
10    0x8c,
11    0x14,
12    &[0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa],
13);
14
15pub const SHIFT_STATE_VALID: u32 = 0x80000000u32;
16pub const RIGHT_SHIFT_PRESSED: u32 = 0x00000001u32;
17pub const LEFT_SHIFT_PRESSED: u32 = 0x00000002u32;
18pub const RIGHT_CONTROL_PRESSED: u32 = 0x00000004u32;
19pub const LEFT_CONTROL_PRESSED: u32 = 0x00000008u32;
20pub const RIGHT_ALT_PRESSED: u32 = 0x00000010u32;
21pub const LEFT_ALT_PRESSED: u32 = 0x00000020u32;
22pub const RIGHT_LOGO_PRESSED: u32 = 0x00000040u32;
23pub const LEFT_LOGO_PRESSED: u32 = 0x00000080u32;
24pub const MENU_KEY_PRESSED: u32 = 0x00000100u32;
25pub const SYS_REQ_PRESSED: u32 = 0x00000200u32;
26
27pub const TOGGLE_STATE_VALID: u8 = 0x80u8;
28pub const KEY_STATE_EXPOSED: u8 = 0x40u8;
29pub const SCROLL_LOCK_ACTIVE: u8 = 0x01u8;
30pub const NUM_LOCK_ACTIVE: u8 = 0x02u8;
31pub const CAPS_LOCK_ACTIVE: u8 = 0x04u8;
32
33pub type KeyToggleState = u8;
34pub type KeyNotifyFunction = eficall! {fn(*mut KeyData) -> crate::base::Status};
35
36#[repr(C)]
37#[derive(Clone, Copy, Debug, Default)]
38pub struct KeyState {
39    pub key_shift_state: u32,
40    pub key_toggle_state: KeyToggleState,
41}
42
43#[repr(C)]
44#[derive(Clone, Copy, Debug, Default)]
45pub struct KeyData {
46    pub key: crate::protocols::simple_text_input::InputKey,
47    pub key_state: KeyState,
48}
49
50pub type ProtocolReset = eficall! {fn(
51    *mut Protocol,
52    crate::base::Boolean,
53) -> crate::base::Status};
54
55pub type ProtocolReadKeyStrokeEx = eficall! {fn(
56    *mut Protocol,
57    *mut KeyData,
58) -> crate::base::Status};
59
60pub type ProtocolSetState = eficall! {fn(
61    *mut Protocol,
62    *mut KeyToggleState,
63) -> crate::base::Status};
64
65pub type ProtocolRegisterKeyNotify = eficall! {fn(
66    *mut Protocol,
67    *mut KeyData,
68    KeyNotifyFunction,
69    *mut *mut core::ffi::c_void,
70) -> crate::base::Status};
71
72pub type ProtocolUnregisterKeyNotify = eficall! {fn(
73    *mut Protocol,
74    *mut core::ffi::c_void,
75) -> crate::base::Status};
76
77#[repr(C)]
78pub struct Protocol {
79    pub reset: ProtocolReset,
80    pub read_key_stroke_ex: ProtocolReadKeyStrokeEx,
81    pub wait_for_key_ex: crate::base::Event,
82    pub set_state: ProtocolSetState,
83    pub register_key_notify: ProtocolRegisterKeyNotify,
84    pub unregister_key_notify: ProtocolUnregisterKeyNotify,
85}