5
0
Fork 0
mirror of https://github.com/TheTesla/HengLongUDPclient.git synced 2025-06-29 03:46:08 +02:00

better key event handling

This commit is contained in:
Stefan Helmert 2014-01-08 22:54:24 +01:00
parent 73e5d76968
commit 8b88fac032
4 changed files with 7 additions and 4 deletions

9
main.c
View file

@ -32,7 +32,7 @@ void *input_thread_fcn(void * arg)
{
printf("pthread input started\n");
struct input_event ev[2];
struct input_event ev;
int fevdev;
int size = sizeof(struct input_event);
int rd;
@ -47,12 +47,15 @@ void *input_thread_fcn(void * arg)
while (1)
{
if ((rd = read(fevdev, ev, size * 2)) < size) {
if ((rd = read(fevdev, &ev, size)) < size) {
break;
}
if(EV_KEY == ev.type) {
args->event = ev;
printf("%d %d\n", ev.code, ev.value);
args->event = ev[1];
}
// quit
if(16==args->event.code && 1==args->event.value) break;
}