mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-17 03:47:12 +02:00
ControllerInterface: Don't consider the empty string a valid unique ID.
This commit is contained in:
parent
ac907ef977
commit
aabe8d2ccd
@ -243,9 +243,12 @@ void AddDeviceNode(const char* devnode)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto evdev_device = FindDeviceWithUniqueID(libevdev_get_uniq(dev));
|
const auto uniq = libevdev_get_uniq(dev);
|
||||||
|
auto evdev_device = FindDeviceWithUniqueID(uniq);
|
||||||
if (evdev_device)
|
if (evdev_device)
|
||||||
{
|
{
|
||||||
|
NOTICE_LOG(SERIALINTERFACE, "evdev combining devices with unique id: %s", uniq);
|
||||||
|
|
||||||
evdev_device->AddNode(devnode, fd, dev);
|
evdev_device->AddNode(devnode, fd, dev);
|
||||||
|
|
||||||
// Callbacks must be invoked as the device name and available inputs may change.
|
// 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())
|
if (m_nodes.empty())
|
||||||
return nullptr;
|
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()
|
evdevDevice::~evdevDevice()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user