diff --git a/Makefile.common b/Makefile.common
index 3acb730674..d9215cc182 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -708,7 +708,6 @@ ifeq ($(HAVE_UDEV), 1)
DEFINES += $(UDEV_CFLAGS)
LIBS += $(UDEV_LIBS)
OBJ += input/drivers/udev_input.o \
- input/common/udev_common.o \
input/drivers_joypad/udev_joypad.o
endif
diff --git a/griffin/griffin.c b/griffin/griffin.c
index f3937e7d15..26269fbd18 100644
--- a/griffin/griffin.c
+++ b/griffin/griffin.c
@@ -495,7 +495,6 @@ INPUT
#endif
#ifdef HAVE_UDEV
-#include "../input/common/udev_common.c"
#include "../input/drivers/udev_input.c"
#include "../input/drivers_joypad/udev_joypad.c"
#endif
diff --git a/input/common/udev_common.c b/input/common/udev_common.c
deleted file mode 100644
index 0ef22244c4..0000000000
--- a/input/common/udev_common.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2017 - Daniel De Matteis
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#include
-
-#include
-
-#include
-
-#include "udev_common.h"
-
-bool udev_hotplug_available(void *dev)
-{
- struct pollfd fds;
-
- fds.fd = udev_monitor_get_fd((struct udev_monitor*)dev);
- fds.events = POLLIN;
- fds.revents = 0;
-
- return (poll(&fds, 1, 0) == 1) && (fds.revents & POLLIN);
-}
diff --git a/input/common/udev_common.h b/input/common/udev_common.h
deleted file mode 100644
index 33cdec1b27..0000000000
--- a/input/common/udev_common.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2011-2017 - Daniel De Matteis
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#ifndef _UDEV_COMMON_H
-#define _UDEV_COMMON_H
-
-#include
-
-bool udev_hotplug_available(void *dev);
-
-#endif
diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c
index ba04a12488..e2ef48c8af 100644
--- a/input/drivers/udev_input.c
+++ b/input/drivers/udev_input.c
@@ -26,6 +26,7 @@
#include
#include
+#include
#include
#include
@@ -52,7 +53,6 @@
#include "../../gfx/video_driver.h"
#include "../common/linux_common.h"
-#include "../common/udev_common.h"
#include "../common/epoll_common.h"
#include "../../verbosity.h"
@@ -455,8 +455,10 @@ static void udev_input_get_pointer_position(int *x, int *y)
static void udev_input_poll(void *data)
{
int i, ret;
+ struct pollfd fds;
struct epoll_event events[32];
udev_input_mouse_t *mouse = NULL;
+ bool hotplug_avail = false;
int x = 0;
int y = 0;
udev_input_t *udev = (udev_input_t*)data;
@@ -482,7 +484,12 @@ static void udev_input_poll(void *data)
}
}
- while (udev->monitor && udev_hotplug_available(udev->monitor))
+ fds.fd = udev_monitor_get_fd(udev->monitor);
+ fds.events = POLLIN;
+ fds.revents = 0;
+ hotplug_avail = (poll(&fds, 1, 0) == 1) && (fds.revents & POLLIN);
+
+ while (udev->monitor && hotplug_avail)
udev_input_handle_hotplug(udev);
ret = epoll_waiting(&udev->epfd, events, ARRAY_SIZE(events), 0);
diff --git a/input/drivers/wayland_input.c b/input/drivers/wayland_input.c
index cfc0958de5..f774063a6c 100644
--- a/input/drivers/wayland_input.c
+++ b/input/drivers/wayland_input.c
@@ -44,7 +44,6 @@
#include "../../gfx/video_driver.h"
#include "../common/linux_common.h"
-#include "../common/udev_common.h"
#include "../common/epoll_common.h"
#include "../../gfx/common/wayland_common.h"
diff --git a/input/drivers_joypad/udev_joypad.c b/input/drivers_joypad/udev_joypad.c
index 69bb159267..0ec14421ee 100644
--- a/input/drivers_joypad/udev_joypad.c
+++ b/input/drivers_joypad/udev_joypad.c
@@ -23,6 +23,7 @@
#include
#include
+#include
#include
#include
#include
@@ -36,8 +37,6 @@
#include "../../tasks/tasks_internal.h"
-#include "../common/udev_common.h"
-
#include "../../verbosity.h"
/* Udev/evdev Linux joypad driver.
@@ -423,8 +422,15 @@ static bool udev_set_rumble(unsigned i,
static void udev_joypad_poll(void)
{
unsigned p;
+ struct pollfd fds;
+ bool hotplug_avail = false;
- while (udev_joypad_mon && udev_hotplug_available(udev_joypad_mon))
+ fds.fd = udev_monitor_get_fd(udev_joypad_mon);
+ fds.events = POLLIN;
+ fds.revents = 0;
+ hotplug_avail = (poll(&fds, 1, 0) == 1) && (fds.revents & POLLIN);
+
+ while (udev_joypad_mon && hotplug_avail)
{
struct udev_device *dev = udev_monitor_receive_device(udev_joypad_mon);