Skip to content

Commit

Permalink
block event based libevdev
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Mar 22, 2024
1 parent bd35e41 commit 1c2dbd2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include <epoch_time.h>

#define block() ioctl(libevdev_get_fd(dev), EVIOCGRAB, 1);
#define unblock() ioctl(libevdev_get_fd(dev), EVIOCGRAB, 0);

void listen_device(struct libevdev *dev){
const char *name = libevdev_get_name(dev);
printf("%s \n",name);
Expand All @@ -26,16 +29,13 @@ void listen_device(struct libevdev *dev){
debug("release %ld\n", epoch() - t);
do_right_click();
}
// debug("Event type: %ld, code: %d, value: %d\n", ev.type, ev.code, ev.value);

} else if (ev.type == EV_ABS || ev.type == EV_REL) {
if(epoch() - t > 100){
continue;
}
debug("move %ld\n", epoch() - t);
t = epoch();

// debug("Event type: %ld, code: %d, value: %d\n", ev.type, ev.code, ev.value);
}
} else if (rc != LIBEVDEV_READ_STATUS_SYNC) {
fprintf(stderr, "Error reading events: %d\n", rc);
Expand Down

0 comments on commit 1c2dbd2

Please sign in to comment.