Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ void DeviceBluetooth::setInfoFromHciconfig(const QMap<QString, QString> &mapInfo
{
qCDebug(appLog) << "DeviceBluetooth::setInfoFromHciconfig started.";
// 获取设备的基本信息
setAttribute(mapInfo, "Name", m_Name);
setAttribute(mapInfo, "Name", m_Name, false);
setAttribute(mapInfo, "Alias", m_Alias);
setAttribute(mapInfo, "Manufacturer", m_Vendor);
setAttribute(mapInfo, "HCI Version", m_Version, true);
qCDebug(appLog) << "Basic attributes set from Hciconfig.";

// 获取设备其他信息
Expand Down
7 changes: 5 additions & 2 deletions deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,13 @@ void DeviceGenerator::generatorCpuDevice()
logicalNum_dmi += dd4["Thread Count"].toInt();
}
}
if(coreNum_dmi > coreNum && coreNum_dmi <= 512) { //due to offline policy
// If obtaining data from /proc/cpuinfo is incorrect, refer to the content of dmidecode.
if (logicalNum != logicalNum_dmi)
Comment on lines +225 to +227
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Reconsider using logicalNum != logicalNum_dmi instead of a directional comparison to gate coreNum updates.

The previous behavior updated coreNum from DMI whenever coreNum_dmi > coreNum && coreNum_dmi <= 512, independent of logical CPU counts. Now the update is gated on logicalNum != logicalNum_dmi, which also triggers when logicalNum_dmi < logicalNum. In that case, you’d override coreNum from DMI while still trusting /proc for logicalNum, mixing sources asymmetrically. If the goal is to fix undercounting in /proc/cpuinfo, consider restricting this to logicalNum_dmi > logicalNum && logicalNum_dmi < 1024 (aligned with the later logical update) or otherwise making the comparison direction explicit.

coreNum = coreNum_dmi;
}
if(logicalNum_dmi > logicalNum && logicalNum_dmi < 1024) //due to offline policy
logicalNum = logicalNum_dmi;
if(coreNum_dmi > coreNum && coreNum_dmi <= 512) //due to offline policy
coreNum = coreNum_dmi;

DeviceManager::instance()->setCpuNum(allCPUS.isEmpty() ? dmidecode4.size() : allCPUS.size());
qCDebug(appLog) << "DeviceGenerator::generatorCpuDevice set cpu num" << (allCPUS.isEmpty() ? dmidecode4.size() : allCPUS.size());
Expand Down