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

Method process_ff_erase

src/uinput.rs:358–370  ·  view source on GitHub ↗

Processes the given [`UInputEvent`] if it is a force feedback erase event, in which case this function will start the force feedback erasure and claim ownership over the [`UInputEvent`] and return a [`FFEraseEvent`] instead. The returned event allows the user to access the effect ID, such that it can free any memory used for the given effect ID. # Panics This function will panic if `event.code(

(&mut self, event: UInputEvent)

Source from the content-addressed store, hash-verified

356 ///
357 /// This function will panic if `event.code()` is not `UI_FF_ERASE`.
358 pub fn process_ff_erase(&mut self, event: UInputEvent) -> io::Result<FFEraseEvent> {
359 assert_eq!(event.code(), UInputCode::UI_FF_ERASE);
360
361 let mut request: sys::uinput_ff_erase = unsafe { std::mem::zeroed() };
362 request.request_id = event.value() as u32;
363 unsafe { sys::ui_begin_ff_erase(self.fd.as_raw_fd(), &mut request)? };
364
365 request.retval = 0;
366
367 let fd = self.fd.try_clone()?;
368
369 Ok(FFEraseEvent { fd, request })
370 }
371
372 /// Read a maximum of `num` events into the internal buffer. If the underlying fd is not
373 /// O_NONBLOCK, this will block.

Callers 1

mainFunction · 0.80

Calls 2

valueMethod · 0.80
as_raw_fdMethod · 0.45

Tested by

no test coverage detected