Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / shdmp.C
1 /*
2  * CINELERRA
3  * Copyright (C) 2016-2020 William Morrow
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published
7  * by the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA
19  */
20
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <unistd.h>
24 #include <fcntl.h>
25 #include <error.h>
26 #include <signal.h>
27 #include <linux/input.h>
28
29 input_event ev;
30
31 int main(int ac, char **av)
32 {
33         setbuf(stdout, 0);
34         if( ac < 2 ) { printf("usage: %s /dev/input/by-id/<device?>\n", av[0]); exit(1); }
35         int fd = open(av[1], O_RDONLY);
36         if( !fd ) { perror(av[1]); exit(1); }
37
38         for(;;) {
39                 int ret = read(fd, &ev, sizeof(ev));
40                 if( ret != sizeof(ev) ) {
41                         if( ret < 0 ) perror("read event");
42                         printf("bad read: %d\n", ret);
43                         break;
44                 }
45                 printf("event: (%d, %d, 0x%x)\n", ev.type, ev.code, ev.value);
46         }
47
48         return 0;
49 }
50