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