[][src]Struct joydev::Device

pub struct Device { /* fields omitted */ }

Default device abstraction

Methods

impl Device[src]

pub const fn axis_count(&self) -> u8[src]

Get axis count

pub fn axis_mapping(&self) -> &[AbsoluteAxis; 64][src]

Get axes mapping

pub fn axis_mapping_at(&self, number: u8) -> AbsoluteAxis[src]

Get axis mapping at index

pub const fn button_count(&self) -> u8[src]

Get button count

pub fn button_mapping(&self) -> &[KeyOrButton; 512][src]

Get buttons mapping

pub fn button_mapping_at(&self, number: u8) -> KeyOrButton[src]

Get button mapping at index

pub fn driver_version(&self) -> u32[src]

Get driver version

pub unsafe fn from_raw_fd(fd: RawFd) -> Result<Self>[src]

Create new device from raw fd

This function expects the file to be opened at least in read mode. Other flags are optional. Non-blocking mode is recommended unless you really don't want it. Other flags shouldn't have any impact.

If the file is not a valid device node the will fail gracefully.

pub fn get_correction_values(&self) -> Result<Vec<Correction>>[src]

Retrieve axes correction values. Wraps get_correction_values.

pub fn get_event(&self) -> Result<DeviceEvent>[src]

Read en event. Wraps get_event.

pub fn identifier(&self) -> &str[src]

Get device identifier

pub fn new(file: File) -> Result<Self>[src]

Create new device from file

This function expects the file to be opened at least in read mode. Other flags are optional. Non-blocking mode is recommended unless you really don't want it. Other flags shouldn't have any impact.

If the file is not a valid device node the will fail gracefully.

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>[src]

Create new device by opening file at path

This function always tries opening the file in read-only and non-blocking mode.

If the file is not a valid device node the will fail gracefully.

pub fn refresh_axis_mapping(&mut self) -> Result<()>[src]

Refresh axis mapping. Wraps get_axis_mapping.

pub fn refresh_button_mapping(&mut self) -> Result<()>[src]

Refresh button mapping. Wraps get_button_mapping.

pub fn refresh_mapping(&mut self) -> Result<()>[src]

Refresh mapping for both axis and buttons

pub fn set_axis_mapping(&mut self, mapping: &[AbsoluteAxis; 64]) -> Result<()>[src]

Set axes mapping. Wraps set_axis_mapping.

pub fn set_axis_mapping_at(
    &mut self,
    number: u8,
    axis: AbsoluteAxis
) -> Result<()>
[src]

Set axis mapping at index. Wraps set_axis_mapping.

pub fn set_button_mapping(&mut self, mapping: &[KeyOrButton; 512]) -> Result<()>[src]

Set buttons mapping. Wraps set_button_mapping.

pub fn set_button_mapping_at(
    &mut self,
    number: u8,
    button: KeyOrButton
) -> Result<()>
[src]

Set button mapping at index. Wraps set_button_mapping.

pub fn set_correction_values(&self, mapping: &[Correction; 64]) -> Result<()>[src]

Set axes correction values. Wraps set_correction_values.

Trait Implementations

impl AsRawFd for Device[src]

impl Debug for Device[src]

impl IntoRawFd for Device[src]

Auto Trait Implementations

impl RefUnwindSafe for Device

impl Send for Device

impl Sync for Device

impl Unpin for Device

impl UnwindSafe for Device

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.