Skip to content

uefi-raw: Add AbsolutePointerProtocol #990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

## uefi-raw - [Unreleased]

### Added
- Added `AbsolutePointerProtocol`.

### Changed
- `{install,reinstall,uninstall}_protocol_interface` now take `const` interface pointers.

Expand Down
50 changes: 50 additions & 0 deletions uefi-raw/src/protocol/console.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,58 @@
pub mod serial;

use crate::{guid, Char16, Event, Guid, PhysicalAddress, Status};
use bitflags::bitflags;
use core::ptr;

bitflags! {
/// Absolute pointer device attributes.
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
pub struct AbsolutePointerModeAttributes: u32 {
/// If set, this device supports an alternate button input.
const SUPPORTS_ALT_ACTIVE = 1;

/// If set, this device returns pressure data in
/// [`AbsolutePointerStatus::current_z`].
const SUPPORTS_PRESSURE_AS_Z = 2;
}
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
#[repr(C)]
pub struct AbsolutePointerMode {
pub absolute_min_x: u64,
pub absolute_min_y: u64,
pub absolute_min_z: u64,
pub absolute_max_x: u64,
pub absolute_max_y: u64,
pub absolute_max_z: u64,
pub attributes: AbsolutePointerModeAttributes,
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
#[repr(C)]
pub struct AbsolutePointerState {
pub current_x: u64,
pub current_y: u64,
pub current_z: u64,
pub active_buttons: u32,
}

#[derive(Debug)]
#[repr(C)]
pub struct AbsolutePointerProtocol {
pub reset: unsafe extern "efiapi" fn(this: *mut Self, extended_verification: u8) -> Status,
pub get_state:
unsafe extern "efiapi" fn(this: *const Self, state: *mut AbsolutePointerState) -> Status,
pub wait_for_input: Event,
pub mode: *mut AbsolutePointerMode,
}

impl AbsolutePointerProtocol {
pub const GUID: Guid = guid!("8d59d32b-c655-4ae9-9b15-f25904992a43");
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
#[repr(C)]
pub struct InputKey {
Expand Down