line savings
This commit is contained in:
parent
9c89e52692
commit
5acaa2b7df
10
hkd.c
10
hkd.c
@ -59,12 +59,6 @@ int main (void)
|
|||||||
int *fds = NULL;
|
int *fds = NULL;
|
||||||
update_descriptors_list(&fds, &fd_num);
|
update_descriptors_list(&fds, &fd_num);
|
||||||
|
|
||||||
// TODO: watch for events inside /dev/input and reload accordingly
|
|
||||||
// could use the epoll syscall or the inotify API (linux),
|
|
||||||
// event API (openbsd), kqueue syscall (BSD and macos), a separate
|
|
||||||
// process or some polling system inside the main loop to maintain
|
|
||||||
// portability across other *NIX derivatives, could also use libev
|
|
||||||
|
|
||||||
int event_watcher = inotify_init1(IN_NONBLOCK);
|
int event_watcher = inotify_init1(IN_NONBLOCK);
|
||||||
if (event_watcher < 0)
|
if (event_watcher < 0)
|
||||||
die("could not call inotify_init");
|
die("could not call inotify_init");
|
||||||
@ -98,12 +92,10 @@ int main (void)
|
|||||||
goto mainloop_begin;
|
goto mainloop_begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int i;
|
|
||||||
static unsigned int prev_size;
|
static unsigned int prev_size;
|
||||||
|
|
||||||
prev_size = pb.size;
|
prev_size = pb.size;
|
||||||
if (ev_type.events == EPOLLIN) {
|
if (ev_type.events == EPOLLIN) {
|
||||||
for (i = 0; i < fd_num; i++) {
|
for (int i = 0; i < fd_num; i++) {
|
||||||
|
|
||||||
rb = read(fds[i], &event, sizeof(struct input_event));
|
rb = read(fds[i], &event, sizeof(struct input_event));
|
||||||
if (rb != sizeof(struct input_event)) continue;
|
if (rb != sizeof(struct input_event)) continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user