diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2016-07-14 17:50:35 +0200 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2016-07-29 17:18:40 +0200 |
| commit | 135641404af9c52e433ef28dba4f86fa208f4365 (patch) | |
| tree | 8949772ef8e19ee33693426cf66ca94622993250 /Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp | |
| parent | 3926db624d5ab2f959e67eb2369f1fe5f0f9543a (diff) | |
evdev: Add hotplugging support
This adds hotplugging support to the evdev input backend. We use
libudev to monitor changes to input devices in a separate thread.
Removed devices are removed from the devices list, and new devices
are added to the list.
The effect is that controllers are usable immediately after plugging
them without having to manually refresh devices (if they were
configured to be used, of course).
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 9c7a08428e..f1e62e73cf 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -106,17 +106,6 @@ void ControllerInterface::Shutdown() if (!m_is_init) return; - std::lock_guard<std::mutex> lk(m_devices_mutex); - - for (const auto& d : m_devices) - { - // Set outputs to ZERO before destroying device - for (ciface::Core::Device::Output* o : d->Outputs()) - o->SetState(0); - } - - m_devices.clear(); - #ifdef CIFACE_USE_XINPUT ciface::XInput::DeInit(); #endif @@ -136,6 +125,20 @@ void ControllerInterface::Shutdown() #ifdef CIFACE_USE_ANDROID // nothing needed #endif +#ifdef CIFACE_USE_EVDEV + ciface::evdev::Shutdown(); +#endif + + std::lock_guard<std::mutex> lk(m_devices_mutex); + + for (const auto& d : m_devices) + { + // Set outputs to ZERO before destroying device + for (ciface::Core::Device::Output* o : d->Outputs()) + o->SetState(0); + } + + m_devices.clear(); m_is_init = false; } |
