r_efi/protocols/
absolute_pointer.rs

1//! Absolute Pointer Protocol
2//!
3//! Provides a simple method for accessing absolute pointer devices. This
4//! includes devices such as touch screens and digitizers. The Absolute Pointer
5//! Protocol allows information about a pointer device to be retrieved. The
6//! protocol is attached to the device handle of an absolute pointer device,
7//! and can be used for input from the user in the preboot environment.
8//!
9//! Supported devices may return 1, 2, or 3 axis of information. The Z axis may
10//! optionally be used to return pressure data measurements derived from user
11//! pen force.
12//!
13//! All supported devices must support a touch-active status. Supported devices
14//! may optionally support a second input button, for example a pen
15//! side-button.
16
17pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
18    0x8d59d32b,
19    0xc655,
20    0x4ae9,
21    0x9b,
22    0x15,
23    &[0xf2, 0x59, 0x04, 0x99, 0x2a, 0x43],
24);
25
26pub const SUPPORTS_ALT_ACTIVE: u32 = 0x00000001;
27pub const SUPPORTS_PRESSURE_AS_Z: u32 = 0x00000002;
28
29#[derive(Clone, Copy, Debug, Default)]
30#[repr(C)]
31pub struct Mode {
32    pub absolute_min_x: u64,
33    pub absolute_min_y: u64,
34    pub absolute_min_z: u64,
35    pub absolute_max_x: u64,
36    pub absolute_max_y: u64,
37    pub absolute_max_z: u64,
38    pub attributes: u32,
39}
40
41pub const TOUCH_ACTIVE: u32 = 0x00000001;
42pub const ALT_ACTIVE: u32 = 0x00000002;
43
44#[derive(Clone, Copy, Debug, Default)]
45#[repr(C)]
46pub struct State {
47    pub current_x: u64,
48    pub current_y: u64,
49    pub current_z: u64,
50    pub active_buttons: u32,
51}
52
53pub type Reset = eficall! {fn(
54    this: *mut Protocol,
55    extended_verification: bool,
56) -> crate::base::Status};
57
58pub type GetState = eficall! {fn(
59    this: *mut Protocol,
60    state: *mut State,
61) -> crate::base::Status};
62
63#[repr(C)]
64pub struct Protocol {
65    pub reset: Reset,
66    pub get_state: GetState,
67    pub wait_for_input: crate::efi::Event,
68    pub mode: *mut Mode,
69}