pub struct AbsInfo(/* private fields */);Expand description
Information about an absolute axis (Abs).
Contains the axis’ current value, as well as range and resolution information.
Implementations§
Source§impl AbsInfo
impl AbsInfo
Sourcepub const fn new(minimum: i32, maximum: i32) -> Self
pub const fn new(minimum: i32, maximum: i32) -> Self
Creates a new AbsInfo with a minimum and maximum value.
All other fields start out as zero.
Sourcepub const fn with_raw_value(self, value: i32) -> Self
pub const fn with_raw_value(self, value: i32) -> Self
Returns a copy of self with the given axis value.
The value is not clamped to the minimum/maximum or modified in any other way.
Sourcepub const fn with_minimum(self, minimum: i32) -> Self
pub const fn with_minimum(self, minimum: i32) -> Self
Returns a copy of self with the given minimum.
Sourcepub const fn with_maximum(self, maximum: i32) -> Self
pub const fn with_maximum(self, maximum: i32) -> Self
Returns a copy of self with the given maximum.
Sourcepub const fn with_fuzz(self, fuzz: i32) -> Self
pub const fn with_fuzz(self, fuzz: i32) -> Self
Returns a copy of self with the given fuzz value.
Sourcepub const fn with_flat(self, flat: i32) -> Self
pub const fn with_flat(self, flat: i32) -> Self
Returns a copy of self with the given flat value.
Sourcepub const fn with_resolution(self, resolution: i32) -> Self
pub const fn with_resolution(self, resolution: i32) -> Self
Returns a copy of self with the given axis resolution.
See AbsInfo::resolution for more information.
Sourcepub const fn raw_value(&self) -> i32
pub const fn raw_value(&self) -> i32
Returns the raw value of the axis, without clamping.
This is typically between AbsInfo::minimum and AbsInfo::maximum, but this is not
enforced by the kernel. AbsInfo::value clamps the value to the valid range.
Sourcepub const fn fuzz(&self) -> i32
pub const fn fuzz(&self) -> i32
Returns the fuzz value of the axis.
The fuzz value is used by the kernel to filter out noise.
Sourcepub const fn flat(&self) -> i32
pub const fn flat(&self) -> i32
Returns the flat value of the axis.
The flat value configures the axis deadzone.
Sourcepub const fn resolution(&self) -> i32
pub const fn resolution(&self) -> i32
Returns the resolution of this axis.
This is not the granularity of the value field (which is always 1), but the relation of the axis value to physical units.
The resolution for the main axes (Abs::X, Abs::Y, Abs::Z, and
Abs::MT_POSITION_X and Abs::MT_POSITION_Y) is typically specified in
units/mm.
If the device has set InputProp::ACCELEROMETER, the
units for the main X/Y/Z axes are in units/g instead.
Rotational axes (Abs::RX, Abs::RY, Abs::RZ) use units/radian.
Note: This value is commonly reported incorrectly, so device-specific overrides might be needed.