Trait evdev_rs::DeviceWrapper

source ·
pub trait DeviceWrapper: Sized {
Show 45 methods // Required method fn raw(&self) -> *mut libevdev; // Provided methods fn enable<E: Enable>(&self, e: E) -> Result<()> { ... } fn enable_property(&self, prop: &InputProp) -> Result<()> { ... } fn enable_event_type(&self, ev_type: &EventType) -> Result<()> { ... } fn enable_event_code( &self, ev_code: &EventCode, data: Option<EnableCodeData> ) -> Result<()> { ... } fn disable<E: Enable>(&self, d: E) -> Result<()> { ... } fn disable_event_type(&self, ev_type: &EventType) -> Result<()> { ... } fn disable_event_code(&self, code: &EventCode) -> Result<()> { ... } fn disable_property(&self, prop: &InputProp) -> Result<()> { ... } fn has<E: Enable>(&self, e: E) -> bool { ... } fn has_property(&self, prop: &InputProp) -> bool { ... } fn has_event_type(&self, ev_type: &EventType) -> bool { ... } fn has_event_code(&self, code: &EventCode) -> bool { ... } fn name(&self) -> Option<&str> { ... } fn phys(&self) -> Option<&str> { ... } fn uniq(&self) -> Option<&str> { ... } fn set_name(&self, field: &str) { ... } fn set_phys(&self, field: &str) { ... } fn set_uniq(&self, field: &str) { ... } fn product_id(&self) -> u16 { ... } fn vendor_id(&self) -> u16 { ... } fn bustype(&self) -> u16 { ... } fn version(&self) -> u16 { ... } fn set_product_id(&self, field: u16) { ... } fn set_vendor_id(&self, field: u16) { ... } fn set_bustype(&self, field: u16) { ... } fn set_version(&self, field: u16) { ... } fn abs_info(&self, code: &EventCode) -> Option<AbsInfo> { ... } fn set_abs_info(&self, code: &EventCode, absinfo: &AbsInfo) { ... } fn event_value(&self, code: &EventCode) -> Option<i32> { ... } fn set_event_value(&self, code: &EventCode, val: i32) -> Result<()> { ... } fn abs_minimum(&self, code: u32) -> Result<i32> { ... } fn abs_maximum(&self, code: u32) -> Result<i32> { ... } fn abs_fuzz(&self, code: u32) -> Result<i32> { ... } fn abs_flat(&self, code: u32) -> Result<i32> { ... } fn abs_resolution(&self, code: u32) -> Result<i32> { ... } fn set_abs_minimum(&self, code: u32, val: i32) { ... } fn set_abs_maximum(&self, code: u32, val: i32) { ... } fn set_abs_fuzz(&self, code: u32, val: i32) { ... } fn set_abs_flat(&self, code: u32, val: i32) { ... } fn set_abs_resolution(&self, code: u32, val: i32) { ... } fn slot_value(&self, slot: u32, code: &EventCode) -> Option<i32> { ... } fn set_slot_value( &self, slot: u32, code: &EventCode, val: i32 ) -> Result<()> { ... } fn num_slots(&self) -> Option<i32> { ... } fn current_slot(&self) -> Option<i32> { ... }
}
Expand description

Abstraction over structs which contain an inner *mut libevdev

Required Methods§

source

fn raw(&self) -> *mut libevdev

Provided Methods§

source

fn enable<E: Enable>(&self, e: E) -> Result<()>

Forcibly enable an EventType/InputProp on this device, even if the underlying device does not support it. While this cannot make the device actually report such events, it will now return true for has().

This is a local modification only affecting only this representation of this device.

source

fn enable_property(&self, prop: &InputProp) -> Result<()>

Enables this property, a call to set_file will overwrite any previously set values

Note: Please use the enable function instead. This function is only available for the sake of maintaining compatibility with libevdev.

source

fn enable_event_type(&self, ev_type: &EventType) -> Result<()>

Forcibly enable an event type on this device, even if the underlying device does not support it. While this cannot make the device actually report such events, it will now return true for libevdev_has_event_type().

This is a local modification only affecting only this representation of this device.

Note: Please use the enable function instead. This function is only available for the sake of maintaining compatibility with libevdev.

source

fn enable_event_code( &self, ev_code: &EventCode, data: Option<EnableCodeData> ) -> Result<()>

Forcibly enable an event type on this device, even if the underlying device does not support it. While this cannot make the device actually report such events, it will now return true for libevdev_has_event_code().

The last argument depends on the type and code: If type is EV_ABS, data must be a pointer to a struct input_absinfo containing the data for this axis. If type is EV_REP, data must be a pointer to a int containing the data for this axis. For all other types, the argument must be None.

Note: Please use the enable function instead. This function is only available for the sake of maintaining compatibility with libevdev.

source

fn disable<E: Enable>(&self, d: E) -> Result<()>

Forcibly disable an EventType/EventCode on this device, even if the underlying device provides it. This effectively mutes the respective set of events. has() will return false for this EventType/EventCode

In most cases, a caller likely only wants to disable a single code, not the whole type.

Disabling EV_SYN will not work. In Peter’s Words “Don’t shoot yourself in the foot. It hurts”.

This is a local modification only affecting only this representation of this device.

source

fn disable_event_type(&self, ev_type: &EventType) -> Result<()>

Forcibly disable an event type on this device, even if the underlying device provides it. This effectively mutes the respective set of events. libevdev will filter any events matching this type and none will reach the caller. libevdev_has_event_type() will return false for this type.

In most cases, a caller likely only wants to disable a single code, not the whole type. Use disable_event_code for that.

