Processes the given [`UInputEvent`] if it is a force feedback upload event, in which case this function will start the force feedback upload and claim ownership over the [`UInputEvent`] and return a [`FFUploadEvent`] instead. The returned event allows the user to allocate and set the effect ID as well as access the effect data. # Panics This function will panic if `event.code()` is not `UI_FF_U
(&mut self, event: UInputEvent)
| 332 | /// |
| 333 | /// This function will panic if `event.code()` is not `UI_FF_UPLOAD`. |
| 334 | pub fn process_ff_upload(&mut self, event: UInputEvent) -> io::Result<FFUploadEvent> { |
| 335 | assert_eq!(event.code(), UInputCode::UI_FF_UPLOAD); |
| 336 | |
| 337 | let mut request: sys::uinput_ff_upload = unsafe { std::mem::zeroed() }; |
| 338 | request.request_id = event.value() as u32; |
| 339 | unsafe { sys::ui_begin_ff_upload(self.fd.as_raw_fd(), &mut request)? }; |
| 340 | |
| 341 | request.retval = 0; |
| 342 | |
| 343 | let fd = self.fd.try_clone()?; |
| 344 | |
| 345 | Ok(FFUploadEvent { fd, request }) |
| 346 | } |
| 347 | |
| 348 | /// Processes the given [`UInputEvent`] if it is a force feedback erase event, in which case |
| 349 | /// this function will start the force feedback erasure and claim ownership over the |