Read and discard bytes from Asus MCU

This commit is contained in:
Denis 2023-12-18 00:39:49 +01:00
parent bc8911e180
commit a9eb18319d
No known key found for this signature in database
GPG key ID: DD9B63F805CF5C03
2 changed files with 10 additions and 1 deletions

View file

@ -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;

View file

@ -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;
}