#define __KERNEL_STRICT_NAMES
#define _GNU_SOURCE
#include <linux/input.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h> 
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

int main() {
        struct input_event evenement;
        int fd=open("/dev/input/event11"O_RDONLY);
        if(!fd)
                return -1;
        ioctl(fdEVIOCGRAB,1);
        while(1) {
                if(read(fd, &evenementsizeof(evenement))<0)
                        return -1;
                switch(evenement.code) {
                        default:
                                printf("time (s): %d\ntype: %d\ncode: %d\nvalue: %d\n"evenement.time.tv_sec,
                                        evenement.type,
                                        evenement.code,
                                        evenement.value);
                                break;
                }
        }
        return 0;
}