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

Method with_switches

src/uinput.rs:149–167  ·  view source on GitHub ↗

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

(self, switches: &AttributeSetRef<SwitchCode>)

Source from the content-addressed store, hash-verified

147
148 /// Set the switch codes that can be emitted by this device.
149 pub fn with_switches(self, switches: &AttributeSetRef<SwitchCode>) -> io::Result<Self> {
150 unsafe {
151 sys::ui_set_evbit(
152 self.fd.as_raw_fd(),
153 crate::EventType::SWITCH.0 as nix::sys::ioctl::ioctl_param_type,
154 )?;
155 }
156
157 for bit in switches.iter() {
158 unsafe {
159 sys::ui_set_swbit(
160 self.fd.as_raw_fd(),
161 bit.0 as nix::sys::ioctl::ioctl_param_type,
162 )?;
163 }
164 }
165
166 Ok(self)
167 }
168
169 /// Set the force-feedback effects that can be emitted by this device.
170 pub fn with_ff(self, ff: &AttributeSetRef<FFEffectCode>) -> io::Result<Self> {

Callers 1

get_deviceFunction · 0.80

Calls 2

iterMethod · 0.80
as_raw_fdMethod · 0.45

Tested by

no test coverage detected