From 9aa119e6765568103f5a41b401b305dff509e13a Mon Sep 17 00:00:00 2001 From: Mikhail Burakov Date: Tue, 17 Oct 2023 10:33:24 +0200 Subject: Allow disabling uhid interop from the commandline --- input.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 7b35442..e47f363 100644 --- a/input.c +++ b/input.c @@ -36,7 +36,7 @@ struct InputHandler { int uhid_fd; }; -struct InputHandler* InputHandlerCreate(void) { +struct InputHandler* InputHandlerCreate(bool disable_uhid) { struct InputHandler* input_handler = malloc(sizeof(struct InputHandler)); if (!input_handler) { LOG("Failed to allocate input handler (%s)", strerror(errno)); @@ -47,7 +47,8 @@ struct InputHandler* InputHandlerCreate(void) { }; BufferCreate(&input_handler->buffer); - input_handler->uhid_fd = open("/dev/uhid", O_RDWR); + input_handler->uhid_fd = + open(disable_uhid ? "/dev/null" : "/dev/uhid", O_RDWR); if (input_handler->uhid_fd == -1) { LOG("Failed to open uhid device (%s)", strerror(errno)); goto rollback_input_handler; -- cgit v1.2.3