From fa64ad0cc74abfd00e6ad9c039796573d3624bb1 Mon Sep 17 00:00:00 2001 From: Oxore Date: Mon, 7 Mar 2022 02:09:26 +0300 Subject: Fix printfs, remove printf --- main.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/main.c b/main.c index 6e41323..d3623ff 100644 --- a/main.c +++ b/main.c @@ -250,7 +250,7 @@ static enum side which_side_state(struct state state) { } static struct state keypress(struct state state, struct input_event ev, int ofd) { - printf("<- EV_KEY, code=%u, value=%d\n", ev.code, ev.value); + printf("<- %s, code=%u, value=%d\n", ev.type == EV_KEY ? "EV_KEY" : "EV_ABS", ev.code, ev.value); if (which_side_state(state) == SIDE_NO) { const enum side side = which_side_key(ev); printf("first = %s\n", side == SIDE_LEFT ? "left" : side == SIDE_RIGHT ? "right" : "no"); @@ -360,7 +360,7 @@ static struct state keypress(struct state state, struct input_event ev, int ofd) } static struct state keyrelease(struct state state, struct input_event ev, int ofd) { - printf("<- EV_KEY, code=%u, value=%d\n", ev.code, ev.value); + printf("<- %s, code=%u, value=%d\n", ev.type == EV_KEY ? "EV_KEY" : "EV_ABS", ev.code, ev.value); if (state.keys & KMASK_PRESSED) { for (ssize_t i = 0; i < MAPPINGS_NUM; i++) { struct mapping mapping = g_mapping[i]; @@ -474,15 +474,6 @@ int main(int argc, char *argv[]) setup_output_device(ofd); - /* - * On UI_DEV_CREATE the kernel will create the device node for this - * device. We are inserting a pause here so that userspace has time - * to detect, initialize the new device, and can start listening to - * the event, otherwise it will not notice the event we are about - * to send. This pause is only needed in our example code! - */ - sleep(1); - struct state state = {0}; int8_t abs_previous[ABS_CNT] = {0}; -- cgit v1.2.3