Struct UInputHandle

Source
pub struct UInputHandle<F>(/* private fields */);
Expand description

A handle to a uinput allowing the use of ioctls

Implementations§

Source§

impl<F> UInputHandle<F>

Source

pub const fn new(fd: F) -> Self

Create a new handle using an existing open file object.

Source

pub fn into_inner(self) -> F

Extracts the contained handle.

Source

pub const fn as_inner(&self) -> &F

A reference to the contained handle.

Source

pub fn as_inner_mut(&mut self) -> &mut F

A mutable reference to the contained handle.

Source§

impl UInputHandle<OwnedFd>

Source

pub unsafe fn from_fd(fd: RawFd) -> Self

Create a new handle from a raw file descriptor.

Source§

impl<F: AsRawFd> UInputHandle<F>

Source

pub fn create_legacy( &self, id: &InputId, name: &[u8], ff_effects_max: u32, abs: &[AbsoluteInfoSetup], ) -> Result<()>

Create a new uinput device using the legacy UI_DEV_CREATE interface

Source

pub fn create( &self, id: &InputId, name: &[u8], ff_effects_max: u32, abs: &[AbsoluteInfoSetup], ) -> Result<()>

Create a new uinput device, and fall back on the legacy interface if necessary

Source

pub fn write(&self, events: &[input_event]) -> Result<usize>

Write input events to the device

Source

pub fn read(&self, events: &mut [input_event]) -> Result<usize>

Read events from uinput (see EV_UINPUT)

Source

pub fn sys_path(&self) -> Result<PathBuf>

Returns the sysfs directory for the input device.

Note that this path may not exist if sysfs is not mounted in the standard /sys location.

Source

pub fn evdev_name(&self) -> Result<OsString>

The device name of the input device.

Source

pub fn evdev_path(&self) -> Result<PathBuf>

The device node path of the input device.

Note that this path may not exist if /dev/input/* isn’t mounted properly.

Source

pub fn dev_create(&self) -> Result<()>

UI_DEV_CREATE

Source

pub fn dev_destroy(&self) -> Result<()>

UI_DEV_DESTROY

Source

pub fn dev_setup(&self, value: &uinput_setup) -> Result<()>

UI_DEV_SETUP

Source

pub fn abs_setup(&self, value: &uinput_abs_setup) -> Result<()>

UI_ABS_SETUP

Source

pub fn set_evbit(&self, value: EventKind) -> Result<()>

UI_SET_EVBIT

Source

pub fn set_keybit(&self, value: Key) -> Result<()>

UI_SET_KEYBIT

Source

pub fn set_relbit(&self, value: RelativeAxis) -> Result<()>

UI_SET_RELBIT

Source

pub fn set_absbit(&self, value: AbsoluteAxis) -> Result<()>

UI_SET_ABSBIT

Source

pub fn set_mscbit(&self, value: MiscKind) -> Result<()>

UI_SET_MSCBIT

Source

pub fn set_ledbit(&self, value: LedKind) -> Result<()>

UI_SET_LEDBIT

Source

pub fn set_sndbit(&self, value: SoundKind) -> Result<()>

UI_SET_SNDBIT

Source

pub fn set_ffbit(&self, value: ForceFeedbackKind) -> Result<()>

UI_SET_FFBIT

Source

pub fn set_phys(&self, value: &CStr) -> Result<()>

UI_SET_PHYS

Source

pub fn set_swbit(&self, value: SwitchKind) -> Result<()>

UI_SET_SWBIT

Source

pub fn set_propbit(&self, value: InputProperty) -> Result<()>

UI_SET_PROPBIT

Source

pub fn ff_upload_begin(&self, value: &mut uinput_ff_upload) -> Result<()>

UI_BEGIN_FF_UPLOAD

Source

pub fn ff_upload_end(&self, value: &uinput_ff_upload) -> Result<()>

UI_END_FF_UPLOAD

Source

pub fn ff_erase_begin(&self, value: &mut uinput_ff_erase) -> Result<()>

UI_BEGIN_FF_ERASE

Source

pub fn ff_erase_end(&self, value: &uinput_ff_erase) -> Result<()>

UI_END_FF_ERASE

Source

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

UI_GET_SYSNAME

Source

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

UI_GET_SYSNAME

Source

pub fn version(&self) -> Result<u32>

UI_GET_VERSION

Trait Implementations§

Source§

impl<F: AsRawFd> AsFd for UInputHandle<F>

Source§

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

Borrows the file descriptor. Read more
Source§

impl<F: FromRawFd> FromRawFd for UInputHandle<F>

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<F: IntoRawFd> IntoRawFd for UInputHandle<F>

Source§

fn into_raw_fd(self) -> RawFd

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

Auto Trait Implementations§

§

impl<F> Freeze for UInputHandle<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for UInputHandle<F>
where F: RefUnwindSafe,

§

impl<F> Send for UInputHandle<F>
where F: Send,

§

impl<F> Sync for UInputHandle<F>
where F: Sync,

§

impl<F> Unpin for UInputHandle<F>
where F: Unpin,

§

impl<F> UnwindSafe for UInputHandle<F>
where F: 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>,

Source§

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>,

Source§

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.