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:
Léo Lam
2016-07-14 17:50:35 +02:00
parent 3926db624d
commit 135641404a
3 changed files with 152 additions and 17 deletions

View File

@ -8,11 +8,14 @@
#include <string>
#include <vector>
#include "InputCommon/ControllerInterface/ControllerInterface.h"
namespace ciface
{
namespace evdev
{
void Init();
void Shutdown();
class evdevDevice : public Core::Device
{
@ -62,6 +65,7 @@ private:
public:
void UpdateInput() override;
bool IsValid() const override;
evdevDevice(const std::string& devnode);
~evdevDevice();