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
10 changes: 10 additions & 0 deletions deepin-devicemanager/assets/org.deepin.devicemanager.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
"permissions": "readwrite",
"visibility": "private"
},
"specialCpuType": {
"value": 0,
"serial": 0,
"flags": ["global"],
"name": "Special Cpu Type",
"name[zh_CN]": "定制CPU类型",
"description": "Special Cpu Type: Unknow cpu type(value:0)",
"permissions": "readwrite",
"visibility": "private"
},
"TomlFilesName": {
"value": "tomlFilesName",
"serial": 0,
Expand Down
7 changes: 7 additions & 0 deletions deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ void DeviceCpu::setInfoFromDmidecode(const QMap<QString, QString> &mapInfo)
// 飞腾架构由于无法通过lscpu获取当前频率,因此需要通过dmidecode获取
setAttribute(mapInfo, "Current Speed", m_CurFrequency, false);
setAttribute(mapInfo, "Family", m_Familly, false);
// 特殊机型,通过 dmidecode 获取最大加速频率
if (Common::curCpuType == Common::kSpecialCpuType1)
setAttribute(mapInfo, "Max Speed", m_MaxBoostClock);

// 获取其他cpu信息
getOtherMapInfo(mapInfo);
Expand Down Expand Up @@ -300,6 +303,8 @@ void DeviceCpu::loadTableHeader()
m_TableHeader.append("Name");
m_TableHeader.append("Vendor");
m_TableHeader.append(frequencyIsRange() ? ("Frequency") : ("Max Frequency"));
if (Common::curCpuType == Common::kSpecialCpuType1)
m_TableHeader.append(tr("Max Boost Clock"));
m_TableHeader.append("Architecture");
}

Expand All @@ -309,6 +314,8 @@ void DeviceCpu::loadTableData()
m_TableData.append(m_Name);
m_TableData.append(m_Vendor);
m_TableData.append(m_Frequency);
if (Common::curCpuType == Common::kSpecialCpuType1)
m_TableData.append(m_MaxBoostClock);
m_TableData.append(m_Architecture);
}

Expand Down
3 changes: 3 additions & 0 deletions deepin-devicemanager/src/DeviceManager/DeviceCpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ class DeviceCpu : public DeviceBaseInfo
bool m_FrequencyIsCur; //<! 频率显示是当前还是最大值

QMap<int, QString> m_trNumber;

// 特殊机型定制,显示最大加速频率
QString m_MaxBoostClock; // 最大加速频率(睿频)
};

#endif // DEVICECPU_H
1 change: 1 addition & 0 deletions deepin-devicemanager/src/commonfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static QMap<QString, QString> mapArch = {
static bool initBoardVendorFlag = false;
static QString boardVendorKey = "";
int Common::specialComType = -1;
Common::SpecialCpuType Common::curCpuType = Common::SpecialCpuType::kUnknowCpuType;
static QString tomlFilesName = "tomlFilesName";
QString Common::getArch()
{
Expand Down
7 changes: 7 additions & 0 deletions deepin-devicemanager/src/commonfunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ class Common
kSpecialType7,
kCustomType
};

enum SpecialCpuType {
kUnknowCpuType = 0,
Copy link

Choose a reason for hiding this comment

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

issue (typo): Fix the spelling of kUnknowCpuType to kUnknownCpuType for clarity.

If you rename this enum value, make sure all references are updated consistently, including the initialization in commonfunction.cpp.

Suggested implementation:

    enum SpecialCpuType {
        kUnknownCpuType = 0,
        kSpecialCpuType1
    };

You should also:

  1. Search in deepin-devicemanager/src (especially commonfunction.cpp) for all occurrences of kUnknowCpuType and rename them to kUnknownCpuType.
  2. Rebuild to ensure there are no remaining references to the old identifier.

kSpecialCpuType1
};

static QString getArch();

static QString getArchStore();
Expand All @@ -45,6 +51,7 @@ class Common
* special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4)
*/
static int specialComType;
static SpecialCpuType curCpuType;

static QByteArray executeClientCmd(const QString& cmd, const QStringList& args = QStringList(), const QString& workPath = QString(), int msecsWaiting = 30000);
};
Expand Down
17 changes: 9 additions & 8 deletions deepin-devicemanager/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,15 @@ int main(int argc, char *argv[])
//需要查询是否支持特殊机型静音恢复,例如hw机型
DConfig *dconfig = DConfig::create("org.deepin.devicemanager","org.deepin.devicemanager");
//需要判断Dconfig文件是否合法
if(dconfig && dconfig->isValid() && dconfig->keyList().contains("specialComType")){
Common::specialComType = dconfig->value("specialComType").toInt();
}
qCInfo(appLog) << "Common::specialComType value is:" << Common::specialComType;

if (dconfig && dconfig->isValid() && dconfig->keyList().contains("TomlFilesName")) {
QString tomlFilesName = dconfig->value("TomlFilesName").toString();
Common::tomlFilesNameSet(tomlFilesName);
if(dconfig && dconfig->isValid()) {
if (dconfig->keyList().contains("specialComType"))
Common::specialComType = dconfig->value("specialComType").toInt();
if (dconfig->keyList().contains("TomlFilesName")) {
QString tomlFilesName = dconfig->value("TomlFilesName").toString();
Common::tomlFilesNameSet(tomlFilesName);
}
if (dconfig->keyList().contains("specialCpuType"))
Common::curCpuType = static_cast<Common::SpecialCpuType>(dconfig->value("specialCpuType").toInt());
}

// 特殊机型,提前缓存GPU信息
Expand Down