Skip to content

Commit

Permalink
Merge pull request #150 from JohannesSchilling/hiddevice-as-raw-fd
Browse files Browse the repository at this point in the history
hiddevice: add `AsFd` impl
  • Loading branch information
ruabmbua authored Feb 7, 2024
2 parents 3d2eb50 + 2f1f3ae commit de3b9e3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/linux_native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
fs::{File, OpenOptions},
io::{Cursor, Read, Seek, SeekFrom},
os::{
fd::{AsRawFd, OwnedFd},
fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd},
unix::{ffi::OsStringExt, fs::OpenOptionsExt},
},
path::{Path, PathBuf},
Expand Down Expand Up @@ -473,6 +473,12 @@ impl HidDevice {
}
}

impl AsFd for HidDevice {
fn as_fd(&self) -> BorrowedFd {
self.fd.as_fd()
}
}

impl HidDeviceBackendBase for HidDevice {
fn write(&self, data: &[u8]) -> HidResult<usize> {
if data.is_empty() {
Expand Down

0 comments on commit de3b9e3

Please sign in to comment.