Make EvdevRead() return errors to the caller
Errors during read() in EvdevRead() are not passed back to the caller.
This is problematic for level-triggered IO polling, because permanent
errors (such as device removal) are not detected and we will continue to
poll the device forever without handling the error.
This manifests itself as the device polling thread spinning, and non-IO
tasks (device hotplug, feedback collection) do not make progress because
MessagePumpLibevent never yields until there's no work to do.
xf86-input-cmt expects errno values to be returned from EvdevRead() (even
though it wasn't doing so), so return the errno value upon failure.
Temporary errors still return success; otherwise we also need to patch
the call site.
TEST=Change chrome to delay unplug events to make the bug reproduce
easily, then remove a mouse from the system. Without fix, device
thread spins at 100% CPU and hotplug stops making progress. With
fix, the error is detected and the libevent watcher gets cancelled.
Reviewed-by: Kevin Schoedel <firstname.lastname@example.org>
Reviewed-by: Alex Sakhartchouk <email@example.com>
Tested-by: Michael Spang <firstname.lastname@example.org>
Commit-Queue: Matthew Yuan <email@example.com>
1 file changed