diff options
| author | Michael Maltese <michaeljosephmaltese@gmail.com> | 2016-10-16 13:39:05 -0700 |
|---|---|---|
| committer | Michael Maltese <michaeljosephmaltese@gmail.com> | 2016-11-30 16:07:55 -0800 |
| commit | 3e69d066f5e9ad0a1097d806c656035398bbb7bc (patch) | |
| tree | dd7ab461e209f81876a2b2145a5595812512eb6c /Source/Core/InputCommon/ControllerInterface/evdev | |
| parent | cebb4d84f2a8021a5df2ff2a9d31eba16e1cb5e5 (diff) | |
ControllerInterface: replace Reinitialize with RefreshDevices
The SDL backend crashes when you close a joystick after SDL_Quit has
been called. Some backends don't need to be shutdown and
re-initialized everytime, we can just ask to enumerate devices again.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/evdev')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp | 13 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/evdev/evdev.h | 1 |
2 files changed, 9 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp index d3f8f5fd36..bee0c44a02 100644 --- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp +++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp @@ -141,10 +141,15 @@ static void StopHotplugThread() void Init() { s_devnode_name_map.clear(); + PopulateDevices(); + StartHotplugThread(); +} - // During initialization we use udev to iterate over all /dev/input/event* devices. - // Note: the Linux kernel is currently limited to just 32 event devices. If this ever - // changes, hopefully udev will take care of this. +void PopulateDevices() +{ + // We use udev to iterate over all /dev/input/event* devices. + // Note: the Linux kernel is currently limited to just 32 event devices. If + // this ever changes, hopefully udev will take care of this. udev* udev = udev_new(); _assert_msg_(PAD, udev != nullptr, "Couldn't initialize libudev."); @@ -182,8 +187,6 @@ void Init() } udev_enumerate_unref(enumerate); udev_unref(udev); - - StartHotplugThread(); } void Shutdown() diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.h b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.h index dc8e917e23..513c5a67f2 100644 --- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.h +++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.h @@ -15,6 +15,7 @@ namespace ciface namespace evdev { void Init(); +void PopulateDevices(); void Shutdown(); class evdevDevice : public Core::Device |
