Skip to content

Commit 5f30992

Browse files
author
shuaijie
committed
feat: Dconfig适配900机型
Dconfig适配某机型 Log: Dconfig适配某机型 Task: https://pms.uniontech.com/task-view-359661.html
1 parent d5b730e commit 5f30992

18 files changed

Lines changed: 2094 additions & 67 deletions

deepin-devicemanager/3rdparty/ediddecode/ediddecode.cpp

Lines changed: 1111 additions & 0 deletions
Large diffs are not rendered by default.

deepin-devicemanager/3rdparty/ediddecode/ediddecode.h

Lines changed: 552 additions & 0 deletions
Large diffs are not rendered by default.

deepin-devicemanager/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ foreach(dir ${dirs})
9797
endforeach()
9898
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/docx)
9999
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/QtXlsxWriter/include/QtXlsx)
100+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ediddecode)
100101

101102
#add cups and zmq
102103
include_directories("/usr/include/cups/")

deepin-devicemanager/assets/org.deepin.devicemanager.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"flags": ["global"],
2222
"name": "Special Computer Type",
2323
"name[zh_CN]": "特殊机器类型",
24-
"description": "special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4),PGUX(value:5)",
24+
"description": "special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4),PGUX(value:5),M900(value:6)",
2525
"permissions": "readwrite",
2626
"visibility": "private"
2727
}

deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ void DeviceAudio::loadBaseDeviceInfo()
327327
// 添加基本信息
328328
addBaseDeviceInfo(tr("Name"), m_Name);
329329
addBaseDeviceInfo(tr("Vendor"), m_Vendor);
330+
addBaseDeviceInfo(tr("Module Alias"), m_Modalias);
330331
addBaseDeviceInfo(tr("SysFS_Path"), m_SysPath);
331332
addBaseDeviceInfo(tr("Description"), m_Description);
332333
addBaseDeviceInfo(tr("Revision"), m_Version);

deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ void DeviceBluetooth::setInfoFromHciconfig(const QMap<QString, QString> &mapInfo
3333
// 获取设备的基本信息
3434
setAttribute(mapInfo, "Name", m_Name);
3535
setAttribute(mapInfo, "Manufacturer", m_Vendor);
36+
setAttribute(mapInfo, "Modalias", m_Modalias);
3637

3738
// 获取设备其他信息
3839
getOtherMapInfo(mapInfo);

deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ void DeviceMonitor::setInfoFromEdid(const QMap<QString, QString> &mapInfo)
164164
setAttribute(mapInfo, "Date", m_ProductionWeek);
165165
setAttribute(mapInfo, "Display Input", m_DisplayInput);
166166
setAttribute(mapInfo, "Model", m_Model);
167+
if(m_Model.isEmpty()) m_Model = m_Name ;
167168
getOtherMapInfo(mapInfo);
168169
}
169170

deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ void DeviceNetwork::setInfoFromLshw(const QMap<QString, QString> &mapInfo)
4848
{
4949
if (!matchToLshw(mapInfo)
5050
&& Common::boardVendorType() != "KLVV" && Common::boardVendorType() != "KLVU"
51-
&& Common::boardVendorType() != "PGUW" && Common::boardVendorType() != "PGUV") {
51+
&& Common::boardVendorType() != "PGUW" && Common::boardVendorType() != "PGUV"
52+
&& Common::boardVendorType() != "M900") {
5253
return;
5354
}
5455
// 设置由lshw获取的信息

deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "KLUGenerator.h"
1111
#include "PanguGenerator.h"
1212
#include "PanguVGenerator.h"
13+
#include "M900Generator.h"
1314
#include "HWGenerator.h"
1415
#include "KLVGenerator.h"
1516
#include "commonfunction.h"
@@ -42,6 +43,8 @@ DeviceGenerator *DeviceFactory::getDeviceGenerator()
4243
generator = new KLVGenerator();
4344
else if (type == "PGUV" || type == "PGUW")
4445
generator = new PanguVGenerator();
46+
else if (type == "M900")
47+
generator = new M900Generator();
4548
else if (type == "KLVU")
4649
generator = new KLUGenerator();
4750
else if (type == "PGUX")

deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "DeviceManager/DevicePrint.h"
2626
#include "DeviceManager/DeviceInput.h"
2727
#include "MacroDefinition.h"
28+
#include "commontools.h"
2829

2930
// Dtk头文件
3031
#include <DSysInfo>
@@ -86,58 +87,6 @@ void DeviceGenerator::generatorComputerDevice()
8687
DeviceManager::instance()->addComputerDevice(device);
8788
}
8889

