From a9eb18319d50b41f5ab5df6c27ed374b97b3b060 Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 18 Dec 2023 00:39:49 +0100 Subject: [PATCH] Read and discard bytes from Asus MCU --- dev_hidraw.c | 2 +- rog_ally.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dev_hidraw.c b/dev_hidraw.c index bb8d1c9..4f04f04 100644 --- a/dev_hidraw.c +++ b/dev_hidraw.c @@ -82,7 +82,7 @@ int dev_hidraw_open( //printf("Testing for device %s\n", path); // try to open the device, if it cannot be opened to go the next - int fd = open(path, O_RDWR); + int fd = open(path, O_RDWR | O_NONBLOCK); if (fd < 0) { //fprintf(stderr, "Cannot open %s, device skipped.\n", path); continue; diff --git a/rog_ally.c b/rog_ally.c index 278cbef..7d2c3ec 100644 --- a/rog_ally.c +++ b/rog_ally.c @@ -926,6 +926,15 @@ static input_dev_t in_xbox_dev = { }; static int rc71l_hidraw_map(const dev_in_settings_t *const conf, int hidraw_fd, in_message_t *const messages, size_t messages_len, void* user_data) { + uint8_t data[256]; + const int read_res = read(hidraw_fd, data, sizeof(data)); + + if (read_res < 0) { + return -EIO; + } else { + printf("Got %d bytes from Asus MCU\n", read_res); + } + return 0; }