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

Method with_keys

src/uinput.rs:75–94  ·  view source on GitHub ↗

Set the key codes that can be emitted by this device.

(self, keys: &AttributeSetRef<KeyCode>)

Source from the content-addressed store, hash-verified

73
74 /// Set the key codes that can be emitted by this device.
75 pub fn with_keys(self, keys: &AttributeSetRef<KeyCode>) -> io::Result<Self> {
76 // Run ioctls for setting capability bits
77 unsafe {
78 sys::ui_set_evbit(
79 self.fd.as_raw_fd(),
80 crate::EventType::KEY.0 as nix::sys::ioctl::ioctl_param_type,
81 )?;
82 }
83
84 for bit in keys.iter() {
85 unsafe {
86 sys::ui_set_keybit(
87 self.fd.as_raw_fd(),
88 bit.0 as nix::sys::ioctl::ioctl_param_type,
89 )?;
90 }
91 }
92
93 Ok(self)
94 }
95
96 /// Set the absolute axes of this device.
97 pub fn with_absolute_axis(self, axis: &UinputAbsSetup) -> io::Result<Self> {

Callers 3

get_deviceFunction · 0.80
mainFunction · 0.80

Calls 2

iterMethod · 0.80
as_raw_fdMethod · 0.45

Tested by 1