Trait evdev_rs::DeviceWrapper[][src]

pub trait DeviceWrapper {
    fn raw(&self) -> *mut libevdev;

    fn enable(&self, blob: &dyn Any) -> 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,
        blob: Option<&dyn Any>
    ) -> Result<()> { ... }
fn disable(&self, blob: &dyn Any) -> Result<()> { ... }
fn disable_event_type(&self, ev_type: &EventType) -> Result<()> { ... }
fn disable_event_code(&self, code: &EventCode) -> Result<()> { ... }
fn has(&self, blob: &dyn Any) -> 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> { ... } }

Abstraction over structs which contain an inner *mut libevdev

Required methods

fn raw(&self) -> *mut libevdev[src]

Loading content...

Provided methods

fn enable(&self, blob: &dyn Any) -> Result<()>[src]

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.

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

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.

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

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.

fn enable_event_code(
    &self,
    ev_code: &EventCode,
    blob: Option<&dyn Any>
) -> Result<()>
[src]

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 NULL.

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

fn disable(&self, blob: &dyn Any) -> Result<()>[src]

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.

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

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.

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

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.

fn has(&self, blob: &dyn Any) -> bool[src]

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

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

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.

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

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.

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

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.

fn name(&self) -> Option<&str>[src]

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

fn phys(&self) -> Option<&str>[src]

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

fn uniq(&self) -> Option<&str>[src]

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

fn set_name(&self, field: &str)[src]

fn set_phys(&self, field: &str)[src]

fn set_uniq(&self, field: &str)[src]

fn product_id(&self) -> u16[src]

fn vendor_id(&self) -> u16[src]

fn bustype(&self) -> u16[src]

fn version(&self) -> u16[src]

fn set_product_id(&self, field: u16)[src]

fn set_vendor_id(&self, field: u16)[src]

fn set_bustype(&self, field: u16)[src]

fn set_version(&self, field: u16)[src]

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

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

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

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.

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

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.

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

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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

fn num_slots(&self) -> Option<i32>[src]

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”

fn current_slot(&self) -> Option<i32>[src]

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.

Loading content...

Implementors

Loading content...