1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

evdev_gun: enable udev code on BSDs

libudev is supported on DragonFly and FreeBSD, similar to libevdev.
NetBSD and OpenBSD can simply disable both via -DUSE_LIBEVDEV=OFF.

This reverts commit 337ee77a99.
This commit is contained in:
Jan Beich 2023-01-28 09:37:08 +00:00 committed by Ani
parent 8b453e6a3b
commit a748508bc9
2 changed files with 1 additions and 7 deletions

View File

@ -142,7 +142,7 @@ add_subdirectory(SoundTouch EXCLUDE_FROM_ALL)
# libevdev # libevdev
set(LIBEVDEV_TARGET 3rdparty_dummy_lib) set(LIBEVDEV_TARGET 3rdparty_dummy_lib)
if(USE_LIBEVDEV) if(USE_LIBEVDEV)
pkg_check_modules(LIBEVDEV libevdev) pkg_check_modules(LIBEVDEV libevdev libudev)
if(LIBEVDEV_FOUND) if(LIBEVDEV_FOUND)
add_library(3rdparty_libevdev INTERFACE) add_library(3rdparty_libevdev INTERFACE)
target_compile_definitions(3rdparty_libevdev INTERFACE -DHAVE_LIBEVDEV) target_compile_definitions(3rdparty_libevdev INTERFACE -DHAVE_LIBEVDEV)

View File

@ -7,9 +7,7 @@
#include "evdev_gun_handler.h" #include "evdev_gun_handler.h"
#include "util/logs.hpp" #include "util/logs.hpp"
#ifdef __linux__ // Too lazy to make this work for BSD
#include <libudev.h> #include <libudev.h>
#endif
#include <libevdev/libevdev.h> #include <libevdev/libevdev.h>
#include <fcntl.h> #include <fcntl.h>
@ -95,11 +93,9 @@ evdev_gun_handler::~evdev_gun_handler()
close(fd); close(fd);
} }
} }
#ifdef __linux__
if (m_udev != nullptr) if (m_udev != nullptr)
udev_unref(m_udev); udev_unref(m_udev);
evdev_log.notice("Lightgun: Shutdown udev initialization"); evdev_log.notice("Lightgun: Shutdown udev initialization");
#endif
} }
int evdev_gun_handler::get_button(u32 gunno, gun_button button) const int evdev_gun_handler::get_button(u32 gunno, gun_button button) const
@ -204,7 +200,6 @@ bool evdev_gun_handler::init()
m_devices.clear(); m_devices.clear();
#ifdef __linux__
evdev_log.notice("Lightgun: Begin udev initialization"); evdev_log.notice("Lightgun: Begin udev initialization");
m_udev = udev_new(); m_udev = udev_new();
@ -317,7 +312,6 @@ bool evdev_gun_handler::init()
{ {
evdev_log.error("Lightgun: Failed udev enumeration"); evdev_log.error("Lightgun: Failed udev enumeration");
} }
#endif
m_is_init = true; m_is_init = true;
return true; return true;