From 1f296742dc65389b080a138e0bd340bad6efec89 Mon Sep 17 00:00:00 2001 From: majiuping Date: Thu, 20 Aug 2026 15:26:12 +0800 Subject: [PATCH] fix: strip input suffix from m_SysPath on mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Root cause: getPS2Syspath() only updates m_SysPath on event-number match success; on failure m_SysPath keeps the hwinfo raw SysFS ID with /input/inputN or /inputN suffix 2. Fix: strip the trailing input suffix from m_SysPath after matching so wakeupPath() and DBus wakeup call use the correct sysfs path 3. Impact: external keyboard changes input enumeration and triggers the mismatch; "allow waking up computer" menu is no longer greyed out for PS/2 and L2C keyboards Log: Fix greyed-out wake-up menu item after attaching external keyboard Influence: 1. Connect an external keyboard and verify the right-click "allow waking up computer" menu is enabled for PS/2 keyboard 2. Repeat the same check for L2C (i2c_designware) keyboard 3. Verify wake-up-from-keyboard still works without external keyboard fix: 修复外接键盘后唤出电脑菜单置灰 1. 根因:getPS2Syspath() 仅在 event 号匹配成功时更新 m_SysPath;匹配失败时 m_SysPath 仍保留 hwinfo 原始 SysFS ID(含 /input/inputN 或 /inputN 后缀) 2. 方案:匹配后剥离 m_SysPath 尾部的 /input/inputN (i2c_designware)或 /inputN 后缀,使 wakeupPath() 与 DBus 唤出调用拼出正确的 sysfs 路径 3. 影响:外接键盘改变输入设备枚举导致匹配失败,修复后 PS/2 与 L2C 键盘右键"允许唤出电脑"菜单不再置灰 Log: 修复外接键盘后"允许唤出电脑"菜单置灰问题 Influence: 1. 外接键盘后验证 PS/2 键盘右键"允许唤出电脑"菜单可用 2. 外接键盘后验证 L2C(i2c_designware)键盘同样可用 3. 不外接键盘时验证唤出电脑功能无回归 PMS: BUG-294489 --- deepin-devicemanager/src/DeviceManager/DeviceInput.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp index beb872ffc..c4d44f41e 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp @@ -239,6 +239,13 @@ bool DeviceInput::getPS2Syspath(const QString &dfs) } } + // 匹配失败时 m_SysPath 仍保留 hwinfo 原始 SysFS ID(含 /input/inputN 或 /inputN 后缀), + // 需剥离后缀得到正确设备 syspath,否则 wakeupPath() 等会拼出错误路径 + if (m_SysPath.contains("i2c_designware")) + m_SysPath.remove(QRegExp("/input/input[0-9]{1,2}$")); + else + m_SysPath.remove(QRegExp("/input[0-9]{1,2}$")); + return true; }