Disabling EV_SYN will not work. In Peter’s Words “Don’t shoot yourself in the foot. It hurts”.

This is a local modification only affecting only this representation of this device.

Note: Please use the disable function instead. This function is only available for the sake of maintaining compatibility with libevdev.

source

fn disable_event_code(&self, code: &EventCode) -> Result<()>

Forcibly disable an event code on this device, even if the underlying device provides it. This effectively mutes the respective set of events. libevdev will filter any events matching this type and code and none will reach the caller. has_event_code will return false for this code.

Disabling all event codes for a given type will not disable the event type. Use disable_event_type for that.

This is a local modification only affecting only this representation of this device.

Disabling codes of type EV_SYN will not work. Don’t shoot yourself in the foot. It hurts.

Note: Please use the disable function instead. This function is only available for the sake of maintaining compatibility with libevdev.

source

fn disable_property(&self, prop: &InputProp) -> Result<()>

source

fn has<E: Enable>(&self, e: E) -> bool

Returns true if device support the InputProp/EventType/EventCode and false otherwise

source

fn has_property(&self, prop: &InputProp) -> bool

Returns true if device support the property and false otherwise

Note: Please use the has function instead. This function is only available for the sake of maintaining compatibility with libevdev.

source

fn has_event_type(&self, ev_type: &EventType) -> bool

Returns true is the device support this event type and false otherwise

Note: Please use the has function instead. This function is only available for the sake of maintaining compatibility with libevdev.

source

fn has_event_code(&self, code: &EventCode) -> bool

Return true is the device support this event type and code and false otherwise

Note: Please use the has function instead. This function is only available for the sake of maintaining compatibility with libevdev.

source

fn name(&self) -> Option<&str>

Get device’s name, as set by the kernel, or overridden by a call to set_name

source

fn phys(&self) -> Option<&str>

Get device’s physical location, as set by the kernel, or overridden by a call to set_phys

source

fn uniq(&self) -> Option<&str>

Get device’s unique identifier, as set by the kernel, or overridden by a call to set_uniq

source

fn set_name(&self, field: &str)

source

fn set_phys(&self, field: &str)

source

fn set_uniq(&self, field: &str)

source

fn product_id(&self) -> u16

source

fn vendor_id(&self) -> u16

source

fn bustype(&self) -> u16

source

fn version(&self) -> u16

source

fn set_product_id(&self, field: u16)

source

fn set_vendor_id(&self, field: u16)

source

fn set_bustype(&self, field: u16)

source

fn set_version(&self, field: u16)

source

fn abs_info(&self, code: &EventCode) -> Option<AbsInfo>

Get the axis info for the given axis, as advertised by the kernel.

Returns the AbsInfo for the given the code or None if the device doesn’t support this code

source

fn set_abs_info(&self, code: &EventCode, absinfo: &AbsInfo)

Change the abs info for the given EV_ABS event code, if the code exists.

This function has no effect if has_event_code returns false for this code.

source

fn event_value(&self, code: &EventCode) -> Option<i32>

Returns the current value of the event type.

If the device supports this event type and code, the return value is set to the current value of this axis. Otherwise, None is returned.

source

fn set_event_value(&self, code: &EventCode, val: i32) -> Result<()>

Set the value for a given event type and code.

This only makes sense for some event types, e.g. setting the value for EV_REL is pointless.

This is a local modification only affecting only this representation of this device. A future call to event_value() will return this value, unless the value was overwritten by an event.

If the device supports ABS_MT_SLOT, the value set for any ABS_MT_* event code is the value of the currently active slot. You should use set_slot_value instead.

If the device supports ABS_MT_SLOT and the type is EV_ABS and the code is ABS_MT_SLOT, the value must be a positive number less then the number of slots on the device. Otherwise, set_event_value returns Err.

source

fn abs_minimum(&self, code: u32) -> Result<i32>

source

fn abs_maximum(&self, code: u32) -> Result<i32>

source

fn abs_fuzz(&self, code: u32) -> Result<i32>

source

fn abs_flat(&self, code: u32) -> Result<i32>

source

fn abs_resolution(&self, code: u32) -> Result<i32>

source

fn set_abs_minimum(&self, code: u32, val: i32)

source

fn set_abs_maximum(&self, code: u32, val: i32)

source

fn set_abs_fuzz(&self, code: u32, val: i32)

source

fn set_abs_flat(&self, code: u32, val: i32)

source

fn set_abs_resolution(&self, code: u32, val: i32)

source

fn slot_value(&self, slot: u32, code: &EventCode) -> Option<i32>

Return the current value of the code for the given slot.

If the device supports this event code, the return value is is set to the current value of this axis. Otherwise, or if the event code is not an ABS_MT_* event code, None is returned

source

fn set_slot_value(&self, slot: u32, code: &EventCode, val: i32) -> Result<()>

Set the value for a given code for the given slot.

This is a local modification only affecting only this representation of this device. A future call to slot_value will return this value, unless the value was overwritten by an event.

This function does not set event values for axes outside the ABS_MT range, use set_event_value instead.

source

fn num_slots(&self) -> Option<i32>

Get the number of slots supported by this device.

The number of slots supported, or None if the device does not provide any slots

A device may provide ABS_MT_SLOT but a total number of 0 slots. Hence the return value of None for “device does not provide slots at all”

source

fn current_slot(&self) -> Option<i32>

Get the currently active slot.

This may differ from the value an ioctl may return at this time as events may have been read off the file since changing the slot value but those events are still in the buffer waiting to be processed. The returned value is the value a caller would see if it were to process events manually one-by-one.

Object Safety§

This trait is not object safe.

Implementors§