summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2023-10-17 10:33:24 +0200
committerMikhail Burakov <mburakov@mailbox.org>2023-10-17 10:33:24 +0200
commit9aa119e6765568103f5a41b401b305dff509e13a (patch)
treefdedde63346f64238c328cd814d8dfd6b372cc2f /input.c
parente9f288fd0912cde18cddd78eae030e0e877c228c (diff)
Allow disabling uhid interop from the commandline
Diffstat (limited to 'input.c')
-rw-r--r--input.c5
1 files changed, 3 insertions, 2 deletions
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;