blob: ea58ae4dcec4271169f8ca4fe98f149f93629abb [file] [log] [blame]
Julius Werneraa279292019-07-18 19:33:16 -07001/*
2 * Copyright 2019 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7#include "dev.h"
8#include "input.h"
9#include "util.h"
10
11/*
12 * We believe that there's a limit of 32 /dev/input/eventX devices in the
13 * kernel. It's not quite clear. Anyway, we should probably never have more than
14 * that in practice on Chrome OS anyway, so our algorithm is to check for the
15 * first 32 nodes explicitly, then keep checking for any further ones until we
16 * find an entry missing. (This is way simpler than using actual POSIX globbing
17 * or directory entry APIs.)
18 */
19#define EVDEV_MAX 32
20
21int dev_init(void)
22{
23 char path[64];
24 int i;
25
26 for (i = 0;; i++) {
27 snprintf(path, sizeof(path), "/dev/input/event%d", i);
28 if (access(path, F_OK)) {
29 if (i >= EVDEV_MAX)
30 break;
31 else
32 continue;
33 }
34 input_add(path);
35 }
36
37 return 0;
38}
39
40void dev_close(void)
41{
42}
43
44void dev_add_fds(fd_set* read_set, fd_set* exception_set, int *maxfd)
45{
46}
47
48void dev_dispatch_io(fd_set* read_set, fd_set* exception_set)
49{
50}