ControllerInterface: Remove and re-add device when combining nodes.

This commit is contained in:
Jordan Woyak 2019-11-17 09:33:26 -06:00
parent aabe8d2ccd
commit e2d5c92c76
1 changed files with 7 additions and 2 deletions

View File

@ -251,8 +251,13 @@ void AddDeviceNode(const char* devnode)
evdev_device->AddNode(devnode, fd, dev);
// Callbacks must be invoked as the device name and available inputs may change.
g_controller_interface.InvokeDevicesChangedCallbacks();
// Remove and re-add device as naming and inputs may have changed.
// This will also give it the correct index and invoke device change callbacks.
g_controller_interface.RemoveDevice([&evdev_device](const auto* device) {
return static_cast<const evdevDevice*>(device) == evdev_device.get();
});
g_controller_interface.AddDevice(evdev_device);
}
else
{