mirror of
https://github.com/rust-osdev/uefi-rs
synced 2026-06-08 17:17:36 +00:00
uefi: serial: fix core::fmt::Write impl
This is the more expected and natural behavior.
This commit is contained in:
@@ -10,6 +10,7 @@ extern crate alloc;
|
||||
|
||||
use alloc::string::ToString;
|
||||
use alloc::vec::Vec;
|
||||
use core::fmt::Write;
|
||||
use core::time::Duration;
|
||||
use uefi::mem::memory_map::MemoryMap;
|
||||
use uefi::prelude::*;
|
||||
@@ -116,7 +117,10 @@ fn send_request_helper(serial: &mut Serial, request: HostRequest) -> Result {
|
||||
serial.set_attributes(&io_mode)?;
|
||||
|
||||
// Send a screenshot request to the host.
|
||||
serial.write(request.as_bytes()).discard_errdata()?;
|
||||
//serial.write(request.as_bytes()).discard_errdata()?;
|
||||
serial
|
||||
.write_str(request.as_str())
|
||||
.expect("should write all bytes");
|
||||
|
||||
// Wait for the host's acknowledgement before moving forward.
|
||||
let mut reply = [0; 3];
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
return `n` in any case. In the happy path, this always corresponds to the
|
||||
length if the provided data/buffer, but helps to cope with non-spec-compliant
|
||||
implementations.
|
||||
- Fixed potential partial writes in `core::fmt::Write` impl of `Serial` protocol
|
||||
|
||||
# uefi - v0.36.1 (2025-11-05)
|
||||
|
||||
|
||||
@@ -345,6 +345,6 @@ impl Serial {
|
||||
|
||||
impl Write for Serial {
|
||||
fn write_str(&mut self, s: &str) -> fmt::Result {
|
||||
self.write(s.as_bytes()).map(|_| ()).map_err(|_| fmt::Error)
|
||||
self.write_exact(s.as_bytes()).map_err(|_| fmt::Error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user