From 06eace4fe6c6835d279716b29a1e153985a77556 Mon Sep 17 00:00:00 2001 From: gongheng Date: Fri, 1 Aug 2025 09:23:39 +0800 Subject: [PATCH 01/13] fix: [Net-Wakeup] The net card can not wakeup. -- Code Logic error, "sizeof(logicalName::toStdString().c_str())" always return 8, not the length of logicalName. -- So, When the length more than 8, the net card will can not find. Log: fix issue Bug: https://pms.uniontech.com/bug-view-326565.html --- .../src/wakecontrol/wakeuputils.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager-server/deepin-devicecontrol/src/wakecontrol/wakeuputils.cpp b/deepin-devicemanager-server/deepin-devicecontrol/src/wakecontrol/wakeuputils.cpp index 556ffab0..af85d6a1 100644 --- a/deepin-devicemanager-server/deepin-devicecontrol/src/wakecontrol/wakeuputils.cpp +++ b/deepin-devicemanager-server/deepin-devicecontrol/src/wakecontrol/wakeuputils.cpp @@ -130,7 +130,12 @@ WakeupUtils::EthStatus WakeupUtils::wakeOnLanIsOpen(const QString &logicalName) struct ifreq ifr; struct ethtool_wolinfo wolinfo; memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, logicalName.toStdString().c_str(), sizeof(logicalName.toStdString().c_str())); + memset(&wolinfo, 0, sizeof(wolinfo)); + + QByteArray nameBytes = logicalName.toLocal8Bit(); + strncpy(ifr.ifr_name, nameBytes.constData(), IFNAMSIZ - 1); + ifr.ifr_name[IFNAMSIZ - 1] = '\0'; + wolinfo.cmd = ETHTOOL_GWOL; ifr.ifr_data = reinterpret_cast(&wolinfo); if (0 != ioctl(fd, SIOCETHTOOL, &ifr)) { @@ -161,7 +166,12 @@ bool WakeupUtils::setWakeOnLan(const QString &logicalName, bool open) struct ifreq ifr; struct ethtool_wolinfo wolinfo; memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, logicalName.toStdString().c_str(), sizeof(logicalName.toStdString().c_str())); + memset(&wolinfo, 0, sizeof(wolinfo)); + + QByteArray nameBytes = logicalName.toLocal8Bit(); + strncpy(ifr.ifr_name, nameBytes.constData(), IFNAMSIZ - 1); + ifr.ifr_name[IFNAMSIZ - 1] = '\0'; + wolinfo.cmd = ETHTOOL_SWOL; if (open) wolinfo.wolopts = 0 | WAKE_MAGIC; From 4cf65d7efcba2a3d26932f489115087da0eb3c53 Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 5 Aug 2025 15:20:24 +0800 Subject: [PATCH 02/13] Perf: Improve program performance -- Function parameter should be passed by const reference. --- .../src/DriverControl/DBusDriverInterface.cpp | 6 +++--- .../src/DriverControl/DBusDriverInterface.h | 6 +++--- deepin-devicemanager/src/DriverControl/DriverScanner.cpp | 2 +- deepin-devicemanager/src/DriverControl/DriverScanner.h | 2 +- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 2 +- deepin-devicemanager/src/GenerateDevice/CmdTool.h | 2 +- deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp | 2 +- deepin-devicemanager/src/GenerateDevice/GetInfoPool.h | 2 +- deepin-devicemanager/src/Page/MainWindow.cpp | 2 +- deepin-devicemanager/src/Page/MainWindow.h | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/deepin-devicemanager/src/DriverControl/DBusDriverInterface.cpp b/deepin-devicemanager/src/DriverControl/DBusDriverInterface.cpp index a11a3696..21cea8e9 100644 --- a/deepin-devicemanager/src/DriverControl/DBusDriverInterface.cpp +++ b/deepin-devicemanager/src/DriverControl/DBusDriverInterface.cpp @@ -133,13 +133,13 @@ DBusDriverInterface::~DBusDriverInterface() qCDebug(appLog) << "DBusDriverInterface destructor"; } -void DBusDriverInterface::slotProcessChange(qint32 value, QString detail) +void DBusDriverInterface::slotProcessChange(qint32 value, const QString &detail) { qCDebug(appLog) << "DBusDriverInterface::slotProcessChange"; emit processChange(value, detail); } -void DBusDriverInterface::slotProcessEnd(bool success, QString msg) +void DBusDriverInterface::slotProcessEnd(bool success, const QString &msg) { qCDebug(appLog) << "DBusDriverInterface::slotProcessEnd"; if (success) { @@ -157,7 +157,7 @@ void DBusDriverInterface::slotCallFinished(QDBusPendingCallWatcher *watcher) watcher->deleteLater(); } -void DBusDriverInterface::slotDownloadProgressChanged(QStringList msg) +void DBusDriverInterface::slotDownloadProgressChanged(const QStringList &msg) { qCDebug(appLog) << "DBusDriverInterface::slotDownloadProgressChanged"; emit downloadProgressChanged(msg); diff --git a/deepin-devicemanager/src/DriverControl/DBusDriverInterface.h b/deepin-devicemanager/src/DriverControl/DBusDriverInterface.h index bd221158..709b32f7 100644 --- a/deepin-devicemanager/src/DriverControl/DBusDriverInterface.h +++ b/deepin-devicemanager/src/DriverControl/DBusDriverInterface.h @@ -123,13 +123,13 @@ private slots: * @param value 当前处理的进度 * @param detail 发送过来的时时信息 */ - void slotProcessChange(qint32 value, QString detail); + void slotProcessChange(qint32 value, const QString &detail); /** * @brief slotProcessEnd 接收后台结束信号 * @param success */ - void slotProcessEnd(bool success, QString msg); + void slotProcessEnd(bool success, const QString &msg); /** * @brief slotCallFinished 更新结束结束的回调 @@ -139,7 +139,7 @@ private slots: /** * @brief slotDownloadProgressChanged 驱动下载时回调,返回驱动下载进度、速度、已下载大小信息 */ - void slotDownloadProgressChanged(QStringList msg); + void slotDownloadProgressChanged(const QStringList &msg); /** * @brief slotDownloadFinished 驱动下载完成 diff --git a/deepin-devicemanager/src/DriverControl/DriverScanner.cpp b/deepin-devicemanager/src/DriverControl/DriverScanner.cpp index ddc8330a..4fa25002 100644 --- a/deepin-devicemanager/src/DriverControl/DriverScanner.cpp +++ b/deepin-devicemanager/src/DriverControl/DriverScanner.cpp @@ -86,7 +86,7 @@ void DriverScanner::run() } } -void DriverScanner::setDriverList(QList lstInfo) +void DriverScanner::setDriverList(const QList &lstInfo) { qCDebug(appLog) << "Set driver list with" << lstInfo.size() << "items"; m_ListDriverInfo = lstInfo; diff --git a/deepin-devicemanager/src/DriverControl/DriverScanner.h b/deepin-devicemanager/src/DriverControl/DriverScanner.h index ae1d7ddc..7439cba3 100644 --- a/deepin-devicemanager/src/DriverControl/DriverScanner.h +++ b/deepin-devicemanager/src/DriverControl/DriverScanner.h @@ -25,7 +25,7 @@ class DriverScanner : public QThread * @brief setDriverList * @param lstInfo */ - void setDriverList(QList lstInfo); + void setDriverList(const QList &lstInfo); signals: void scanInfo(const QString &info, int progress); diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 80e175db..62a2d28d 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -218,7 +218,7 @@ QString CmdTool::loadOemTomlFileName(const QMap &mapInfo) return QString(); } -bool CmdTool::parseOemTomlInfo(const QString filename) +bool CmdTool::parseOemTomlInfo(const QString &filename) { qCInfo(appLog) << "CmdTool::parseOemTomlInfo start, filename:" << filename; bool tomlFileRead = false; diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.h b/deepin-devicemanager/src/GenerateDevice/CmdTool.h index f838f9d8..61ceb888 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.h +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.h @@ -61,7 +61,7 @@ class CmdTool /** * @brief parseOemTomlInfo: 解析并加载厂商适配信息 */ - bool parseOemTomlInfo(const QString filename); + bool parseOemTomlInfo(const QString &filename); private: diff --git a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp index 4f7b8e6a..9121a05c 100644 --- a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.cpp @@ -15,7 +15,7 @@ using namespace DDLog; static QMutex mutex; -CmdTask::CmdTask(QString key, QString file, QString info, GetInfoPool *parent) +CmdTask::CmdTask(const QString &key, const QString &file, const QString &info, GetInfoPool *parent) : m_Key(key) , m_File(file) , m_Info(info) diff --git a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h index 4582b1f8..8efb8679 100644 --- a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h +++ b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h @@ -19,7 +19,7 @@ class CmdTask: public QObject, public QRunnable { Q_OBJECT public: - CmdTask(QString key, QString file, QString info, GetInfoPool *parent); + CmdTask(const QString &key, const QString &file, const QString &info, GetInfoPool *parent); ~CmdTask(); protected: void run() override; diff --git a/deepin-devicemanager/src/Page/MainWindow.cpp b/deepin-devicemanager/src/Page/MainWindow.cpp index 42bac79d..63e4b3e5 100644 --- a/deepin-devicemanager/src/Page/MainWindow.cpp +++ b/deepin-devicemanager/src/Page/MainWindow.cpp @@ -533,7 +533,7 @@ void MainWindow::refreshDataBase() } } -void MainWindow::slotSetPage(QString page) +void MainWindow::slotSetPage(const QString &page) { qCDebug(appLog) << "MainWindow::slotSetPage page:" << page; if ("driver" == page) { diff --git a/deepin-devicemanager/src/Page/MainWindow.h b/deepin-devicemanager/src/Page/MainWindow.h index 2dcd93f7..6a60c8fd 100644 --- a/deepin-devicemanager/src/Page/MainWindow.h +++ b/deepin-devicemanager/src/Page/MainWindow.h @@ -134,7 +134,7 @@ private slots: * @brief slotSetPage * @param page */ - void slotSetPage(QString page); + void slotSetPage(const QString &page); /** * @brief loadingFinishSlot:加载设备信息结束 槽 From d1d8b9ab5a99e7b5bba1502427523a3faacade49 Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 5 Aug 2025 15:59:08 +0800 Subject: [PATCH 03/13] Chore: Fix the cppcheck warning. -- A destructor but is not marked 'override'. -- When dealing with inheritance, deleting a derived class object through a base class pointer without a virtual destructor will lead to problems. --- deepin-devicemanager/src/GenerateDevice/GetInfoPool.h | 2 +- deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h | 2 +- deepin-devicemanager/src/Page/DeviceWidget.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h index 8efb8679..c207baa6 100644 --- a/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h +++ b/deepin-devicemanager/src/GenerateDevice/GetInfoPool.h @@ -20,7 +20,7 @@ class CmdTask: public QObject, public QRunnable Q_OBJECT public: CmdTask(const QString &key, const QString &file, const QString &info, GetInfoPool *parent); - ~CmdTask(); + ~CmdTask() override; protected: void run() override; diff --git a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h index 051468d9..440f285b 100644 --- a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h +++ b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h @@ -16,7 +16,7 @@ class LoadInfoThread : public QThread Q_OBJECT public: LoadInfoThread(); - ~LoadInfoThread(); + ~LoadInfoThread() override; /** * @brief setFramework:设置架构 diff --git a/deepin-devicemanager/src/Page/DeviceWidget.h b/deepin-devicemanager/src/Page/DeviceWidget.h index 4a79f5c2..586cf400 100644 --- a/deepin-devicemanager/src/Page/DeviceWidget.h +++ b/deepin-devicemanager/src/Page/DeviceWidget.h @@ -26,7 +26,7 @@ class DeviceWidget : public DWidget Q_OBJECT public: explicit DeviceWidget(QWidget *parent = nullptr); - ~DeviceWidget(); + ~DeviceWidget() override; /** * @brief updateListView:更新ListView From c70274b34c8860a83aac2a0225668e03780b434f Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 12 Aug 2025 09:47:54 +0800 Subject: [PATCH 04/13] fix: [memory] Memory show error in special platform. -- Change the right way to get memory. Log: fix issue Bug: https://pms.uniontech.com/bug-view-328705.html --- .../customgpuinfo/main.cpp | 51 +++++++------------ 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/deepin-devicemanager-server/customgpuinfo/main.cpp b/deepin-devicemanager-server/customgpuinfo/main.cpp index c26460bd..969bcd55 100644 --- a/deepin-devicemanager-server/customgpuinfo/main.cpp +++ b/deepin-devicemanager-server/customgpuinfo/main.cpp @@ -51,13 +51,12 @@ bool getGpuBaseInfo(QMap &mapInfo) bool getGpuMemInfoForFTDTM(QMap &mapInfo) { - const QString filePath = "/sys/kernel/debug/gc/meminfo"; + const QString filePath = "/sys/kernel/debug/gc/total_mem"; QString totalValue; - bool foundTotal = false; QFile file(filePath); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qCritical() << "Error opening /sys/kernel/debug/gc/meminfo:" << file.errorString(); + qCritical() << "Error opening /sys/kernel/debug/gc/total_mem:" << file.errorString(); return false; } @@ -65,42 +64,30 @@ bool getGpuMemInfoForFTDTM(QMap &mapInfo) file.close(); if (content.isEmpty()) { - qCritical() << "Error: /sys/kernel/debug/gc/meminfo File is empty!"; + qCritical() << "Error: /sys/kernel/debug/gc/total_mem File is empty!"; return false; } - QRegularExpression system0Regex(R"(POOL SYSTEM0:*(.*?)POOL VIRTUAL:)", - QRegularExpression::DotMatchesEverythingOption); - QRegularExpressionMatch system0Match = system0Regex.match(content); + QRegularExpression regex(R"((\d+(?:\.\d+)?)\s*\(?(MB|GB|KB|B)\)?)", + QRegularExpression::CaseInsensitiveOption); + QRegularExpressionMatch memInfoMatch = regex.match(content); - if (!system0Match.hasMatch()) { - qCritical() << "Error: Failed to find SYSTEM0 section"; + if (!memInfoMatch.hasMatch()) { + qCritical() << "Error: Failed to find memory info"; return false; } - QString system0Content = system0Match.captured(1); - QRegularExpression totalRegex(R"(Total\s*:\s*(\d+)\s+B)"); - QRegularExpressionMatch totalMatch = totalRegex.match(system0Content); - if (totalMatch.hasMatch()) { - totalValue = totalMatch.captured(1); - foundTotal = true; - } - - if (!foundTotal || totalValue.isEmpty()) { - qCritical() << "Error: Failed to find Total value in SYSTEM0 content"; - return false; - } - - bool ok; - quint64 memSize = totalValue.trimmed().toULong(&ok, 10); - if (ok && memSize >= 1048576) { - memSize /= 1048576; - auto curSize = memSize / 1024.0; - if (curSize >= 1) { - totalValue = QString::number(curSize) + "GB"; - } else { - totalValue = QString::number(memSize) + "MB"; - } + double value = memInfoMatch.captured(1).toDouble(); + QString unit = memInfoMatch.captured(2).toUpper(); + + if (unit == "MB") { + totalValue = QString("%1GB").arg(value / 1024.0, 0, 'f', 2); + } else if (unit == "GB") { + totalValue = QString("%1GB").arg(value, 0, 'f', 2); + } else if (unit == "KB") { + totalValue = QString("%1GB").arg(value / (1024.0 * 1024.0), 0, 'f', 2); + } else if (unit == "B") { + totalValue = QString("%1GB").arg(value / (1024.0 * 1024.0 * 1024.0), 0, 'f', 2); } mapInfo.insert(kGraphicsMemory, totalValue); From 9c42f7e16b67cda1e63ccc504fb679a0ac4059d1 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 13 Aug 2025 09:42:11 +0800 Subject: [PATCH 05/13] fix: Handle display configuration for specific device models Implemented information masking for certain display configurations on special hardware models. pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/71f38f89488b2c9b9e9a77c6eadd9ba760b24b45 Log: Add display info filtering for special devices Bug: https://pms.uniontech.com/bug-view-328971.html Change-Id: Ie2826605b25bdb1ef1c4956bd6856af95284b108 --- deepin-devicemanager/src/Page/PageMultiInfo.cpp | 7 +++---- .../translations/deepin-devicemanager_zh_CN.ts | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/deepin-devicemanager/src/Page/PageMultiInfo.cpp b/deepin-devicemanager/src/Page/PageMultiInfo.cpp index 3e52ef2b..e1647ec6 100644 --- a/deepin-devicemanager/src/Page/PageMultiInfo.cpp +++ b/deepin-devicemanager/src/Page/PageMultiInfo.cpp @@ -100,12 +100,11 @@ void PageMultiInfo::updateInfo(const QList &lst) mp_Table->setFixedHeight(TABLE_HEIGHT); mp_Table->updateTable(m_deviceList, m_menuControlList); if (Common::specialComType >= 1) { - if (mp_Label->text() == tr("Storage") || mp_Label->text() == tr("Memory")) { + if (mp_Label->text() == tr("Storage") || mp_Label->text() == tr("Memory") || mp_Label->text() == tr("Monitor")) { mp_Table->setVisible(false); mp_Table->setFixedHeight(0); } } - // 更新详细信息 mp_Detail->showDeviceInfo(lst); } @@ -152,7 +151,7 @@ void PageMultiInfo::resizeEvent(QResizeEvent *e) if (Common::specialComType <= 0) { mp_Table->updateTable(m_deviceList, m_menuControlList, true, (LEAST_PAGE_HEIGHT - curHeight) / TREE_ROW_HEIGHT + 1); } else { - if (mp_Label->text() != tr("Storage") && mp_Label->text() != tr("Memory")) + if (mp_Label->text() != tr("Storage") && mp_Label->text() != tr("Memory") && mp_Label->text() != tr("Monitor")) mp_Table->updateTable(m_deviceList, m_menuControlList, true, (LEAST_PAGE_HEIGHT - curHeight) / TREE_ROW_HEIGHT + 1); } } else { @@ -161,7 +160,7 @@ void PageMultiInfo::resizeEvent(QResizeEvent *e) if (Common::specialComType <= 0) { mp_Table->updateTable(m_deviceList, m_menuControlList, true, 0); } else { - if (mp_Label->text() != tr("Storage") && mp_Label->text() != tr("Memory")) + if (mp_Label->text() != tr("Storage") && mp_Label->text() != tr("Memory") && mp_Label->text() != tr("Monitor")) mp_Table->updateTable(m_deviceList, m_menuControlList, true, 0); } } diff --git a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts index 2f2c060c..1d383f1c 100644 --- a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts +++ b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts @@ -2188,6 +2188,14 @@ + + + + Monitor + 显示设备 + + + Failed to enable the device 启用失败 From 2467b0a716dae79d79f4efc3fca04a9d2cc87c03 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 13 Aug 2025 10:24:53 +0800 Subject: [PATCH 06/13] fix: update monitor of subtitle for specific device models update monitor of subtitle for specific device models pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/26ac1a4b515a95a9605d607274ef9f4ffe8c31f1 Log: update monitor of subtitle for specific device models Bug: https://pms.uniontech.com/bug-view-328971.html Change-Id: Ica04bfa281acf49fde7fcdbbd8b84bf0d357afbe --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 22040726..16e897cf 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -378,6 +378,9 @@ bool DeviceMonitor::available() QString DeviceMonitor::subTitle() { // qCDebug(appLog) << "Getting monitor subtitle"; + if (Common::specialComType >= 1) { + m_Name.clear(); + } return m_Name; } From 402fff8e845856c5b8f8c0683b3a72c94d874ad6 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Fri, 15 Aug 2025 14:09:35 +0800 Subject: [PATCH 07/13] fix: update filter for some unkown netcard update filter for some unkown netcard pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/3165c947f0f50eccb6b6756f16fb5165acf009a8 Log: update filter for some unkown netcard Bug: https://pms.uniontech.com/bug-view-328939.html Change-Id: I31e2da109343b3646f497389fa8735c9b6bb3c7b --- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 62a2d28d..599756a8 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -699,7 +699,7 @@ void CmdTool::getMulHwinfoInfo(const QString &info) qCDebug(appLog) << "Found sound device."; // mapInfo["Device"].contains("USB Audio") 是为了处理未识别的USB声卡 Bug-118773 addMapInfo("hwinfo_sound", mapInfo); - } else if (mapInfo["Hardware Class"].contains("network")) { + } else if (mapInfo["Hardware Class"].contains("network") || mapInfo["Device"].toUpper().contains("WI-FI")) { qCDebug(appLog) << "Found network device."; addMapInfo("hwinfo_network", mapInfo); } else if ("keyboard" == mapInfo["Hardware Class"]) { From 57b47752e82386570cf989fcbae922e095589530 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 18 Aug 2025 14:05:25 +0800 Subject: [PATCH 08/13] fix: Improve network adapter model detection Enhanced model identification for external adapter-based NICs (including Type-C to RJ45 converters) to ensure reliable device model retrieval. Log: Fix NIC model detection failure Bug: https://pms.uniontech.com/bug-view-329931.html Change-Id: I25a5b0485228f8c431866608754601519c22b612 --- deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp index e04ea183..9c39f6db 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp @@ -176,6 +176,9 @@ bool DeviceNetwork::setInfoFromHwinfo(const QMap &mapInfo) // 判断是否是无线网卡 setIsWireless(mapInfo["SysFS ID"]); + if (mapInfo.contains("Device")) { + m_Name = mapInfo["Device"]; + } return true; } From 03b916dd505bff51bef7160878869a65d4fb1434 Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 19 Aug 2025 19:29:24 +0800 Subject: [PATCH 09/13] Fix: [cppcheck] Fix cppcheck warnings. -- The scope of the variable can be reduced. -- Uninitialized struct member: resoulution -- Local varible pathList shadows outer variable --- .../src/Tool/ThreadExecXrandr.cpp | 30 +++++++++---------- .../src/WakeupControl/DBusWakeupInterface.cpp | 4 +-- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp index 222e6888..f7234ca6 100644 --- a/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp +++ b/deepin-devicemanager/src/Tool/ThreadExecXrandr.cpp @@ -361,7 +361,7 @@ void ThreadExecXrandr::getResolutionFromDBus(QMap &lstMap) arg.beginArray(); int curMaxResolutionWidth = -1, curMaxResolutionHeight = -1; while (!arg.atEnd()) { - MonitorResolution resolution; + MonitorResolution resolution{}; arg >> resolution; qCDebug(appLog) << "Found resolution:" << resolution.width << "x" << resolution.height << "@" << resolution.refreshRate; if (curMaxResolutionWidth == -1) { @@ -477,21 +477,19 @@ void ThreadExecXrandr::getResolutionRateFromDBus(QList > int curResolutionWidth = -1, curResolutionHeight = -1; double resRate = 0; - { - MonitorResolution resolution; - arg >> resolution; - - curResolutionWidth = resolution.width; - curResolutionHeight = resolution.height; - resRate = resolution.refreshRate; - QMapinfoMap; - QString tmpS = QString("%1×%2@").arg(curResolutionWidth).arg(curResolutionHeight) + QString::number(resRate, 'f', 2); - infoMap.insert("CurResolution", tmpS + "Hz"); - infoMap.insert("Name", tname.toString()); - infoMap.insert("Display Input", tname.toString()); - infoMap.insert("Manufacture", tmanufacture.toString()); - lstMap.append(infoMap); - } //end of while + MonitorResolution resolution {}; + arg >> resolution; + + curResolutionWidth = resolution.width; + curResolutionHeight = resolution.height; + resRate = resolution.refreshRate; + QMapinfoMap; + QString tmpS = QString("%1×%2@").arg(curResolutionWidth).arg(curResolutionHeight) + QString::number(resRate, 'f', 2); + infoMap.insert("CurResolution", tmpS + "Hz"); + infoMap.insert("Name", tname.toString()); + infoMap.insert("Display Input", tname.toString()); + infoMap.insert("Manufacture", tmanufacture.toString()); + lstMap.append(infoMap); } //end of for QList >::const_iterator it = lstMap.begin(); diff --git a/deepin-devicemanager/src/WakeupControl/DBusWakeupInterface.cpp b/deepin-devicemanager/src/WakeupControl/DBusWakeupInterface.cpp index 56482df9..3074c763 100644 --- a/deepin-devicemanager/src/WakeupControl/DBusWakeupInterface.cpp +++ b/deepin-devicemanager/src/WakeupControl/DBusWakeupInterface.cpp @@ -69,9 +69,9 @@ bool DBusWakeupInterface::setWakeupMachine(const QString &unique_id, const QStri QDBusArgument arg = v.value().variant().value(); QMap allSupportWakeupDevices; arg >> allSupportWakeupDevices; - QStringList pathList = allSupportWakeupDevices.keys(); + QStringList wakeupPathList = allSupportWakeupDevices.keys(); - for (QString path : pathList) { + for (QString path : wakeupPathList) { if (path.contains("PS2")) { mp_InputIface->call("SetWakeupDevices", path, wakeup ? "enabled" : "disabled"); return true; From ab2eab5520add323746094f306faf94639124c39 Mon Sep 17 00:00:00 2001 From: gongheng Date: Tue, 19 Aug 2025 19:54:34 +0800 Subject: [PATCH 10/13] Fix: [cppcheck] Resolve cppcheck issue -- unused parameter -- implicit conversion turns floating-point number into integer: 'double' to 'int' -- 9 enumeration values not handled in switch: 'ST_CAN_UPDATE', 'ST_WAITING', 'ST_DRIVER_NOT_BACKUP'... -- Function parameter 'status' should be passed by const reference pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/61ad67e3f2e354f41897c248f60c5e0932d06459 --- deepin-devicemanager/src/Widget/DetectedStatusWidget.cpp | 5 ++++- deepin-devicemanager/src/Widget/DriverWaitingWidget.cpp | 2 +- deepin-devicemanager/src/Widget/DriverWaitingWidget.h | 2 +- deepin-devicemanager/src/Widget/TableWidget.cpp | 2 ++ deepin-devicemanager/src/commonfunction.cpp | 2 +- deepin-devicemanager/src/commonfunction.h | 3 ++- deepin-devicemanager/src/main.cpp | 2 ++ 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/deepin-devicemanager/src/Widget/DetectedStatusWidget.cpp b/deepin-devicemanager/src/Widget/DetectedStatusWidget.cpp index c059aa60..117c7079 100644 --- a/deepin-devicemanager/src/Widget/DetectedStatusWidget.cpp +++ b/deepin-devicemanager/src/Widget/DetectedStatusWidget.cpp @@ -340,6 +340,7 @@ void DetectedStatusWidget::setInstallFailedUI() void DetectedStatusWidget::setNetworkErrorUI(const QString &speed, int progressValue) { qCWarning(appLog) << "Setting network error UI. Speed:" << speed << "Progress:" << progressValue; + Q_UNUSED(progressValue) hideAll(); // Icon Label @@ -436,7 +437,7 @@ void DetectedStatusWidget::refreshUI(Status pageType) } case ST_DOWNLOADING: { qCDebug(appLog) << "Status: Downloading"; - this->setDownloadUI(DR_Bluetooth, "7.00MB/s", "28.96MB", "192.78MB", 28.96 * 100 / 192.78); + this->setDownloadUI(DR_Bluetooth, "7.00MB/s", "28.96MB", "192.78MB", static_cast(28.96 * 100 / 192.78)); break; } case ST_INSTALL: { @@ -464,6 +465,8 @@ void DetectedStatusWidget::refreshUI(Status pageType) this->setNoUpdateDriverUI("ddddddddddddddddddddddddddddddd"); break; } + default: + break; } } diff --git a/deepin-devicemanager/src/Widget/DriverWaitingWidget.cpp b/deepin-devicemanager/src/Widget/DriverWaitingWidget.cpp index 6e0b51e4..3d3ac8c2 100644 --- a/deepin-devicemanager/src/Widget/DriverWaitingWidget.cpp +++ b/deepin-devicemanager/src/Widget/DriverWaitingWidget.cpp @@ -12,7 +12,7 @@ using namespace DDLog; -DriverWaitingWidget::DriverWaitingWidget(QString status, QWidget *parent) +DriverWaitingWidget::DriverWaitingWidget(const QString &status, QWidget *parent) : DWidget(parent) , mp_Progress(new DWaterProgress(this)) , mp_Label(new DLabel(status, this)) diff --git a/deepin-devicemanager/src/Widget/DriverWaitingWidget.h b/deepin-devicemanager/src/Widget/DriverWaitingWidget.h index 60a7efe0..2374f90a 100644 --- a/deepin-devicemanager/src/Widget/DriverWaitingWidget.h +++ b/deepin-devicemanager/src/Widget/DriverWaitingWidget.h @@ -14,7 +14,7 @@ DWIDGET_USE_NAMESPACE class DriverWaitingWidget : public DWidget { public: - explicit DriverWaitingWidget(QString status, QWidget *parent = nullptr); + explicit DriverWaitingWidget(const QString &status, QWidget *parent = nullptr); /** * @brief setValue 设置进度条的数值 diff --git a/deepin-devicemanager/src/Widget/TableWidget.cpp b/deepin-devicemanager/src/Widget/TableWidget.cpp index 914b8317..77085208 100644 --- a/deepin-devicemanager/src/Widget/TableWidget.cpp +++ b/deepin-devicemanager/src/Widget/TableWidget.cpp @@ -213,6 +213,8 @@ void TableWidget::paintEvent(QPaintEvent *e) void TableWidget::slotShowMenu(const QPoint &point) { qCDebug(appLog) << "Showing menu"; + Q_UNUSED(point) + mp_Menu->clear(); // 不管什么状态 导出、刷新、复制 都有 mp_Refresh->setEnabled(true); diff --git a/deepin-devicemanager/src/commonfunction.cpp b/deepin-devicemanager/src/commonfunction.cpp index 68c6e4d4..47f408ac 100644 --- a/deepin-devicemanager/src/commonfunction.cpp +++ b/deepin-devicemanager/src/commonfunction.cpp @@ -234,7 +234,7 @@ QString Common::specialHString() return result; } -void Common::tomlFilesNameSet(QString name) +void Common::tomlFilesNameSet(const QString &name) { tomlFilesName = name; } diff --git a/deepin-devicemanager/src/commonfunction.h b/deepin-devicemanager/src/commonfunction.h index 1047de55..de4efffa 100644 --- a/deepin-devicemanager/src/commonfunction.h +++ b/deepin-devicemanager/src/commonfunction.h @@ -37,7 +37,8 @@ class Common static QString specialVendorType(); static QString specialHString(); static QString tomlFilesNameGet(); - static void tomlFilesNameSet(QString name); + static void tomlFilesNameSet(const QString &name); + /** * @brief specialComType * special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4) diff --git a/deepin-devicemanager/src/main.cpp b/deepin-devicemanager/src/main.cpp index f1e27a8b..80d28f1e 100644 --- a/deepin-devicemanager/src/main.cpp +++ b/deepin-devicemanager/src/main.cpp @@ -155,6 +155,8 @@ int main(int argc, char *argv[]) void notify(int argc, char *argv[]) { qCDebug(appLog) << "Starting notification process"; + Q_UNUSED(argc) + // 1. 连接到dbus qCDebug(appLog) << "Starting notification process"; if (!QDBusConnection::sessionBus().isConnected()) { From 077890c09e1561b5dfafd7ae8d807e582cc823d5 Mon Sep 17 00:00:00 2001 From: gongheng Date: Mon, 25 Aug 2025 09:46:54 +0800 Subject: [PATCH 11/13] Fix: [Monitor-Info] add hardware platform detection for monitor validation - Add isHwPlatform() method to Common class for platform type checking - Implement getMonitorNameFromEdid() in DeviceMonitor for EDID parsing - Add monitor name validation logic in setInfoFromXradr() method - Skip monitor name validation on non-hardware platforms - Enhance monitor device detection accuracy by comparing EDID monitor names Log: fix issue Bug: https://pms.uniontech.com/bug-view-330145.html --- .../src/DeviceManager/DeviceMonitor.cpp | 18 ++++++++++++++++++ .../src/DeviceManager/DeviceMonitor.h | 2 ++ deepin-devicemanager/src/commonfunction.cpp | 7 +++++++ deepin-devicemanager/src/commonfunction.h | 1 + 4 files changed, 28 insertions(+) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 16e897cf..37f2db94 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -274,6 +274,14 @@ bool DeviceMonitor::setInfoFromXradr(const QString &main, const QString &edid, c } } + if (!Common::isHwPlatform()) { + QString monitorName = getMonitorNameFromEdid(edid); + if (!m_Model.isEmpty() && !monitorName.isEmpty() && monitorName != "Unknown Monitor") { + if (!m_Model.contains(monitorName)) + return false; + } + } + // 判断该显示器设备是否已经设置过从xrandr获取的消息 if (!m_Interface.isEmpty()) { qCDebug(appLog) << "Interface is not empty, checking current resolution"; @@ -629,6 +637,16 @@ bool DeviceMonitor::caculateScreenSize(const QString &edid) return true; } +QString DeviceMonitor::getMonitorNameFromEdid(const QString &edid) +{ + EDIDParser edidParse; + QString errormsg; + if (!edidParse.setEdid(edid, errormsg)) + return ""; + + return edidParse.monitorName(); +} + QMap DeviceMonitor::getMonitorResolutionMap(QString rawText, QString key, bool round) { QMap monitorResolutionMap; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h index 3a6ac781..30406361 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.h @@ -180,6 +180,8 @@ class DeviceMonitor : public DeviceBaseInfo */ bool caculateScreenSize(const QString &edid); + QString getMonitorNameFromEdid(const QString &edid); + /** * @brief getMonitorResolutionMap:从xrandr字符串获取格式化 * @param rawText:原始xrandr输出字符串 diff --git a/deepin-devicemanager/src/commonfunction.cpp b/deepin-devicemanager/src/commonfunction.cpp index 47f408ac..73bbaa15 100644 --- a/deepin-devicemanager/src/commonfunction.cpp +++ b/deepin-devicemanager/src/commonfunction.cpp @@ -239,6 +239,13 @@ void Common::tomlFilesNameSet(const QString &name) tomlFilesName = name; } +bool Common::isHwPlatform() +{ + if (specialComType == Unknow || specialComType == NormalCom || specialComType == kCustomType) + return false; + return true; +} + QString Common::tomlFilesNameGet() { return tomlFilesName; diff --git a/deepin-devicemanager/src/commonfunction.h b/deepin-devicemanager/src/commonfunction.h index de4efffa..25146cb3 100644 --- a/deepin-devicemanager/src/commonfunction.h +++ b/deepin-devicemanager/src/commonfunction.h @@ -38,6 +38,7 @@ class Common static QString specialHString(); static QString tomlFilesNameGet(); static void tomlFilesNameSet(const QString &name); + static bool isHwPlatform(); /** * @brief specialComType From 4962e87e6a41948401ab9bc9ed26dfc60de62fb7 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Wed, 27 Aug 2025 13:59:24 +0800 Subject: [PATCH 12/13] 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 pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/b8c68ae2970c0baf37e667c89f111bef9db0ae73 Log: Improve input device Bus interface detection Bug: https://pms.uniontech.com/bug-view-331181.html Change-Id: Ifbc7c40f44f45e146f07fe101ed3fc960e945459 --- deepin-devicemanager/src/DeviceManager/DeviceInput.cpp | 10 +++++----- deepin-devicemanager/src/DeviceManager/DeviceInput.h | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp index 9218396e..1e658aa6 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.cpp @@ -18,6 +18,8 @@ using namespace DDLog; +QStringList DeviceInput::m_supportInterfaces= {"PS/2", "Bluetooth", "I2C"}; + DeviceInput::DeviceInput() : DeviceBaseInfo() , m_Model("") @@ -496,11 +498,9 @@ bool DeviceInput::available() // qCDebug(appLog) << "driver is empty"; m_Available = false; } - if ("PS/2" == m_Interface || "Bluetooth" == m_Interface || "I2C" == m_Interface) { - // qCDebug(appLog) << "interface is PS/2 or Bluetooth"; - m_Available = true; - } - // qCDebug(appLog) << "available end"; + + m_Available = m_supportInterfaces.contains(m_Interface, Qt::CaseInsensitive); + return m_forcedDisplay ? m_forcedDisplay : m_Available; } diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInput.h b/deepin-devicemanager/src/DeviceManager/DeviceInput.h index 35e776f9..69bfd819 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInput.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInput.h @@ -208,6 +208,8 @@ class DeviceInput : public DeviceBaseInfo bool m_wakeupChanged = true; // Date: Wed, 27 Aug 2025 16:54:45 +0800 Subject: [PATCH 13/13] Fix: [Audio] The audio device of usb not show. -- Add logic code to append usb audio. pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/76729e9c6d5f1c28e80a7576e35c4beae1af1b03 Log: fix issue Bug: https://pms.uniontech.com/bug-view-331293.html --- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index 599756a8..a8355f23 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -695,7 +695,9 @@ void CmdTool::getMulHwinfoInfo(const QString &info) } QMap mapInfo; getMapInfoFromHwinfo(item, mapInfo); - if (mapInfo["Hardware Class"] == "sound" || (mapInfo["Device"].contains("USB Audio") && mapInfo["Device"].contains("snd-usb-audio"))) { + if (mapInfo["Hardware Class"] == "sound" + || (mapInfo["Device"].contains("USB Audio") && mapInfo["Device"].contains("snd-usb-audio")) + || mapInfo["Driver"].contains("snd-usb-audio")) { qCDebug(appLog) << "Found sound device."; // mapInfo["Device"].contains("USB Audio") 是为了处理未识别的USB声卡 Bug-118773 addMapInfo("hwinfo_sound", mapInfo);