| * Copyright 2023 Google LLC |
| * SPDX-License-Identifier: Apache-2.0 |
| #include "linux_evdev_bottom.h" |
| int linux_evdev_read(int fd, uint16_t *type, uint16_t *code, int32_t *value) |
| ret = read(fd, &ev, sizeof(ev)); |
| if (errno == EAGAIN || errno == EINTR) { |
| return NATIVE_LINUX_EVDEV_NO_DATA; |
| nsi_print_warning("Read error: %s", strerror(errno)); |
| } else if (ret < sizeof(ev)) { |
| nsi_print_warning("Unexpected read size: %d, expecting %d", |
| int linux_evdev_open(const char *path) |
| fd = open(path, O_RDONLY | O_NONBLOCK); |
| nsi_print_error_and_exit( |
| "Failed to open the evdev device %s: %s\n", |