Skip to content

Commit

Permalink
evdev_gun: "fix" BSD
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Nov 30, 2022
1 parent c09991e commit 337ee77
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rpcs3/Input/evdev_gun_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
#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>
#include <unistd.h>
Expand Down Expand Up @@ -92,9 +95,11 @@ 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 @@ -197,10 +202,11 @@ bool evdev_gun_handler::init()
if (m_is_init)
return true;

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

m_devices.clear();

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

m_udev = udev_new();
if (m_udev == nullptr)
{
Expand Down Expand Up @@ -311,6 +317,7 @@ 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 337ee77

Please sign in to comment.