Files
my_device_handler/main.c

64 lines
1.2 KiB
C
Raw Normal View History

#include <stdio.h>
#include "my_device_handler.h"
#include <unistd.h>
int main( int argc, char **argv){
/* event[0|3] on RG552
event[4|5] on MSI
*/
const char *dev_A = "/dev/input/event4"; // 3
const char *dev_B = "/dev/input/event5"; // 0
device_handler_init();
/*
list_devices();
*/
printf("starting application\n");
device_handler_add( dev_A);
printf("added one of the two devices\n");
device_handler_add( dev_B);
printf("added the two devices\n");
printf("extra 1\n");
device_handler_add( dev_A);
printf("extra 2\n");
device_handler_add( dev_A);
printf("extra 3\n");
device_handler_remove( dev_B);
printf("extra 4\n");
device_handler_remove( dev_A);
printf("extra 5\n");
device_handler_add( dev_B);
printf("extra 6\n");
device_handler_add( dev_B);
printf("extra 7\n");
device_handler_add( dev_A);
printf("repeated device add\n");
/*
list_devices();
*/
while( 1){
device_event *events, current;
int count = device_handler_poll_events( &events);
int i;
for( i = 0; i < count; i++){
current = events[i];
printf("%d %d %d\n", current.type, current.code, current.value);
}
device_handler_destroy_events( events);
}
return 0;
}