From beb84940cf26eebcdaf21cb9ec81df485701e65f Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 16 Aug 2017 07:24:46 -0400 Subject: [PATCH] Improve no device detection support --- backend/libinput/backend.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 7dc1cc01..28947a5e 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -64,10 +64,17 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) { libinput_log_set_priority(backend->libinput_context, LIBINPUT_LOG_PRIORITY_ERROR); int libinput_fd = libinput_get_fd(backend->libinput_context); - if (backend->wlr_device_lists->length == 0) { + char *no_devs = getenv("WLR_LIBINPUT_NO_DEVICES"); + if (no_devs) { + if (strcmp(no_devs, "1") != 0) { + no_devs = NULL; + } + } + if (!no_devs && backend->wlr_device_lists->length == 0) { wlr_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend); if (backend->wlr_device_lists->length == 0) { - wlr_log(L_ERROR, "No input device found, failing initialization"); + wlr_log(L_ERROR, "libinput initialization failed, no input devices"); + wlr_log(L_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check"); return false; } }