From e291ed34f64ed652a99afbd91d0703bcdcb407c2 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 28 Oct 2026 02:24:06 +0800 Subject: [PATCH] fix: remove incorrect SysFS path normalization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Root cause: path.replace(QRegularExpression("[1-9]$"), "0") blindly normalized the last digit of SysFS ID/Device Link to 0, collapsing multi-interface USB device paths (e.g. 1-2.3 → 1-2.0) and causing authorized file paths to overwrite each other 2. Fix: remove the incorrect normalization line so each interface keeps its original SysFS path for authorized file operations 3. Impact: multi-interface USB devices are no longer treated as the same path; disableOutDevice writes to the correct authorized file per interface Influence: 1. Test disabling a multi-interface USB device and verify each interface gets its own authorized file 2. Test disabling a single-interface USB device for no regression 3. Verify network card disable path still works via ioctl fix: 移除错误的 SysFS 路径归一化 1. 根因:path.replace(QRegularExpression("[1-9]$"), "0") 盲目将 SysFS ID/Device Link 末位数字归零,导致多接口 USB 设备路径被 折叠(如 1-2.3 → 1-2.0),authorized 文件路径相互覆盖 2. 方案:移除该错误归一化行,使每个接口保留原始 SysFS 路径进行 authorized 文件操作 3. 影响:多接口 USB 设备不再被视为同一路径,disableOutDevice 按接口写入正确的 authorized 文件 Influence: 1. 测试禁用多接口 USB 设备,验证每个接口写入独立 authorized 文件 2. 测试禁用单接口 USB 设备,验证无回归 3. 验证网卡禁用路径仍通过 ioctl 正常工作 --- .../deepin-devicecontrol/src/enablecontrol/enableutils.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enableutils.cpp b/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enableutils.cpp index 9d85d4bc..ae52af3b 100644 --- a/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enableutils.cpp +++ b/deepin-devicemanager-server/deepin-devicecontrol/src/enablecontrol/enableutils.cpp @@ -98,8 +98,6 @@ void EnableUtils::disableOutDevice(const QString &info) } else { path = mapItem["SysFS ID"]; } - path.replace(QRegularExpression("[1-9]$"), "0"); - // 网卡采用ioctl的方式禁用 QRegularExpression reg(REG_ADDRESS);