mirror of
https://github.com/troglobit/libuev.git
synced 2026-11-02 12:30:29 +00:00
Make sure to restart the I/O watcher on UEV_ERROR
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
ebb574136b
commit
d52254b4ec
2 files changed
+12
-6
No files matched your search
+8
-4
@@ -43,11 +43,15 @@ struct js_event {
|
||||
*/
|
||||
static void joystick_cb(uev_t *w, void *arg, int events)
|
||||
{
|
||||
if (UEV_ERROR == events)
|
||||
errx(EBADF, "Unrecoverable error, exiting");
|
||||
if (UEV_ERROR == events) {
|
||||
warnx("Spurious problem with the joystick watcher, restarting.");
|
||||
uev_io_start(w);
|
||||
}
|
||||
|
||||
if (read(w->fd, &e, sizeof(e)) < 0)
|
||||
errx(errno, "Failed reading joystick event");
|
||||
if (read(w->fd, &e, sizeof(e)) < 0) {
|
||||
warn("Failed reading joystick event");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.type) {
|
||||
case 1:
|
||||
|
||||
Reference in new issue
Block a user