From: Michal Sojka Date: Mon, 6 Aug 2018 11:55:27 +0000 (+0200) Subject: Allow using different input event source X-Git-Url: https://rtime.felk.cvut.cz/gitweb/coffee/mt-apps.git/commitdiff_plain/4d4c49a152a98299af9ea5215a6bd03285dbbb7d Allow using different input event source Useful for testing on different hardware (e.g. my laptop). --- diff --git a/mt_keys.c b/mt_keys.c index a209340..5d4145e 100644 --- a/mt_keys.c +++ b/mt_keys.c @@ -100,9 +100,14 @@ static void keys_cb(EV_P_ ev_io *w_, int revents) int mt_keys_init(mt_keys_t *self, struct ev_loop *loop, int fd) { - int ev = open("/dev/input/by-path/platform-gpio-keys-event", O_RDONLY); + char *dev = getenv("INPUT"); + + if (!dev) + dev = "/dev/input/by-path/platform-gpio-keys-event"; + + int ev = open(dev, O_RDONLY); if (ev == -1) { - perror("/dev/input/by-path/platform-gpio-keys-event"); + perror(dev); return -1; }