Lines Matching refs:fd
48 android::base::unique_fd fd; member
68 static bool should_add_input_device(int fd, bool allow_touch_inputs) { in should_add_input_device() argument
73 if (ioctl(fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits) == -1) { in should_add_input_device()
88 static int inotify_cb(int fd, __unused uint32_t epevents) { in inotify_cb() argument
94 int ret = ioctl(fd, FIONREAD, &event_len_int); in inotify_cb()
106 ssize_t r = TEMP_FAILURE_RETRY(read(fd, buf.data(), event_len)); in inotify_cb()
168 android::base::unique_fd fd(openat(dirfd(dir.get()), de->d_name, O_RDONLY | O_CLOEXEC)); in ev_init() local
169 if (fd == -1) continue; in ev_init()
171 if (!should_add_input_device(fd, allow_touch_inputs)) { in ev_init()
178 if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ev) == -1) { in ev_init()
183 ev_fdinfo[g_ev_count].fd.reset(fd.release()); in ev_init()
207 int ev_add_fd(android::base::unique_fd&& fd, ev_callback cb) { in ev_add_fd() argument
215 int ret = epoll_ctl(g_epoll_fd, EPOLL_CTL_ADD, fd, &ev); in ev_add_fd()
217 ev_fdinfo[g_ev_count].fd.reset(fd.release()); in ev_add_fd()
228 ev_fdinfo[--g_ev_count].fd.reset(); in ev_exit()
249 cb(fdi->fd, g_polled_events[n].events); in ev_dispatch()
254 int ev_get_input(int fd, uint32_t epevents, input_event* ev) { in ev_get_input() argument
256 ssize_t r = TEMP_FAILURE_RETRY(read(fd, ev, sizeof(*ev))); in ev_get_input()
263 epoll_ctl(g_epoll_fd, EPOLL_CTL_DEL, fd, nullptr); in ev_get_input()
277 if (ioctl(ev_fdinfo[i].fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits) == -1) { in ev_sync_key_state()
283 if (ioctl(ev_fdinfo[i].fd, EVIOCGKEY(sizeof(key_bits)), key_bits) == -1) { in ev_sync_key_state()
307 if (ioctl(ev_fdinfo[i].fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits) == -1) { in ev_iterate_available_keys()
314 if (ioctl(ev_fdinfo[i].fd, EVIOCGBIT(EV_KEY, KEY_MAX), key_bits) == -1) { in ev_iterate_available_keys()
330 if (ioctl(ev_fdinfo[i].fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits) == -1) { in ev_iterate_touch_inputs()
338 if (ioctl(ev_fdinfo[i].fd, EVIOCGBIT(EV_ABS, KEY_MAX), key_bits) == -1) { in ev_iterate_touch_inputs()