89-
void mergeSortCpuInfoByLogicalID(QList<QMap<QString, QString> > &lsCpu, QList<QMap<QString, QString> > &tmpLst, int begin, int end)
90-
{
91-
// 合并列表
92-
int left_length = (end - begin + 1) / 2;
93-
int left_index = begin;
94-
int right_index = begin + left_length;
95-
int result_index = begin;
96-
97-
// 合并左右区间 左区间未合并结束且右区间未合并结束时
98-
while (left_index < begin + left_length && right_index < end + 1) {
99-
// 左右区间,哪个小先排哪个,下标加1
100-
if (lsCpu[left_index]["processor"].toInt() <= lsCpu[right_index]["processor"].toInt())
101-
tmpLst[result_index++] = lsCpu[left_index++];
102-
else
103-
tmpLst[result_index++] = lsCpu[right_index++];
104-
}
105-
106-
// 合并左区间剩余数据
107-
while (left_index < begin + left_length)
108-
tmpLst[result_index++] = lsCpu[left_index++];
109-
110-
// 合并右区间剩余数据
111-
while (right_index < end + 1)
112-
tmpLst[result_index++] = lsCpu[right_index++];
113-
}
114-
115-
void sortCpuInfoByLogicalID(QList<QMap<QString, QString> > &lsCpu, QList<QMap<QString, QString> > &tmpLst, int begin, int end)
116-
{
117-
// 列表个数为1,直接返回
118-
if (0 == end - begin)
119-
return;
120-
121-
// bug 后台获取CPU信息是按照物理CPU,核心,逻辑CPU顺序获取的
122-
// 界面上展示顺序混乱实际是按照物理CPU,核心,逻辑CPU顺序展示
123-
// 与产品沟通后,按照用户的使用感修改,CPU信息按照逻辑CPU的id从小到大显示
124-
// 区间个数为2
125-
if (1 == end - begin) {
126-
// 前 processor > 后 processor 时交换位置
127-
if (lsCpu[begin]["processor"].toInt() > lsCpu[end]["processor"].toInt()) {
128-
QMap<QString, QString> tmpMap = lsCpu[begin];
129-
lsCpu[begin] = lsCpu[end];
130-
lsCpu[end] = tmpMap;
131-
}
132-
} else {
133-
// 区间个数 > 2 递归
134-
sortCpuInfoByLogicalID(lsCpu, tmpLst, begin, (end - begin) / 2 + begin);
135-
sortCpuInfoByLogicalID(lsCpu, tmpLst, (end - begin + 1) / 2 + begin, end);
136-
mergeSortCpuInfoByLogicalID(lsCpu, tmpLst, begin, end);
137-
lsCpu = tmpLst;
138-
}
139-
}
140-
14190
void DeviceGenerator::generatorCpuDevice()
14291
{
14392
// 生成CPU
@@ -150,7 +99,7 @@ void DeviceGenerator::generatorCpuDevice()
15099

151100
// 按照processor id 从小到大排序
152101
if (lsCpu.size() > 1)
153-
sortCpuInfoByLogicalID(srcLst, tmpLst, 0, lsCpu.size() - 1);
102+
CommonTools::sortCpuInfoByLogicalID(srcLst, tmpLst, 0, lsCpu.size() - 1);
154103

155104
// get info from lshw
156105
const QList<QMap<QString, QString> > &lshwCpu = DeviceManager::instance()->cmdInfo("lshw_cpu");

0 commit comments

Comments
 (0)