Skip to content

Commit

Permalink
Merge pull request #1371 from nicholasbishop/bishop-input-docs
Browse files Browse the repository at this point in the history
uefi: Update input protocol docs
  • Loading branch information
phip1611 authored Aug 27, 2024
2 parents 5466455 + ec84d34 commit ba8bad3
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions uefi/src/proto/console/text/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ impl Input {

/// Reads the next keystroke from the input device, if any.
///
/// Use [`wait_for_key_event`] with the [`BootServices::wait_for_event`]
/// Use [`wait_for_key_event`] with the [`boot::wait_for_event`]
/// interface in order to wait for a key to be pressed.
///
/// [`BootServices::wait_for_event`]: uefi::table::boot::BootServices::wait_for_event
/// [`boot::wait_for_event`]: crate::boot::wait_for_event
/// [`wait_for_key_event`]: Self::wait_for_key_event
///
/// # Errors
Expand All @@ -39,16 +39,13 @@ impl Input {
/// ```
/// use log::info;
/// use uefi::proto::console::text::{Input, Key, ScanCode};
/// use uefi::table::boot::BootServices;
/// use uefi::{Char16, Result, ResultExt};
/// use uefi::{boot, Char16, Result, ResultExt};
///
/// fn read_keyboard_events(boot_services: &BootServices, input: &mut Input) -> Result {
/// fn read_keyboard_events(input: &mut Input) -> Result {
/// loop {
/// // Pause until a keyboard event occurs.
/// let mut events = unsafe { [input.wait_for_key_event().unwrap()] };
/// boot_services
/// .wait_for_event(&mut events)
/// .discard_errdata()?;
/// boot::wait_for_event(&mut events).discard_errdata()?;
///
/// let u_key = Char16::try_from('u').unwrap();
/// match input.read_key()? {
Expand Down Expand Up @@ -79,8 +76,10 @@ impl Input {
}
}

/// Event to be used with `BootServices::wait_for_event()` in order to wait
/// Event to be used with [`boot::wait_for_event`] in order to wait
/// for a key to be available
///
/// [`boot::wait_for_event`]: crate::boot::wait_for_event
#[must_use]
pub fn wait_for_key_event(&self) -> Option<Event> {
unsafe { Event::from_ptr(self.0.wait_for_key) }
Expand Down

0 comments on commit ba8bad3

Please sign in to comment.