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

View File

@ -21,7 +21,7 @@
<inttypes.h>
"henglong.h"
1389038648 source:/home/stefan/Proj/UDPclient/henglong.c
1389212471 source:/home/stefan/Proj/UDPclient/henglong.c
"henglong.h"
1389038543 /home/stefan/Proj/UDPclient/henglong.h

Binary file not shown.

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;
}

Binary file not shown.