Struct uhid_virt::UHIDDevice

source ·
pub struct UHIDDevice<T: Read + Write> { /* private fields */ }

Implementations§

source§

impl<T: Read + Write> UHIDDevice<T>

Character misc-device handle for a specific HID device

source

pub fn write(&mut self, data: &[u8]) -> Result<usize>

The data parameter should contain a data-payload. This is the raw data that you read from your device. The kernel will parse the HID reports.

source

pub fn write_set_report_reply(&mut self, id: u32, err: u16) -> Result<usize>

Write a SetReportReply, only use in reponse to a read SetReport event

source

pub fn write_get_report_reply( &mut self, id: u32, err: u16, data: Vec<u8> ) -> Result<usize>

Write a GetReportReply, only use in reponse to a read GetReport event

source

pub fn read(&mut self) -> Result<OutputEvent, StreamError>

Reads a queued output event. No reaction is required to an output event, but you should handle them according to your needs.

source

pub fn destroy(&mut self) -> Result<usize>

This destroys the internal HID device. No further I/O will be accepted. There may still be pending output events that you can receive but no further input events can be sent to the kernel.

source§

impl UHIDDevice<File>

source

pub fn create(params: CreateParams) -> Result<UHIDDevice<File>>

Opens the character misc-device at /dev/uhid

source

pub fn create_with_path( params: CreateParams, path: &Path ) -> Result<UHIDDevice<File>>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for UHIDDevice<T>
where T: RefUnwindSafe,

§

impl<T> Send for UHIDDevice<T>
where T: Send,

§

impl<T> Sync for UHIDDevice<T>
where T: Sync,

§

impl<T> Unpin for UHIDDevice<T>
where T: Unpin,

§

impl<T> UnwindSafe for UHIDDevice<T>
where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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 T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.