Merge "Fix for nix 0.27.1." into main am: be8bf80c56 am: b1e0c41c06

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2859925

Change-Id: I3ae646e0e3e8851e1d6a4fcccb9ad42a0f48173e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Matthew Maurer 2023-12-08 18:55:27 +00:00 committed by Automerger Merge Worker
commit ceee7c3b5c

View file

@ -14,7 +14,6 @@ use tokio_util::sync::CancellationToken;
use std::fs::{File, OpenOptions};
use std::io::{self, Read, Write};
use std::os::fd::AsRawFd;
use std::os::unix::fs::OpenOptionsExt;
enum State {
@ -61,13 +60,11 @@ impl State {
}
pub fn makeraw(file: File) -> io::Result<File> {
let fd = file.as_raw_fd();
// Configure the file descritpro as raw fd.
// Configure the file descriptor as raw fd.
use nix::sys::termios::*;
let mut attrs = tcgetattr(fd)?;
let mut attrs = tcgetattr(&file)?;
cfmakeraw(&mut attrs);
tcsetattr(fd, SetArg::TCSANOW, &attrs)?;
tcsetattr(&file, SetArg::TCSANOW, &attrs)?;
Ok(file)
}