|
|
@ -51,6 +51,7 @@ const char evdev_root_dir[] = "/dev/input/"; |
|
|
|
|
|
|
|
|
|
|
|
int key_buffer_add (struct key_buffer*, unsigned short); |
|
|
|
int key_buffer_add (struct key_buffer*, unsigned short); |
|
|
|
int key_buffer_remove (struct key_buffer*, unsigned short); |
|
|
|
int key_buffer_remove (struct key_buffer*, unsigned short); |
|
|
|
|
|
|
|
int convert_key_value (unsigned short); |
|
|
|
void int_handler (int signum); |
|
|
|
void int_handler (int signum); |
|
|
|
void die (const char *, int); |
|
|
|
void die (const char *, int); |
|
|
|
void exec_command(const char *); |
|
|
|
void exec_command(const char *); |
|
|
@ -154,10 +155,17 @@ int main (void) |
|
|
|
for (unsigned int i = 0; i < pb.size; i++) |
|
|
|
for (unsigned int i = 0; i < pb.size; i++) |
|
|
|
printf("%d ", pb.buf[i]); |
|
|
|
printf("%d ", pb.buf[i]); |
|
|
|
putchar('\n'); |
|
|
|
putchar('\n'); |
|
|
|
if (pb.size == 2) |
|
|
|
switch (pb.size) { |
|
|
|
|
|
|
|
case 1: |
|
|
|
|
|
|
|
/* You can use keys defined in input.h */ |
|
|
|
|
|
|
|
if (pb.buf[0] == KEY_MUTE) |
|
|
|
|
|
|
|
exec_command("/home/ale/hello"); |
|
|
|
|
|
|
|
case 2: |
|
|
|
if (pb.buf[0] == 56 || pb.buf[0] == 31) |
|
|
|
if (pb.buf[0] == 56 || pb.buf[0] == 31) |
|
|
|
if (pb.buf[1] == 31 || pb.buf[1] == 56) |
|
|
|
if (pb.buf[1] == 31 || pb.buf[1] == 56) |
|
|
|
exec_command("/home/ale/hello"); |
|
|
|
exec_command("/home/ale/hello"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -318,3 +326,9 @@ void update_descriptors_list (struct pollfd **fds, int *fd_num) |
|
|
|
fprintf(stderr,ANSI_COLOR_YELLOW "Monitoring %d devices\n" ANSI_COLOR_RESET, (*fd_num)); |
|
|
|
fprintf(stderr,ANSI_COLOR_YELLOW "Monitoring %d devices\n" ANSI_COLOR_RESET, (*fd_num)); |
|
|
|
closedir(ev_dir); |
|
|
|
closedir(ev_dir); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int convert_key_value (unsigned short key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int outchar = 0; |
|
|
|
|
|
|
|
return outchar; |
|
|
|
|
|
|
|
} |
|
|
|