mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-08 04:02:40 +00:00
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).
This commit is contained in:
parent
3926db624d
commit
135641404a
3 changed files with 152 additions and 17 deletions
Source/Core/InputCommon/ControllerInterface
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue