From 40d73a7e1add537be440bb038d7a2f566272ee4c Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Sat, 7 Dec 2024 10:03:21 +0800 Subject: [PATCH 1/5] fix: the flmx device of monitor display fix the flmx device of monitor display pick form: https://github.com/linuxdeepin/deepin-devicemanager/commit/4d4e3f75a87deee50f96b4b0f705facc2e7b9ffc Log: fix the flmx device of monitor display Task: https://pms.uniontech.com/task-view-368603.html --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 52d02007..6fe4b9ed 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -175,7 +175,8 @@ void DeviceMonitor::setInfoFromHwinfo(const QMap &mapInfo) TomlFixMethod DeviceMonitor::setInfoFromTomlOneByOne(const QMap &mapInfo) { qCDebug(appLog) << "Setting monitor info from TOML configuration"; - m_IsTomlSet = true; + if (Common::specialComType == 2) + m_IsTomlSet = true; TomlFixMethod ret = TOML_None; // 添加基本信息 ret = setTomlAttribute(mapInfo, "Type", m_Model); From 3c5147e1f751fd22604cdbdf3949221786c89161 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Sat, 7 Dec 2024 11:23:50 +0800 Subject: [PATCH 2/5] fix: the pgux device of monitor display fix the pgux device of monitor display pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/958f62c727bd2c6d3a9828c6c55650dcd9557083 Log: fix the pgux device of monitor display Task: https://pms.uniontech.com/task-view-368603.html --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index 6fe4b9ed..f401cc7c 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -6,6 +6,7 @@ #include "DeviceMonitor.h" #include "EDIDParser.h" #include "commonfunction.h" +#include "commondefine.h" #include "DDLog.h" #include @@ -428,7 +429,11 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra qCDebug(appLog) << "Adjusting rate for board vendor type"; curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); } - m_CurrentResolution = QString("%1@%2").arg(match.captured(1)).arg(curRate); + if (Common::specialComType == 5) { + m_CurrentResolution = QString("%1").arg(QT_REGEXP_CAPTURE(reScreenSize, 1, main)); + } else { + m_CurrentResolution = QString("%1@%2").arg(QT_REGEXP_CAPTURE(reScreenSize, 1, main)).arg(curRate); + } } else { qCDebug(appLog) << "Rate is empty, setting current resolution without rate"; m_CurrentResolution = QString("%1").arg(match.captured(1)); From ddc9934cc902b3b0a5d12ce3fdca7db053c9a293 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 9 Dec 2024 09:54:16 +0800 Subject: [PATCH 3/5] fix: get the network of usb vender info get the network of usb vender info pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/ed96373b99604dec0f468fe88e359a0f6ddcfc27#diff-8ba3fd1d07a76dcb2459fa1da1130f8418497c40c3eca23c297f84e9e1426521 Log: get the network of usb vender info Task: https://pms.uniontech.com/task-view-368603.html --- .../src/DeviceManager/DeviceInfo.cpp | 24 +++++++++++++- .../src/DeviceManager/DeviceInfo.h | 8 +++++ .../src/DeviceManager/DeviceNetwork.cpp | 32 ++++--------------- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp index 995a9aa6..67be41cb 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.cpp @@ -785,6 +785,28 @@ const QString DeviceBaseInfo::getVendorOrModelId(const QString &sysPath, bool fl return vendor.trimmed(); } +void DeviceBaseInfo::setVendorNameBylsusbLspci(const QString &vidpid, const QString &modalias) +{ + if (!vidpid.isEmpty() && modalias.contains("usb")) { + QProcess process; + QString vendorId = vidpid.toLower().remove("0x").trimmed().left(4); + QString deviceId = vidpid.toLower().remove("0x").trimmed().right(4); + process.start("lsusb -v -d " + vendorId + ":" + deviceId); + process.waitForFinished(-1); + + QString output = process.readAllStandardOutput(); + + foreach (QString out, output.split("\n")) { + // 从USB设备获取制造商和设备名称 + if (out.contains("idVendor", Qt::CaseSensitive)) { + m_Vendor = out.remove(0, out.indexOf(vendorId) + 4).trimmed(); + } else if (out.contains("idProduct", Qt::CaseSensitive)) { + m_Name = out.remove(0, out.indexOf(deviceId) + 4).trimmed(); + } + } + } +} + const QString DeviceBaseInfo::getDriverVersion() { qCDebug(appLog) << "DeviceBaseInfo::getDriverVersion called."; @@ -1464,4 +1486,4 @@ void DeviceBaseInfo::generatorTranslate() << tr("Type") \ << tr("Vendor") \ << tr("Processor"); -} \ No newline at end of file +} diff --git a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h index a1cc20a3..bd975caa 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceInfo.h +++ b/deepin-devicemanager/src/DeviceManager/DeviceInfo.h @@ -224,6 +224,14 @@ class DeviceBaseInfo : public QObject */ const QString getVendorOrModelId(const QString &sysPath, bool flag = true); + /** + * @brief setVendorNameBylsusbLspci:获取Vendor 和 Name + * @param vidpid 属性vidpid + * @param modalias + * @return + */ + void setVendorNameBylsusbLspci(const QString &vidpid, const QString &modalias); + /** * @brief get_string:读取文件内信息 * @param path:文件绝对路径+名称 diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp index 4df63873..55e7af0c 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp @@ -55,30 +55,8 @@ void DeviceNetwork::setInfoFromLshw(const QMap &mapInfo) setAttribute(mapInfo, "description", m_Model); setAttribute(mapInfo, "product", m_Name); setAttribute(mapInfo, "vendor", m_Vendor); - if (m_SysPath.contains("usb")) { - qCDebug(appLog) << "DeviceNetwork::setInfoFromLshw, sysPath contains usb"; - QProcess process; - QString vendorId = getVendorOrModelId(m_SysPath, true).trimmed(); - QString deviceId = getVendorOrModelId(m_SysPath, false).trimmed(); - process.start("lsusb -v -d " + vendorId + ":" + deviceId); - process.waitForFinished(-1); - - QString output = process.readAllStandardOutput(); - - foreach (QString out, output.split("\n")) { - if (!m_Vendor.isEmpty() && !m_Name.isEmpty()) - break; - // 从USB设备获取制造商和设备名称 - if (m_Vendor.isEmpty() && out.contains("idVendor", Qt::CaseSensitive)) { - m_Vendor = out.remove(0, out.indexOf(vendorId) + 4).trimmed(); - } else if (m_Name.isEmpty() && out.contains("idProduct", Qt::CaseSensitive)) { - m_Name = out.remove(0, out.indexOf(deviceId) + 4).trimmed(); - } - } - } else { - qCDebug(appLog) << "DeviceNetwork::setInfoFromLshw, sysPath not contains usb"; - setAttribute(mapInfo, "description", m_Name, false); - } + setAttribute(mapInfo, "description", m_Name); + setAttribute(mapInfo, "version", m_Version); setAttribute(mapInfo, "bus info", m_BusInfo); setAttribute(mapInfo, "logical name", m_LogicalName); @@ -169,6 +147,7 @@ bool DeviceNetwork::setInfoFromHwinfo(const QMap &mapInfo) } qCDebug(appLog) << "DeviceNetwork::setInfoFromHwinfo, mapInfo not contains path"; setAttribute(mapInfo, "Device", m_Name); + setAttribute(mapInfo, "Vendor", m_Vendor); setAttribute(mapInfo, "Device File", m_LogicalName); setAttribute(mapInfo, "HW Address", m_MACAddress); setAttribute(mapInfo, "Permanent HW Address", m_UniqueID); @@ -178,6 +157,9 @@ bool DeviceNetwork::setInfoFromHwinfo(const QMap &mapInfo) setAttribute(mapInfo, "Module Alias", m_Modalias); setAttribute(mapInfo, "VID_PID", m_VID_PID); m_PhysID = m_VID_PID; + if (!m_VID_PID.isEmpty() && m_Modalias.contains("usb")) { + setVendorNameBylsusbLspci(m_VID_PID, m_Modalias); + } if (driverIsKernelIn(m_DriverModules) || driverIsKernelIn(m_Driver)) { qCDebug(appLog) << "DeviceNetwork::setInfoFromHwinfo, driver is kernel in"; @@ -193,8 +175,6 @@ bool DeviceNetwork::setInfoFromHwinfo(const QMap &mapInfo) // 判断是否是无线网卡 setIsWireless(mapInfo["SysFS ID"]); - setHwinfoLshwKey(mapInfo); - return true; } From d202cf750a679ebcf6e011fdf7ff15cefe8a9cc8 Mon Sep 17 00:00:00 2001 From: shuaijie Date: Tue, 10 Dec 2024 14:05:47 +0800 Subject: [PATCH 4/5] fix: [network] add communication network support add communication network support pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/da8e00966728b8d16b4c0aac76f512c822bb5516 Log: add communication network support Bug: https://pms.uniontech.com/task-view-360593.html --- deepin-devicemanager/src/GenerateDevice/CmdTool.cpp | 2 +- deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp index b5558a41..c1af015c 100644 --- a/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp +++ b/deepin-devicemanager/src/GenerateDevice/CmdTool.cpp @@ -383,7 +383,7 @@ void CmdTool::loadLshwInfo(const QString &debugFile) qCDebug(appLog) << "Parsing lshw multimedia info."; getMapInfoFromLshw(item, mapInfo); addMapInfo("lshw_multimedia", mapInfo); - } else if (item.startsWith("network")) { // 网卡信息 + } else if (item.startsWith("network") || item.startsWith("communication")) { // 网卡信息 qCDebug(appLog) << "Parsing lshw network info."; getMapInfoFromLshw(item, mapInfo); addMapInfo("lshw_network", mapInfo); diff --git a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp index b9132679..9ee81c72 100644 --- a/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp +++ b/deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp @@ -296,7 +296,7 @@ void DeviceGenerator::generatorMonitorDevice() bool isValidLogicalName(const QString& logicalName) { - if (logicalName.contains("p2p", Qt::CaseInsensitive)) + if (logicalName.contains("p2p", Qt::CaseInsensitive) || logicalName.isEmpty()) return false; QString addressFilePath = "/sys/class/net/" + logicalName; From 037a669bafd0a80e7af7e39f753db9919ee61b8b Mon Sep 17 00:00:00 2001 From: shuaijie Date: Thu, 12 Dec 2024 10:02:49 +0800 Subject: [PATCH 5/5] fix: [network] add communication network support add communication network support pick from: https://github.com/linuxdeepin/deepin-devicemanager/commit/093ad2adff8439d9ab2d9f962625ec884acb7177 Log: add communication network support Bug: https://pms.uniontech.com/task-view-360593.html --- deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp | 4 ++-- deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp index f401cc7c..42edf72d 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp @@ -430,9 +430,9 @@ bool DeviceMonitor::setMainInfoFromXrandr(const QString &info, const QString &ra curRate = QString::number(ceil(curRate.left(pos).toDouble())) + curRate.right(curRate.size() - pos); } if (Common::specialComType == 5) { - m_CurrentResolution = QString("%1").arg(QT_REGEXP_CAPTURE(reScreenSize, 1, main)); + m_CurrentResolution = QString("%1").arg(QT_REGEXP_CAPTURE(reScreenSize, 1, info)); } else { - m_CurrentResolution = QString("%1@%2").arg(QT_REGEXP_CAPTURE(reScreenSize, 1, main)).arg(curRate); + m_CurrentResolution = QString("%1@%2").arg(QT_REGEXP_CAPTURE(reScreenSize, 1, info)).arg(curRate); } } else { qCDebug(appLog) << "Rate is empty, setting current resolution without rate"; diff --git a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp index 55e7af0c..520868c8 100644 --- a/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp +++ b/deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp @@ -55,7 +55,8 @@ void DeviceNetwork::setInfoFromLshw(const QMap &mapInfo) setAttribute(mapInfo, "description", m_Model); setAttribute(mapInfo, "product", m_Name); setAttribute(mapInfo, "vendor", m_Vendor); - setAttribute(mapInfo, "description", m_Name); + if (m_Name.isEmpty()) + setAttribute(mapInfo, "description", m_Name); setAttribute(mapInfo, "version", m_Version); setAttribute(mapInfo, "bus info", m_BusInfo);