gvalkov / python-evdev

Python bindings for the Linux input subsystem
https://python-evdev.rtfd.org/
BSD 3-Clause "New" or "Revised" License
334 stars 112 forks source link

Many duplicate UInput force-feedback events with async #211

Closed sjgriffiths closed 8 months ago

sjgriffiths commented 8 months ago

When trying to implement an asynchronous force-feedback forwarding identical to the example given in the docs, using the fftest tool, there are many duplicate ecodes.EV_FF events which cause highly unpredictable rumbling behaviour on the physical gamepad.

Simply altering it to a synchronous version with for [...] read_loop(), as per the docs, instead of async for [...] async_read_loop() causes correct behaviour, but this means I can't fire it off asynchronously with an event processing loop for the physical device. I assume this is some sort of bug in the asynchronous handling of EV_FF events (the upload/erase events seem to be working fine, in contrast).

I guess the workaround from my perspective is to manually multithread my two processing loops, instead.

sjgriffiths commented 8 months ago

...the physical device event processor was duplicating the forwarded EV_FF events in an infinite loop. Oops.