Struct hidraw::Device

source ·
pub struct Device(_);

Implementations§

source§

impl Device

source

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>

Examples found in repository?
examples/info.rs (line 6)
5
6
7
8
9
10
11
12
13
14
15
fn print_info<P: AsRef<Path>>(path: P) -> Result<()> {
	let mut device = Device::open(path)?;

	println!("{:?}", device.get_physical_address()?);
	println!("{:?}", device.get_report_descriptor()?);
	println!("{:?}", device.get_raw_info()?);
	println!("{:?}", device.get_raw_name()?);
	println!("{:?}", device.get_raw_unique()?);

	Ok(())
}
source§

impl Device

source

pub fn get_feature_report<T>(&mut self, report_id: u8) -> Result<T>

Request a feature report using HIDIOCGFEATURE ioctl.

source

pub fn get_input_report<T>(&mut self, report_id: u8) -> Result<T>

Request an input report using HIDIOCGINPUT ioctl.

source

pub fn get_input_report_read<T>(&mut self, report_id: u8) -> Result<T>

Request an input report using read.

source

pub fn get_output_report<T>(&mut self, report_id: u8) -> Result<T>

Request an output report using HIDIOCGOUTPUT ioctl.

source

pub fn get_physical_address(&mut self) -> Result<String>

Examples found in repository?
examples/info.rs (line 8)
5
6
7
8
9
10
11
12
13
14
15
fn print_info<P: AsRef<Path>>(path: P) -> Result<()> {
	let mut device = Device::open(path)?;

	println!("{:?}", device.get_physical_address()?);
	println!("{:?}", device.get_report_descriptor()?);
	println!("{:?}", device.get_raw_info()?);
	println!("{:?}", device.get_raw_name()?);
	println!("{:?}", device.get_raw_unique()?);

	Ok(())
}
source

pub fn get_raw_info(&mut self) -> Result<RawInfo>

Examples found in repository?
examples/info.rs (line 10)
5
6
7
8
9
10
11
12
13
14
15
fn print_info<P: AsRef<Path>>(path: P) -> Result<()> {
	let mut device = Device::open(path)?;

	println!("{:?}", device.get_physical_address()?);
	println!("{:?}", device.get_report_descriptor()?);
	println!("{:?}", device.get_raw_info()?);
	println!("{:?}", device.get_raw_name()?);
	println!("{:?}", device.get_raw_unique()?);

	Ok(())
}
source

pub fn get_raw_name(&mut self) -> Result<String>

Examples found in repository?
examples/info.rs (line 11)
5
6
7
8
9
10
11
12
13
14
15
fn print_info<P: AsRef<Path>>(path: P) -> Result<()> {
	let mut device = Device::open(path)?;

	println!("{:?}", device.get_physical_address()?);
	println!("{:?}", device.get_report_descriptor()?);
	println!("{:?}", device.get_raw_info()?);
	println!("{:?}", device.get_raw_name()?);
	println!("{:?}", device.get_raw_unique()?);

	Ok(())
}
source

pub fn get_raw_unique(&mut self) -> Result<String>

Examples found in repository?
examples/info.rs (line 12)
5
6
7
8
9
10
11
12
13
14
15
fn print_info<P: AsRef<Path>>(path: P) -> Result<()> {
	let mut device = Device::open(path)?;

	println!("{:?}", device.get_physical_address()?);
	println!("{:?}", device.get_report_descriptor()?);
	println!("{:?}", device.get_raw_info()?);
	println!("{:?}", device.get_raw_name()?);
	println!("{:?}", device.get_raw_unique()?);

	Ok(())
}
source

pub fn get_report_descriptor(&mut self) -> Result<Vec<u8>>

Examples found in repository?
examples/info.rs (line 9)
5
6
7
8
9
10
11
12
13
14
15
fn print_info<P: AsRef<Path>>(path: P) -> Result<()> {
	let mut device = Device::open(path)?;

	println!("{:?}", device.get_physical_address()?);
	println!("{:?}", device.get_report_descriptor()?);
	println!("{:?}", device.get_raw_info()?);
	println!("{:?}", device.get_raw_name()?);
	println!("{:?}", device.get_raw_unique()?);

	Ok(())
}
source

pub fn send_feature_report<T>(&mut self, report: &T) -> Result<()>

Send a feature report using HIDIOCSFEATURE ioctl.

source

pub fn send_input_report<T>(&mut self, report: &T) -> Result<()>

Send an input report using HIDIOCSINPUT ioctl.

source

pub fn send_output_report<T>(&mut self, report: &T) -> Result<()>

Send an output report using HIDIOCSOUTPUT ioctl.

source

pub fn send_output_report_write<T>(&mut self, report: &T) -> Result<()>

Send an output report using write.

Trait Implementations§

source§

impl AsFd for Device

source§

fn as_fd(&self) -> BorrowedFd<'_>

Borrows the file descriptor. Read more
source§

impl AsRawFd for Device

source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
source§

impl Debug for Device

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Device> for OwnedFd

source§

fn from(device: Device) -> Self

Converts to this type from the input type.
source§

impl From<OwnedFd> for Device

source§

fn from(owned_fd: OwnedFd) -> Self

Converts to this type from the input type.
source§

impl FromRawFd for Device

source§

unsafe fn from_raw_fd(fd: RawFd) -> Self

Constructs a new instance of Self from the given raw file descriptor. Read more
source§

impl IntoRawFd for Device

source§

fn into_raw_fd(self) -> RawFd

Consumes this object, returning the raw underlying file descriptor. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.