Skip to content

Commit

Permalink
evdev_gun: enable udev code on BSDs
Browse files Browse the repository at this point in the history
libudev is supported on DragonFly and FreeBSD, similar to libevdev.
NetBSD and OpenBSD can simply disable both via -DUSE_LIBEVDEV=OFF.

This reverts commit 337ee77.
  • Loading branch information
jbeich authored and AniLeo committed Jan 28, 2023
1 parent 8b453e6 commit a748508
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/CMakeLists.txt
Expand Up @@ -142,7 +142,7 @@ add_subdirectory(SoundTouch EXCLUDE_FROM_ALL)
# libevdev
set(LIBEVDEV_TARGET 3rdparty_dummy_lib)
if(USE_LIBEVDEV)
pkg_check_modules(LIBEVDEV libevdev)
pkg_check_modules(LIBEVDEV libevdev libudev)
if(LIBEVDEV_FOUND)
add_library(3rdparty_libevdev INTERFACE)
target_compile_definitions(3rdparty_libevdev INTERFACE -DHAVE_LIBEVDEV)
Expand Down
6 changes: 0 additions & 6 deletions rpcs3/Input/evdev_gun_handler.cpp
Expand Up @@ -7,9 +7,7 @@
#include "evdev_gun_handler.h"
#include "util/logs.hpp"

#ifdef __linux__ // Too lazy to make this work for BSD
#include <libudev.h>
#endif

#include <libevdev/libevdev.h>
#include <fcntl.h>
Expand Down Expand Up @@ -95,11 +93,9 @@ evdev_gun_handler::~evdev_gun_handler()
close(fd);
}
}
#ifdef __linux__
if (m_udev != nullptr)
udev_unref(m_udev);
evdev_log.notice("Lightgun: Shutdown udev initialization");
#endif
}

int evdev_gun_handler::get_button(u32 gunno, gun_button button) const
Expand Down Expand Up @@ -204,7 +200,6 @@ bool evdev_gun_handler::init()

m_devices.clear();

#ifdef __linux__
evdev_log.notice("Lightgun: Begin udev initialization");

m_udev = udev_new();
Expand Down Expand Up @@ -317,7 +312,6 @@ bool evdev_gun_handler::init()
{
evdev_log.error("Lightgun: Failed udev enumeration");
}
#endif

m_is_init = true;
return true;
Expand Down

0 comments on commit a748508

Please sign in to comment.