Skip to content
Open
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
1,073 changes: 1,073 additions & 0 deletions deepin-devicemanager/3rdparty/ediddecode/ediddecode.cpp

Large diffs are not rendered by default.

552 changes: 552 additions & 0 deletions deepin-devicemanager/3rdparty/ediddecode/ediddecode.h

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions deepin-devicemanager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ foreach(dir ${dirs})
endforeach()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/docx)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/QtXlsxWriter/include/QtXlsx)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ediddecode)

#add cups and zmq
include_directories("/usr/include/cups/")
Expand Down
2 changes: 1 addition & 1 deletion deepin-devicemanager/assets/org.deepin.devicemanager.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"flags": ["global"],
"name": "Special Computer Type",
"name[zh_CN]": "特殊机器类型",
"description": "special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4),PGUX(value:5)",
Copy link
Contributor

Choose a reason for hiding this comment

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

-1, 有问题,==

"description": "special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4),PGUX(value:5),M009(value:6)",
"permissions": "readwrite",
"visibility": "private"
}
Expand Down
1 change: 1 addition & 0 deletions deepin-devicemanager/src/DeviceManager/DeviceAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ void DeviceAudio::loadBaseDeviceInfo()
// 添加基本信息
addBaseDeviceInfo(tr("Name"), m_Name);
addBaseDeviceInfo(tr("Vendor"), m_Vendor);
addBaseDeviceInfo(tr("Module Alias"), m_Modalias);
addBaseDeviceInfo(tr("SysFS_Path"), m_SysPath);
addBaseDeviceInfo(tr("Description"), m_Description);
addBaseDeviceInfo(tr("Revision"), m_Version);
Expand Down
1 change: 1 addition & 0 deletions deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void DeviceBluetooth::setInfoFromHciconfig(const QMap<QString, QString> &mapInfo
// 获取设备的基本信息
setAttribute(mapInfo, "Name", m_Name);
setAttribute(mapInfo, "Manufacturer", m_Vendor);
setAttribute(mapInfo, "Modalias", m_Modalias);

// 获取设备其他信息
getOtherMapInfo(mapInfo);
Expand Down
1 change: 1 addition & 0 deletions deepin-devicemanager/src/DeviceManager/DeviceMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ void DeviceMonitor::setInfoFromEdid(const QMap<QString, QString> &mapInfo)
setAttribute(mapInfo, "Date", m_ProductionWeek);
setAttribute(mapInfo, "Display Input", m_DisplayInput);
setAttribute(mapInfo, "Model", m_Model);
if(m_Model.isEmpty()) m_Model = m_Name ;
getOtherMapInfo(mapInfo);
}

Expand Down
3 changes: 2 additions & 1 deletion deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ void DeviceNetwork::setInfoFromLshw(const QMap<QString, QString> &mapInfo)
{
if (!matchToLshw(mapInfo)
&& Common::boardVendorType() != "KLVV" && Common::boardVendorType() != "KLVU"
&& Common::boardVendorType() != "PGUW" && Common::boardVendorType() != "PGUV") {
&& Common::boardVendorType() != "PGUW" && Common::boardVendorType() != "PGUV"
&& Common::boardVendorType() != "M009") {
return;
}
// 设置由lshw获取的信息
Expand Down
3 changes: 3 additions & 0 deletions deepin-devicemanager/src/GenerateDevice/DeviceFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "KLUGenerator.h"
#include "PanguGenerator.h"
#include "PanguVGenerator.h"
#include "M009Generator.h"
#include "HWGenerator.h"
#include "KLVGenerator.h"
#include "commonfunction.h"
Expand Down Expand Up @@ -42,6 +43,8 @@ DeviceGenerator *DeviceFactory::getDeviceGenerator()
generator = new KLVGenerator();
else if (type == "PGUV" || type == "PGUW")
generator = new PanguVGenerator();
else if (type == "M009")
generator = new M009Generator();
else if (type == "KLVU")
generator = new KLUGenerator();
else if (type == "PGUX")
Expand Down
55 changes: 2 additions & 53 deletions deepin-devicemanager/src/GenerateDevice/DeviceGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "DeviceManager/DevicePrint.h"
#include "DeviceManager/DeviceInput.h"
#include "MacroDefinition.h"
#include "commontools.h"

// Dtk头文件
#include <DSysInfo>
Expand Down Expand Up @@ -86,58 +87,6 @@ void DeviceGenerator::generatorComputerDevice()
DeviceManager::instance()->addComputerDevice(device);
}

