Set the switch codes that can be emitted by this device.
(self, switches: &AttributeSetRef<SwitchCode>)
| 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> { |
no test coverage detected