-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev_lite.c
50 lines (42 loc) · 1.05 KB
/
dev_lite.c
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
42
43
44
45
46
47
48
49
50
/*
* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "dev.h"
#include "input.h"
#include "util.h"
/*
* We believe that there's a limit of 32 /dev/input/eventX devices in the
* kernel. It's not quite clear. Anyway, we should probably never have more than
* that in practice on Chrome OS anyway, so our algorithm is to check for the
* first 32 nodes explicitly, then keep checking for any further ones until we
* find an entry missing. (This is way simpler than using actual POSIX globbing
* or directory entry APIs.)
*/
#define EVDEV_MAX 32
int dev_init(void)
{
char path[64];
int i;
for (i = 0;; i++) {
snprintf(path, sizeof(path), "/dev/input/event%d", i);
if (access(path, F_OK)) {
if (i >= EVDEV_MAX)
break;
else
continue;
}
input_add(path);
}
return 0;
}
void dev_close(void)
{
}
void dev_add_fds(fd_set* read_set, fd_set* exception_set, int *maxfd)
{
}
void dev_dispatch_io(fd_set* read_set, fd_set* exception_set)
{
}