[−][src]Struct joydev::Device
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) -> &[Key; 512]
[src]
Get buttons mapping
pub fn button_mapping_at(&self, number: u8) -> Key
[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.
Safety
Safety is equivalent to that of std::fs::File::from_raw_fd
.
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]
&mut self,
number: u8,
axis: AbsoluteAxis
) -> Result<()>
Set axis mapping at index. Wraps set_axis_mapping
.
pub fn set_button_mapping(&mut self, mapping: &[Key; 512]) -> Result<()>
[src]
Set buttons mapping. Wraps set_button_mapping
.
pub fn set_button_mapping_at(&mut self, number: u8, button: Key) -> 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]
fn into_raw_fd(self) -> RawFd
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,