MCPcopy Create free account
hub / github.com/emberian/evdev / with_absolute_axis

Method with_absolute_axis

src/uinput.rs:97–111  ·  view source on GitHub ↗

Set the absolute axes of this device.

(self, axis: &UinputAbsSetup)

Source from the content-addressed store, hash-verified

95
96 /// Set the absolute axes of this device.
97 pub fn with_absolute_axis(self, axis: &UinputAbsSetup) -> io::Result<Self> {
98 unsafe {
99 sys::ui_set_evbit(
100 self.fd.as_raw_fd(),
101 crate::EventType::ABSOLUTE.0 as nix::sys::ioctl::ioctl_param_type,
102 )?;
103 sys::ui_set_absbit(
104 self.fd.as_raw_fd(),
105 axis.code() as nix::sys::ioctl::ioctl_param_type,
106 )?;
107 sys::ui_abs_setup(self.fd.as_raw_fd(), &axis.0 as *const uinput_abs_setup)?;
108 }
109
110 Ok(self)
111 }
112
113 /// Set the relative axes of this device.
114 pub fn with_relative_axes(self, axes: &AttributeSetRef<RelativeAxisCode>) -> io::Result<Self> {

Callers 1

mainFunction · 0.80

Calls 2

as_raw_fdMethod · 0.45
codeMethod · 0.45

Tested by

no test coverage detected