Skip to content

Commit

Permalink
feat: add PanguX for deepin-devicemanager
Browse files Browse the repository at this point in the history
add PanguX for deepin-devicemanager

Log:  add PanguX for deepin-devicemanager
  • Loading branch information
shuaijie authored and deepin-bot[bot] committed Jan 31, 2024
1 parent 379f3ef commit 98c45e9
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 2 deletions.
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 @@ -8,7 +8,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)",
"description": "special computer type:PGUW(value:1),KLVV/L540(value:2),KLVU(value:3),PGUV/W585(value:4),PGUX(value:5)",
"permissions": "readwrite",
"visibility": "private"
}
Expand Down
4 changes: 4 additions & 0 deletions deepin-devicemanager/src/DeviceManager/DeviceBluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ TomlFixMethod DeviceBluetooth::setInfoFromTomlOneByOne(const QMap<QString, QStri
TomlFixMethod ret = TOML_None;
// 添加基本信息
ret = setTomlAttribute(mapInfo, "Model", m_Model);
ret = setTomlAttribute(mapInfo, "Name", m_Name);
ret = setTomlAttribute(mapInfo, "Vendor", m_Vendor);
ret = setTomlAttribute(mapInfo, "Version", m_Version);

// 添加其他信息,成员变量
ret = setTomlAttribute(mapInfo, "Speed", m_Speed);
ret = setTomlAttribute(mapInfo, "Maximum Power", m_MaximumPower);
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 @@ -13,6 +13,7 @@
#include "HWGenerator.h"
#include "KLVGenerator.h"
#include "commonfunction.h"
#include "PanguxGenerator.h"

// Qt库文件
#include <QProcess>
Expand Down Expand Up @@ -43,6 +44,8 @@ DeviceGenerator *DeviceFactory::getDeviceGenerator()
generator = new PanguVGenerator();
else if (type == "KLVU")
generator = new KLUGenerator();
else if (type == "PGUX")
generator = new PanguXGenerator();
else
generator = new HWGenerator();
} else
Expand Down
65 changes: 65 additions & 0 deletions deepin-devicemanager/src/GenerateDevice/PanguxGenerator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

// 项目自身文件
#include "PanguxGenerator.h"

// 其它头文件

#include "../DeviceManager/DeviceAudio.h"
#include "../DeviceManager/DeviceBluetooth.h"


PanguXGenerator::PanguXGenerator()
{

}

void PanguXGenerator::getAudioInfoFromCatAudio()
{
QMap<QString, QString> tempMap;
tempMap["Name"] = "OnBoard Audio";
tempMap["Vendor"]= "HUAWEI";
DeviceAudio *device = new DeviceAudio();
device->setCanEnale(false);
device->setCanUninstall(false);
device->setForcedDisplay(true);
device->setInfoFromCatAudio(tempMap);
DeviceManager::instance()->addAudioDevice(device);

getAudioInfoFromHwinfo();
}

void PanguXGenerator::generatorBluetoothDevice()
{
DeviceBluetooth *device0 = new DeviceBluetooth();
QMap<QString, QString> tempMap;
tempMap["Vendor"] = "HISILICON";
tempMap["Name"] = "Hi1105C";
tempMap["Model"] = "Hi1105C";
device0->setCanEnale(false);
device0->setForcedDisplay(true);
device0->setInfoFromTomlOneByOne(tempMap);
DeviceManager::instance()->addBluetoothDevice(device0);

const QList<QMap<QString, QString> > lstMap = DeviceManager::instance()->cmdInfo("hwinfo_usb");
QList<QMap<QString, QString> >::const_iterator it = lstMap.begin();
for (; it != lstMap.end(); ++it) {
if ((*it).size() < 1) {
continue;
}
if ((*it)["Hardware Class"] == "hub" || (*it)["Hardware Class"] == "mouse" || (*it)["Hardware Class"] == "keyboard") {
continue;
}
if ((*it)["Hardware Class"] == "bluetooth" || (*it)["Driver"] == "btusb" || (*it)["Device"] == "BCM20702A0"|| (*it)["Device"].contains("bluetooth", Qt::CaseInsensitive)) {
DeviceBluetooth *device = new DeviceBluetooth();
device->setCanEnale(false);
device->setForcedDisplay(true);
device->setInfoFromHwinfo(*it);
DeviceManager::instance()->addBluetoothDevice(device);

addBusIDFromHwinfo((*it)["SysFS BusID"]);
}
}
}
32 changes: 32 additions & 0 deletions deepin-devicemanager/src/GenerateDevice/PanguxGenerator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2019 ~ 2024 Uniontech Software Technology Co.,Ltd.
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef PANGUXGENERATOR_H
#define PANGUXGENERATOR_H

#include "HWGenerator.h"

/**
* @brief The PanguXGenerator class
* 将获取的设备信息生成设备对象,panguX下的生成器
*/

class PanguXGenerator : public HWGenerator
{
public:
PanguXGenerator();

protected:
/**
* @brief generatorAudioDevice:生成音频适配器
*/
virtual void getAudioInfoFromCatAudio() override;
/**
* @brief generatorBluetoothDevice:生成蓝牙设备
*/
virtual void generatorBluetoothDevice() override;
};

#endif // PANGUXGENERATOR_H
5 changes: 5 additions & 0 deletions deepin-devicemanager/src/commonfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ QString Common::checkBoardVendorFlag()
case PGUV:
boardVendorKey = "PGUV";
break;
case PGUX:
boardVendorKey = "PGUX";
break;
default:
boardVendorKey = "PGUW";
break;
Expand All @@ -131,6 +134,8 @@ QString Common::checkBoardVendorFlag()
boardVendorKey = "PGUV";
} else if (info.contains("PGUW", Qt::CaseInsensitive)) {
boardVendorKey = "PGUW";
} else if (info.contains("PGUX", Qt::CaseInsensitive)) { // /HUAWEI QingYun WXXX PGUX-L5651
boardVendorKey = "PGUX";
}
process.close();

Expand Down
3 changes: 2 additions & 1 deletion deepin-devicemanager/src/commonfunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class Common
PGUW,
KLVV,
KLVU,
PGUV
PGUV,
PGUX
};
static QString getArch();

Expand Down

0 comments on commit 98c45e9

Please sign in to comment.