mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 18:40:09 +00:00
Get rid of udev_common.c
This commit is contained in:
parent
b633b8ad2d
commit
eb08a86647
@ -708,7 +708,6 @@ ifeq ($(HAVE_UDEV), 1)
|
|||||||
DEFINES += $(UDEV_CFLAGS)
|
DEFINES += $(UDEV_CFLAGS)
|
||||||
LIBS += $(UDEV_LIBS)
|
LIBS += $(UDEV_LIBS)
|
||||||
OBJ += input/drivers/udev_input.o \
|
OBJ += input/drivers/udev_input.o \
|
||||||
input/common/udev_common.o \
|
|
||||||
input/drivers_joypad/udev_joypad.o
|
input/drivers_joypad/udev_joypad.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -495,7 +495,6 @@ INPUT
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UDEV
|
#ifdef HAVE_UDEV
|
||||||
#include "../input/common/udev_common.c"
|
|
||||||
#include "../input/drivers/udev_input.c"
|
#include "../input/drivers/udev_input.c"
|
||||||
#include "../input/drivers_joypad/udev_joypad.c"
|
#include "../input/drivers_joypad/udev_joypad.c"
|
||||||
#endif
|
#endif
|
||||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <libudev.h>
|
|
||||||
|
|
||||||
#include <sys/poll.h>
|
|
||||||
|
|
||||||
#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);
|
|
||||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _UDEV_COMMON_H
|
|
||||||
#define _UDEV_COMMON_H
|
|
||||||
|
|
||||||
#include <boolean.h>
|
|
||||||
|
|
||||||
bool udev_hotplug_available(void *dev);
|
|
||||||
|
|
||||||
#endif
|
|
@ -26,6 +26,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
|
|
||||||
#include <libudev.h>
|
#include <libudev.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
@ -52,7 +53,6 @@
|
|||||||
|
|
||||||
#include "../../gfx/video_driver.h"
|
#include "../../gfx/video_driver.h"
|
||||||
#include "../common/linux_common.h"
|
#include "../common/linux_common.h"
|
||||||
#include "../common/udev_common.h"
|
|
||||||
#include "../common/epoll_common.h"
|
#include "../common/epoll_common.h"
|
||||||
|
|
||||||
#include "../../verbosity.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)
|
static void udev_input_poll(void *data)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
struct pollfd fds;
|
||||||
struct epoll_event events[32];
|
struct epoll_event events[32];
|
||||||
udev_input_mouse_t *mouse = NULL;
|
udev_input_mouse_t *mouse = NULL;
|
||||||
|
bool hotplug_avail = false;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
udev_input_t *udev = (udev_input_t*)data;
|
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);
|
udev_input_handle_hotplug(udev);
|
||||||
|
|
||||||
ret = epoll_waiting(&udev->epfd, events, ARRAY_SIZE(events), 0);
|
ret = epoll_waiting(&udev->epfd, events, ARRAY_SIZE(events), 0);
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
|
|
||||||
#include "../../gfx/video_driver.h"
|
#include "../../gfx/video_driver.h"
|
||||||
#include "../common/linux_common.h"
|
#include "../common/linux_common.h"
|
||||||
#include "../common/udev_common.h"
|
|
||||||
#include "../common/epoll_common.h"
|
#include "../common/epoll_common.h"
|
||||||
|
|
||||||
#include "../../gfx/common/wayland_common.h"
|
#include "../../gfx/common/wayland_common.h"
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
#include <libudev.h>
|
#include <libudev.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
@ -36,8 +37,6 @@
|
|||||||
|
|
||||||
#include "../../tasks/tasks_internal.h"
|
#include "../../tasks/tasks_internal.h"
|
||||||
|
|
||||||
#include "../common/udev_common.h"
|
|
||||||
|
|
||||||
#include "../../verbosity.h"
|
#include "../../verbosity.h"
|
||||||
|
|
||||||
/* Udev/evdev Linux joypad driver.
|
/* Udev/evdev Linux joypad driver.
|
||||||
@ -423,8 +422,15 @@ static bool udev_set_rumble(unsigned i,
|
|||||||
static void udev_joypad_poll(void)
|
static void udev_joypad_poll(void)
|
||||||
{
|
{
|
||||||
unsigned p;
|
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);
|
struct udev_device *dev = udev_monitor_receive_device(udev_joypad_mon);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user