Uploads a force feedback effect to the device.
(&mut self, data: FFEffectData)
| 680 | |
| 681 | /// Uploads a force feedback effect to the device. |
| 682 | pub fn upload_ff_effect(&mut self, data: FFEffectData) -> io::Result<FFEffect> { |
| 683 | let mut effect: sys::ff_effect = data.into(); |
| 684 | effect.id = -1; |
| 685 | |
| 686 | unsafe { sys::eviocsff(self.fd.as_raw_fd(), &effect)? }; |
| 687 | |
| 688 | let fd = self.fd.try_clone()?; |
| 689 | let id = effect.id as u16; |
| 690 | |
| 691 | Ok(FFEffect { fd, id }) |
| 692 | } |
| 693 | |
| 694 | /// Sets the force feedback gain, i.e. how strong the force feedback effects should be for the |
| 695 | /// device. A gain of 0 means no gain, whereas `u16::MAX` is the maximum gain. |