rust-osdev / uefi-rs

Rusty wrapper for the Unified Extensible Firmware Interface (UEFI). This crate makes it easy to develop Rust software that leverages safe, convenient, and performant abstractions for UEFI functionality.
https://rust-osdev.com/uefi-book
Mozilla Public License 2.0
1.31k stars 159 forks source link

Add function that removes a printed character from the screen. #1458

Open Motanescu1357 opened 1 week ago

nicholasbishop commented 1 week ago

You can do this by printing a backspace character (numeric value of 8). Here's a simple example, which I tested in both a VM on a Lenovo Thinkpad X1 Carbon:

#![no_main]
#![no_std]

use uefi::prelude::*;
use uefi::print;

#[entry]
fn main() -> Status {
    uefi::helpers::init().unwrap();

    print!("abcdefghijklmnopqrstuvwxyz");

    for _ in 0..26 {
        // Pause briefly.
        boot::stall(500_000);

        // Print backspace character.
        print!("\x08");
    }

    Status::SUCCESS
}

This prints abcdefghijklmnopqrstuvwxyz, then slowly removes characters one at a time.

Motanescu1357 commented 1 week ago

for me it does not work.

Motanescu1357 commented 1 week ago

Maybe my bios does not implement special characters like backspace.

nicholasbishop commented 1 week ago

Checking a couple things:

  1. What specific machine are you testing on?
  2. Did you test exactly the code above, or some variation? (I want to make sure we're both testing the exact same thing.)
Motanescu1357 commented 1 week ago

I used a ASUS M509 DA laptop with a AMD RYZEN 5 procesor. I tested the same code.