void mergeSortCpuInfoByLogicalID(QList<QMap<QString, QString> > &lsCpu, QList<QMap<QString, QString> > &tmpLst, int begin, int end)
{
// 合并列表
int left_length = (end - begin + 1) / 2;
int left_index = begin;
int right_index = begin + left_length;
int result_index = begin;

// 合并左右区间 左区间未合并结束且右区间未合并结束时
while (left_index < begin + left_length && right_index < end + 1) {
// 左右区间,哪个小先排哪个,下标加1
if (lsCpu[left_index]["processor"].toInt() <= lsCpu[right_index]["processor"].toInt())
tmpLst[result_index++] = lsCpu[left_index++];
else
tmpLst[result_index++] = lsCpu[right_index++];
}

// 合并左区间剩余数据
while (left_index < begin + left_length)
tmpLst[result_index++] = lsCpu[left_index++];

// 合并右区间剩余数据
while (right_index < end + 1)
tmpLst[result_index++] = lsCpu[right_index++];
}

void sortCpuInfoByLogicalID(QList<QMap<QString, QString> > &lsCpu, QList<QMap<QString, QString> > &tmpLst, int begin, int end)
{
// 列表个数为1,直接返回
if (0 == end - begin)
return;

// bug 后台获取CPU信息是按照物理CPU,核心,逻辑CPU顺序获取的
// 界面上展示顺序混乱实际是按照物理CPU,核心,逻辑CPU顺序展示
// 与产品沟通后,按照用户的使用感修改,CPU信息按照逻辑CPU的id从小到大显示
// 区间个数为2
if (1 == end - begin) {
// 前 processor > 后 processor 时交换位置
if (lsCpu[begin]["processor"].toInt() > lsCpu[end]["processor"].toInt()) {
QMap<QString, QString> tmpMap = lsCpu[begin];
lsCpu[begin] = lsCpu[end];
lsCpu[end] = tmpMap;
}
} else {
// 区间个数 > 2 递归
sortCpuInfoByLogicalID(lsCpu, tmpLst, begin, (end - begin) / 2 + begin);
sortCpuInfoByLogicalID(lsCpu, tmpLst, (end - begin + 1) / 2 + begin, end);
mergeSortCpuInfoByLogicalID(lsCpu, tmpLst, begin, end);
lsCpu = tmpLst;
}
}

void DeviceGenerator::generatorCpuDevice()
{
// 生成CPU
Expand All @@ -150,7 +99,7 @@ void DeviceGenerator::generatorCpuDevice()

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

// get info from lshw
const QList<QMap<QString, QString> > &lshwCpu = DeviceManager::instance()->cmdInfo("lshw_cpu");
Expand Down
16 changes: 15 additions & 1 deletion deepin-devicemanager/src/GenerateDevice/HWGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "DeviceManager/DeviceBluetooth.h"
#include "DeviceManager/DeviceNetwork.h"
#include "DeviceManager/DeviceMemory.h"
#include "commonfunction.h"

HWGenerator::HWGenerator()
{
Expand Down Expand Up @@ -115,7 +116,9 @@ void HWGenerator::generatorGpuDevice()
QStringList items = deviceInfo.split("\n");

QMap<QString, QString> mapInfo;
for (QString itemStr : items) {
if(Common::boardVendorType() == "M009")
mapInfo.insert("Name", "PANGU M900");
else for (QString itemStr : items) {
if (itemStr.contains(":"))
continue;
QString curItemStr = itemStr.trimmed();
Expand Down Expand Up @@ -266,6 +269,17 @@ void HWGenerator::getDiskInfoFromLshw()

DeviceManager::instance()->addLshwinfoIntoStorageDevice(tempMap);
}
// lshw -C storage
if(Common::boardVendorType() != "M009")
return;
const QList<QMap<QString, QString>> &lstStorage = DeviceManager::instance()->cmdInfo("lshw_storage");
QList<QMap<QString, QString> >::const_iterator sIt = lstStorage.begin();
for (; sIt != lstStorage.end(); ++sIt) {
if ((*sIt).size() < 2)
continue;

DeviceManager::instance()->addLshwinfoIntoNVMEStorageDevice(*sIt);
}
}

void HWGenerator::getDiskInfoFromSmartCtl()
Expand Down
Loading