aboutsummaryrefslogtreecommitdiffstats
path: root/lsinput.c
blob: b500d0300cebb7dc1db9e6cf1f0ff48138671784 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

#include "input.h"

/* ------------------------------------------------------------------ */

static void list_devices(void)
{
	int i,fd;
        char filename[32];
        struct stat statbuf;

	for (i = 0; i < 32; i++) {
                snprintf(filename,sizeof(filename), "/dev/input/event%d",i);
                if (stat(filename, &statbuf) == 0) {
                        /* try to open */
                        fd = device_open(i,1);
                        if (-1 == fd)
                                return;
                        device_info(fd);
                        close(fd);
                }
	}
	return;
}

int main(int argc, char *argv[])
{
	list_devices();
	exit(0);
}

/* ---------------------------------------------------------------------
 * Local variables:
 * c-basic-offset: 8
 * End:
 */