(udev_input.c) use udev_common.c

This commit is contained in:
twinaphex 2016-12-01 16:51:43 +01:00
parent ebe1ac6967
commit 200be98052

View File

@ -42,6 +42,7 @@
#include "../drivers_keyboard/keyboard_event_udev.h"
#include "../common/linux_common.h"
#include "../common/udev_common.h"
#include "../common/epoll_common.h"
#include "../input_config.h"
#include "../input_joypad_driver.h"
@ -234,7 +235,6 @@ static bool add_device(udev_input_t *udev,
udev_input_device_t **tmp;
udev_input_device_t *device = NULL;
struct stat st = {0};
struct epoll_event event = {0};
if (stat(devnode, &st) < 0)
return false;
@ -268,13 +268,7 @@ static bool add_device(udev_input_t *udev,
tmp[udev->num_devices++] = device;
udev->devices = tmp;
event.events = EPOLLIN;
event.data.ptr = device;
/* Shouldn't happen, but just check it. */
if (epoll_ctl(udev->epfd, EPOLL_CTL_ADD, fd, &event) < 0)
RARCH_ERR("Failed to add FD (%d) to epoll list (%s).\n",
fd, strerror(errno));
epoll_add(&udev->epfd, fd, device);
return true;
@ -373,7 +367,7 @@ static void udev_input_poll(void *data)
while (udev->monitor && udev_hotplug_available(udev->monitor))
udev_input_handle_hotplug(udev);
ret = epoll_wait(udev->epfd, events, ARRAY_SIZE(events), 0);
ret = epoll_waiting(&udev->epfd, events, ARRAY_SIZE(events), 0);
for (i = 0; i < ret; i++)
{
@ -552,8 +546,7 @@ static void udev_input_free(void *data)
if (udev->joypad)
udev->joypad->destroy();
if (udev->epfd >= 0)
close(udev->epfd);
epoll_free(&udev->epfd);
for (i = 0; i < udev->num_devices; i++)
{
@ -638,8 +631,7 @@ static void *udev_input_init(void)
goto error;
#endif
udev->epfd = epoll_create(32);
if (udev->epfd < 0)
if (!epoll_new(&udev->epfd))
{
RARCH_ERR("Failed to create epoll FD.\n");
goto error;