main.c
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/input.h>
int main(int argc, char **argv)
{
int fd = -1;
int len = 0;
int buf[32] = { 0 };
fd = open("/dev/miyooio", O_RDONLY);
while (1) {
if (read(fd, buf, sizeof(buf))) {
printf("UP %d\n", buf[4]);
printf("DOWN %d\n", buf[5]);
printf("LEFT %d\n", buf[6]);
printf("RIGHT %d\n", buf[7]);
printf("A %d\n", buf[8]);
printf("B %d\n", buf[0]);
printf("X %d\n", buf[9]);
printf("Y %d\n", buf[1]);
printf("L1 %d\n", buf[10]);
printf("L2 %d\n", buf[12]);
printf("R1 %d\n", buf[11]);
printf("R2 %d\n", buf[13]);
printf("SELECT %d\n", buf[2]);
printf("START %d\n", buf[3]);
printf("MENU %d\n", buf[16]);
printf("VOL+ %d\n", buf[17]);
printf("VOL- %d\n", buf[18]);
printf("\n");
}
usleep(500000);
}
close(fd);
return 0;
}