diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2019-11-17 09:09:47 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2020-01-13 16:50:58 -0600 |
| commit | aabe8d2ccdd46c0366c968dfa9abd80f6c93dbbd (patch) | |
| tree | 0c6708d5189eb2170ac8240b7addd878c4a32083 /Source | |
| parent | ac907ef977a1dc2ae4a7acc1ca9f56f1ea21d9cf (diff) | |
ControllerInterface: Don't consider the empty string a valid unique ID.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp index 850fce24f7..3dfae58005 100644 --- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp +++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp @@ -243,9 +243,12 @@ void AddDeviceNode(const char* devnode) return; } - auto evdev_device = FindDeviceWithUniqueID(libevdev_get_uniq(dev)); + const auto uniq = libevdev_get_uniq(dev); + auto evdev_device = FindDeviceWithUniqueID(uniq); if (evdev_device) { + NOTICE_LOG(SERIALINTERFACE, "evdev combining devices with unique id: %s", uniq); + evdev_device->AddNode(devnode, fd, dev); // Callbacks must be invoked as the device name and available inputs may change. @@ -572,7 +575,13 @@ const char* evdevDevice::GetUniqueID() const if (m_nodes.empty()) return nullptr; - return libevdev_get_uniq(m_nodes.front().device); + const auto uniq = libevdev_get_uniq(m_nodes.front().device); + + // Some devices (e.g. Mayflash adapter) return an empty string which is not very unique. + if (uniq && std::strlen(uniq) == 0) + return nullptr; + + return uniq; } evdevDevice::~evdevDevice() |
