diff options
Diffstat (limited to 'src/tests/test3.c')
-rw-r--r-- | src/tests/test3.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/tests/test3.c b/src/tests/test3.c new file mode 100644 index 0000000..d3bcf4a --- /dev/null +++ b/src/tests/test3.c @@ -0,0 +1,50 @@ +int main(void) +{ + return 0; +} + +// This code is to simulate key presses + +// #include <stdio.h> +// #include <fcntl.h> +// #include <unistd.h> +// #include <linux/input.h> + +// int main() +// { +// int fd = open("/dev/input/event0", O_WRONLY | O_NONBLOCK); +// if (fd < 0) { +// perror("Failed to open device"); +// return 1; +// } + +// struct input_event event; +// memset(&event, 0, sizeof(event)); +// event.type = EV_KEY; +// event.code = KEY_A; +// event.value = 1; // Key press +// gettimeofday(&event.time, NULL); + +// ssize_t ret = write(fd, &event, sizeof(event)); +// if (ret < 0) { +// perror("Failed to write event"); +// close(fd); +// return 1; +// } + +// memset(&event, 0, sizeof(event)); +// event.type = EV_SYN; +// event.code = SYN_REPORT; +// event.value = 0; +// gettimeofday(&event.time, NULL); + +// ret = write(fd, &event, sizeof(event)); +// if (ret < 0) { +// perror("Failed to write sync event"); +// close(fd); +// return 1; +// } + +// close(fd); +// return 0; +// } |