Struct input_linux::uinput::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>,

§

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.