From: Sung-Jin Park Date: Tue, 9 Nov 2021 03:30:35 +0000 (+0900) Subject: pepper-evdev: correct to no longer read if an error occurs in fd X-Git-Tag: submit/tizen/20210606.040058~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28125ba03896afc55bfec3efaf545ef5ffe58c3c;p=platform%2Fcore%2Fuifw%2Fpepper.git pepper-evdev: correct to no longer read if an error occurs in fd Change-Id: Iabba3ac2d94e3a632be58cc2f06b06760c3e5013 Signed-off-by: Sung-Jin Park --- diff --git a/src/lib/evdev/evdev.c b/src/lib/evdev/evdev.c index a348ff9..968ea78 100644 --- a/src/lib/evdev/evdev.c +++ b/src/lib/evdev/evdev.c @@ -126,10 +126,17 @@ _evdev_keyboard_event_fd_read(int fd, uint32_t mask, void *data) struct input_event ev[EVENT_MAX]; evdev_device_info_t *device_info = (evdev_device_info_t *)data; - PEPPER_CHECK(!(mask & (WL_EVENT_HANGUP | WL_EVENT_ERROR)), - return 0, - "[%s] With the given fd, there is an error or it's been hung-up.\n", - __FUNCTION__); + if ((mask & WL_EVENT_HANGUP) || (mask & WL_EVENT_ERROR)) + { + PEPPER_ERROR("With the given fd(%d, mask:0x%x), there is an error or it's been hung-up. (errno:%m)\n", fd, mask); + PEPPER_ERROR("The event source will be disabled and the fd(%d) will be closed.\n", device_info->fd); + + if (device_info->event_source) + wl_event_source_fd_update(device_info->event_source, (uint32_t)0); + + close(fd); + return 0; + } if (!(mask & WL_EVENT_READABLE)) return 0;