X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Flinux%2Fin_evdev.c;h=7866015212c45c64b89e377eb3a426c77a2fca5f;hb=553c3eaa3a4bda6ba99d925ecab518fe82530cd6;hp=4e23677e0421333a58243a1d3fff16e0409b3257;hpb=370d5805173cf2a3a3739b4245e6a27a47dd51d2;p=picodrive.git diff --git a/platform/linux/in_evdev.c b/platform/linux/in_evdev.c index 4e23677..7866015 100644 --- a/platform/linux/in_evdev.c +++ b/platform/linux/in_evdev.c @@ -317,6 +317,16 @@ static void in_evdev_set_blocking(void *drv_data, int y) perror("in_evdev: F_GETFL fcntl failed"); return; } + + if (flags & O_NONBLOCK) { + /* flush the event queue */ + struct input_event ev; + do { + ret = read(dev->fd, &ev, sizeof(ev)); + } + while (ret == sizeof(ev)); + } + if (y) flags &= ~O_NONBLOCK; else