Struct evdev_rs::UInputDevice

source ·
pub struct UInputDevice { /* private fields */ }
Expand description

Opaque struct representing an evdev uinput device

Implementations§

source§

impl UInputDevice

source

pub fn create_from_device<T: DeviceWrapper>(device: &T) -> Result<UInputDevice>

Create a uinput device based on the given libevdev device.

The uinput device will be an exact copy of the libevdev device, minus the bits that uinput doesn’t allow to be set.

source

pub fn devnode(&self) -> Option<&str>

Return the device node representing this uinput device.

This relies on libevdev_uinput_get_syspath() to provide a valid syspath.

source

pub fn syspath(&self) -> Option<&str>

Return the syspath representing this uinput device.

If the UI_GET_SYSNAME ioctl not available, libevdev makes an educated guess. The UI_GET_SYSNAME ioctl is available since Linux 3.15.

The syspath returned is the one of the input node itself (e.g. /sys/devices/virtual/input/input123), not the syspath of the device node returned with libevdev_uinput_get_devnode().

source

pub fn as_fd(&self) -> Option<RawFd>

Return the file descriptor used to create this uinput device.

This is the fd pointing to /dev/uinput. This file descriptor may be used to write events that are emitted by the uinput device. Closing this file descriptor will destroy the uinput device.

source

pub fn fd(&self) -> Option<RawFd>

👎Deprecated since 0.5.0: Prefer as_fd. Some function names were changed so they more closely match their type signature. See issue 42 for discussion https://github.com/ndesh26/evdev-rs/issues/42
source

pub fn write_event(&self, event: &InputEvent) -> Result<()>

Post an event through the uinput device.

It is the caller’s responsibility that any event sequence is terminated with an EV_SYN/SYN_REPORT/0 event. Otherwise, listeners on the device node will not see the events until the next EV_SYN event is posted.

Trait Implementations§

source§

impl Debug for UInputDevice

source§

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

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

impl Drop for UInputDevice

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for UInputDevice

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.