Skip to content

Commit 1f5df00

Browse files
committed
fix: Improve input device Bus interface detection
- Use case-insensitive contains matching instead of exact string comparison - Support interface name variations like 'ps/2', 'bluetooth low energy', etc. - Refactor hardcoded interface checks to use static list and loop - Fix device availability detection for input devices with non-standard interface names Log: Improve input device Bus interface detection Bug: https://pms.uniontech.com/bug-view-331181.html Change-Id: Ifbc7c40f44f45e146f07fe101ed3fc960e945459
1 parent f0b48f9 commit 1f5df00

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

deepin-devicemanager/src/DeviceManager/DeviceInput.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,12 @@ bool DeviceInput::available()
387387
if (driver().isEmpty()) {
388388
m_Available = false;
389389
}
390-
if ("PS/2" == m_Interface || "Bluetooth" == m_Interface || "I2C" == m_Interface) {
391-
m_Available = true;
390+
static QStringList supportInterfaces{"PS/2", "Bluetooth", "I2C"};
391+
for (auto interface : supportInterfaces) {
392+
if (interface.toLower().contains(m_Interface.toLower())) {
393+
m_Available = true;
394+
break;
395+
}
392396
}
393397
return m_forcedDisplay ? m_forcedDisplay : m_Available;
394398
}

0 commit comments

Comments
 (0)