Read and discard bytes from Asus MCU
This commit is contained in:
parent
bc8911e180
commit
a9eb18319d
2 changed files with 10 additions and 1 deletions
|
|
@ -82,7 +82,7 @@ int dev_hidraw_open(
|
||||||
//printf("Testing for device %s\n", path);
|
//printf("Testing for device %s\n", path);
|
||||||
|
|
||||||
// try to open the device, if it cannot be opened to go the next
|
// 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) {
|
if (fd < 0) {
|
||||||
//fprintf(stderr, "Cannot open %s, device skipped.\n", path);
|
//fprintf(stderr, "Cannot open %s, device skipped.\n", path);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue