Skip to content

Conversation

@add-uos
Copy link
Contributor

@add-uos add-uos commented Nov 28, 2025

pick develop/eagle to master

the audio device registe two pci device can't be disable

Log: fix the audio device registe two pci device can't be disable
Bug: https://pms.uniontech.com/bug-view-314495.html
Change-Id: I40efcebcf8e8e5942b768c7fc5d394ab100494be
fix the audio device may cause crush

Log: fix the audio device may cause crush.
Bug: https://pms.uniontech.com/bug-view-314495.html
Change-Id: Ic86b50fca4e37ad5317a37334a13273a51fba772
fit multiple audio device enable function

pick from: linuxdeepin@8e794c9

Log: fit multiple audio device enable function
Bug: https://pms.uniontech.com/bug-view-314495.html
Change-Id: Ibbd0c06d0112b5964d2f0dd9854aa8f629f8ccd1
modify the mouse device name

Log: modify the mouse device name
Bug: https://pms.uniontech.com/task-view-376575.html
Change-Id: I37339a5ec25d6fbe5b4cb4f209ba1f7fa7f87cec
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @add-uos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Copy link
Contributor

@lzwind lzwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

处理下commit错误

fix the USB audio device can't be disable

pick from: linuxdeepin@480a9ef

Log: fix the USB audio device can't be disable
Bug: https://pms.uniontech.com/bug-view-316525.html
Change-Id: I2e8d4f70d3b5c8d029c92386025ed974a1797bb5
@deepin-ci-robot
Copy link

deepin pr auto review

我来对这段代码进行审查:

  1. 语法逻辑方面:
  • ControlInterface.cpp 中删除了从数据库查找路径的逻辑,直接使用传入的path参数。这可能会导致设备更换USB接口后无法正确识别的问题,建议保留原有的数据库查找逻辑。

  • EnableSqlManager.cpp 中修改了 uniqueIDExisted 函数,增加了path参数,使查询更精确。这是一个好的改进。

  • DeviceManager.cpp 中的 deleteDisableDuplicate_AudioDevice 函数重构了逻辑,使用哈希表来管理设备,但代码过于复杂,建议简化逻辑并增加注释说明。

  1. 代码质量方面:
  • 在 EnableSqlManager.cpp 中添加了错误日志输出,这是好的实践。

  • DeviceManager.cpp 中新增的 setAudioDeviceEnable 函数使用了 lambda 表达式来转换状态码,虽然简洁但降低了可读性,建议改为普通的 switch-case 语句。

  1. 代码性能方面:
  • DeviceManager.cpp 中使用 QHash 来存储设备信息,这是一个好的选择,可以提供 O(1) 的查找性能。

  • 在遍历设备列表时使用了迭代器,这是高效的做法。

  1. 代码安全方面:
  • SQL 查询使用了参数化绑定,可以有效防止 SQL 注入,这是好的安全实践。

  • 在数据库操作前都进行了 prepare 检查,避免了空查询导致的错误。

建议改进:

  1. ControlInterface.cpp 中建议恢复数据库路径查找逻辑:
QString sPath = EnableSqlManager::getInstance()->authorizedPath(value);
if (sPath.isEmpty()) {
    sPath = path;
}
  1. DeviceManager.cpp 中的 setAudioDeviceEnable 函数建议改为:
void DeviceManager::setAudioDeviceEnable(DeviceAudio *const device, bool enable)
{
    EnableDeviceStatus status;
    int retryCount = 0;
    do {
        status = device->setEnable(enable);
        if (status == EDS_Success) {
            break;
        }
        qWarning() << "retry: " << ++retryCount;
    } while (retryCount < 3);

    QString statusMessage;
    switch(status) {
        case EDS_Cancle: 
            statusMessage = "Device enable operation was cancelled";
            break;
        case EDS_NoSerial: 
            statusMessage = "Device enable failed: No serial number available";
            break;
        case EDS_Faild: 
            statusMessage = "-----Device enable failed due to unknown error";
            break;
        case EDS_Success: 
            statusMessage = "Device enabled successfully";
            break;
        default: 
            statusMessage = "Unknown device enable status";
    }
    qWarning() << statusMessage;
}
  1. 建议在 DeviceManager.cpp 的 deleteDisableDuplicate_AudioDevice 函数中添加详细注释,说明处理逻辑。

  2. 建议在数据库操作相关的函数中添加更多的错误处理和日志记录,以便于问题追踪和调试。

  3. 对于设备识别相关的逻辑,建议增加单元测试,确保在各种情况下都能正确处理设备更换USB接口等场景。

@add-uos
Copy link
Contributor Author

add-uos commented Nov 28, 2025

处理下commit错误

冒号缺失,已处理
企业微信截图_17643186782644

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos
Copy link
Contributor Author

add-uos commented Nov 28, 2025

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Nov 28, 2025

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit 20dfc43 into linuxdeepin:master Nov 28, 2025
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants