better key event handling
This commit is contained in:
parent
73e5d76968
commit
8b88fac032
|
@ -21,7 +21,7 @@
|
||||||
<inttypes.h>
|
<inttypes.h>
|
||||||
"henglong.h"
|
"henglong.h"
|
||||||
|
|
||||||
1389038648 source:/home/stefan/Proj/UDPclient/henglong.c
|
1389212471 source:/home/stefan/Proj/UDPclient/henglong.c
|
||||||
"henglong.h"
|
"henglong.h"
|
||||||
|
|
||||||
1389038543 /home/stefan/Proj/UDPclient/henglong.h
|
1389038543 /home/stefan/Proj/UDPclient/henglong.h
|
||||||
|
|
Binary file not shown.
9
main.c
9
main.c
|
@ -32,7 +32,7 @@ void *input_thread_fcn(void * arg)
|
||||||
{
|
{
|
||||||
printf("pthread input started\n");
|
printf("pthread input started\n");
|
||||||
|
|
||||||
struct input_event ev[2];
|
struct input_event ev;
|
||||||
int fevdev;
|
int fevdev;
|
||||||
int size = sizeof(struct input_event);
|
int size = sizeof(struct input_event);
|
||||||
int rd;
|
int rd;
|
||||||
|
@ -47,12 +47,15 @@ void *input_thread_fcn(void * arg)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if ((rd = read(fevdev, ev, size * 2)) < size) {
|
if ((rd = read(fevdev, &ev, size)) < size) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(EV_KEY == ev.type) {
|
||||||
|
args->event = ev;
|
||||||
|
printf("%d %d\n", ev.code, ev.value);
|
||||||
|
|
||||||
args->event = ev[1];
|
}
|
||||||
// quit
|
// quit
|
||||||
if(16==args->event.code && 1==args->event.value) break;
|
if(16==args->event.code && 1==args->event.value) break;
|
||||||
}
|
}
|
||||||
|
|
BIN
obj/Debug/main.o
BIN
obj/Debug/main.o
Binary file not shown.
Loading…
Reference in New Issue