diff --git a/9000-fix-show-256-core-cpuinfo-issue.patch b/9000-fix-show-256-core-cpuinfo-issue.patch new file mode 100644 index 0000000000000000000000000000000000000000..1679f3cccb4941133e558aa00af8ca56a3f6aee2 --- /dev/null +++ b/9000-fix-show-256-core-cpuinfo-issue.patch @@ -0,0 +1,710 @@ +From 72996fcb57b084ab60d0233abb3b348d9032f287 Mon Sep 17 00:00:00 2001 +From: kkz +Date: Mon, 16 Aug 2021 16:46:47 +0800 +Subject: [PATCH] fix-show-256-core-cpuinfo-issue + +--- + .../src/DeviceManager/DeviceCpu.cpp | 2 +- + .../translations/deepin-devicemanager.ts | 213 +++++++++--------- + .../deepin-devicemanager_zh_CN.qm | Bin 33123 -> 33194 bytes + .../deepin-devicemanager_zh_CN.ts | 5 + + 4 files changed, 115 insertions(+), 105 deletions(-) + +diff --git a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp +index bce084f..31b4149 100644 +--- a/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp ++++ b/deepin-devicemanager/src/DeviceManager/DeviceCpu.cpp +@@ -402,7 +402,7 @@ void DeviceCpu::getTrNumber() + m_trNumber.insert(124, QObject::tr("One hundred and Twenty-four")); + m_trNumber.insert(126, QObject::tr("One hundred and Twenty-six")); + m_trNumber.insert(128, QObject::tr("One hundred and Twenty-eight")); +- ++ m_trNumber.insert(256, QObject::tr("Two hundred and Fifty-six")); + } + + +diff --git a/deepin-devicemanager/translations/deepin-devicemanager.ts b/deepin-devicemanager/translations/deepin-devicemanager.ts +index 2730ad4..947eb13 100644 +--- a/deepin-devicemanager/translations/deepin-devicemanager.ts ++++ b/deepin-devicemanager/translations/deepin-devicemanager.ts +@@ -27,13 +27,13 @@ + DetailTreeView + + +- ++ + More + + + + +- ++ + Collapse + + +@@ -285,116 +285,116 @@ + + DeviceCpu + +- +- ++ ++ + Name + + + +- +- ++ ++ + Vendor + + + +- ++ + CPU ID + + + +- ++ + Core ID + + + +- ++ + Threads + + + +- ++ + Current Speed + + + +- ++ + BogoMIPS + + + +- +- ++ ++ + Architecture + + + +- ++ + CPU Family + + + +- ++ + Model + + + +- +- ++ ++ + Processor + + + +- ++ + Core(s) + + + +- ++ + Virtualization + + + +- ++ + Flags + + + +- ++ + Extensions + + + +- ++ + L3 Cache + + + +- ++ + L2 Cache + + + +- ++ + L1i Cache + + + +- ++ + L1d Cache + + + +- ++ + Stepping + + + +- ++ + Speed + + + +- ++ + Max Speed + + +@@ -1540,24 +1540,24 @@ + + + +- +- ++ ++ + Enable + + + +- +- ++ ++ + Disable + + + +- ++ + Failed to disable the device + + + +- ++ + Failed to enable the device + + +@@ -2078,355 +2078,360 @@ + + + +- ++ + CPU implementer + + + +- ++ + CPU architecture + + + +- ++ + CPU variant + + + +- ++ + CPU part + + + +- ++ + CPU revision + + + +- ++ + One + + + +- ++ + Two + + + +- ++ + Four + + + +- ++ + Six + + + +- ++ + Eight + + + +- ++ + Ten + + + +- ++ + Twelve + + + +- ++ + Fourteen + + + +- ++ + Sixteen + + + +- ++ + Eighteen + + + +- ++ + Twenty + + + +- ++ + Twenty-two + + + +- ++ + Twenty-four + + + +- ++ + Twenty-six + + + +- ++ + Twenty-eight + + + +- ++ + Thirty + + + +- ++ + Thirty-two + + + +- ++ + Thirty-four + + + +- ++ + Thirty-six + + + +- ++ + Thirty-eight + + + +- ++ + Forty + + + +- ++ + Forty-two + + + +- ++ + Forty-four + + + +- ++ + Forty-six + + + +- ++ + Forty-eight + + + +- ++ + Fifty + + + +- ++ + Fifty-two + + + +- ++ + Fifty-four + + + +- ++ + Fifty-six + + + +- ++ + Fifty-eight + + + +- ++ + Sixty + + + +- ++ + Sixty-two + + + +- ++ + Sixty-four + + + +- ++ + Sixty-six + + + +- ++ + Sixty-eight + + + +- ++ + Seventy + + + +- ++ + Seventy-two + + + +- ++ + Seventy-four + + + +- ++ + Seventy-six + + + +- ++ + Seventy-eight + + + +- ++ + Eighty + + + +- ++ + Eighty-two + + + +- ++ + Eighty-four + + + +- ++ + Eighty-six + + + +- ++ + Eighty-eight + + + +- ++ + Ninety + + + +- ++ + Ninety-two + + + +- ++ + Ninety-four + + + +- ++ + Ninety-six + + + +- ++ + Ninety-eight + + + +- ++ + One hundred + + + +- ++ + One hundred and Two + + + +- ++ + One hundred and four + + + +- ++ + One hundred and Six + + + +- ++ + One hundred and Eight + + + +- ++ + One hundred and Ten + + + +- ++ + One hundred and Twelve + + + +- ++ + One hundred and Fourteen + + + +- ++ + One hundred and Sixteen + + + +- ++ + One hundred and Eighteen + + + +- ++ + One hundred and Twenty + + + +- ++ + One hundred and Twenty-two + + + +- ++ + One hundred and Twenty-four + + + +- ++ + One hundred and Twenty-six + + + +- ++ + One hundred and Twenty-eight + + ++ ++ ++ Two hundred and Fifty-six ++ ++ + + + GDDR capacity +diff --git a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.qm b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.qm +index b33553414c6fc6156c386f22dbeba3e5cb40c7e5..af83992c22b616f5595cf1a80f4ac5bc577ae6e0 100644 +GIT binary patch +delta 947 +zcmWlXe@sswj1#OSe@wX;q{*0#*3p#!gKwsln4aWidFIodfSM*>da@8G-X(u|{crAC +zK<&!I>%&6+x?=zcpO%+9n6`9_eB&;w-J#33Mk3tgFik0);s?sJo|J-_v|@cj^5jv- +zRv^Y{)Rt3tT(+u55gZAuA +z;Y{09MS+Z#$w8%YRa}MzJ8T{vFF>pcC|OkhBkdgSz3~q +zqEan8#h;*Fj9&(FUsLC1e+G8Hr(Wq;;5E(DA-?o6jcTXFzf>06;uzD^E`1RNr;O#eYcn{ZS&7@5B%X5(09nQk2SvlOr!p@qt +z{+m4SoY@$;2DmHCrYIXw^SSAJjJq^cn5`e~0Crw5JNFK80!nG#@oJL4$o%czA}`); +z{{GWtPWng?XnUMKd+Pp)-uT42N9^uMN4I;RvZNwpV6vzM1?d@%E%kAZMk{f)X)&x7CJOWg>~puq{Y87$bgxCFt;rLb8moWxfEJ#+^?m&&hMn^Z);z +z|CJ``{xRwEWuoYG%7QTaG+_$SNa>Q#`!cKv0fc*?{PhU<_yKHkJFvSG+DsY{^Y+E0 +z2C=?!5l1d}165ueU-KG}lZLiGLVzcPi4N|Ut;L;h;y~0-DY8%8q-?p^U6GKYUlsz@ +zZt1h(DWJ5Cy5)e_MU%3}n{TOovmeOxSX%M{lzS}S{#FjG9xd1> +zw-2@fb=B0Xn4*Xh${}%)vTc{7syUjmwMyY9bin?)*iXIofcTK6?Ph+Sa%t}^7T{N| +zo=pdKK2@&2(gg&sDL14a*vx`5aFhuZ`IUiVL15c9WuVE==L^d4$e%p-gfdm1_=&=5 +zKpdo#YCzp@yK;gzR=q<@#BDHRDE`Xokb2)ud_$|NTH-kBj!}&JXn|O)Rx#~ +z$!Qu-@}opmd_fy!S=(@fDy=~_T!QAjJ4%0{VM%aX#kX<7>k +zi85S1agIW+97oOXNniaO;pZ;XdDkx@jiP!Z2V_RiO>NYQ&+zZLaI6dk9*WRGa3>Etx2c8Z=QXGy!~DAVwH`(5*0OTZ4B>+klfoZ5GFoZ88CrEb2& +zSR!vzz2Py=>D#;FyslRNC_2yK`Gk56({SrG-!ZB!xAa5R9gIq$N#j$q{JH+`^9d$d +gs6Tu#%HT`)FpVV|bFb(-=}rmL?5k$q;@)e<|Mj2@jQ{`u + +diff --git a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts +index 9b99cf0..37a4cfe 100644 +--- a/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts ++++ b/deepin-devicemanager/translations/deepin-devicemanager_zh_CN.ts +@@ -2425,6 +2425,11 @@ + One hundred and Twenty-eight + 一百二十八 + ++ ++ ++ Two hundred and Fifty-six ++ 二百五十六 ++ + + + GDDR capacity +-- +2.20.1 + diff --git a/9001-fix-can-not-distinguish-hdd-issue.patch b/9001-fix-can-not-distinguish-hdd-issue.patch new file mode 100644 index 0000000000000000000000000000000000000000..bae971f0bbcfa4c91930f8f0e17ddf60a34a1755 --- /dev/null +++ b/9001-fix-can-not-distinguish-hdd-issue.patch @@ -0,0 +1,720 @@ +From 4cb65600d76de933733283f08ea6bc98b3a9ce44 Mon Sep 17 00:00:00 2001 +From: root +Date: Thu, 2 Sep 2021 15:15:19 +0800 +Subject: [PATCH] fix can not distinguish hdd issue + +--- + .../src/LoadInfo/ThreadPool.cpp | 123 +----------------- + .../src/UsbDetect/DetectJob.cpp | 72 ---------- + .../src/UsbDetect/DetectJob.h | 59 --------- + .../src/UsbDetect/DetectThread.cpp | 102 ++++++++++++++- + .../src/UsbDetect/DetectThread.h | 18 ++- + .../src/UsbDetect/MonitorUsb.cpp | 6 +- + .../src/DeviceManager/DeviceBluetooth.cpp | 2 +- + deepin-devicemanager/src/LoadInfo/CmdTool.cpp | 110 +++++++++++++--- + deepin-devicemanager/src/LoadInfo/CmdTool.h | 28 ++++ + .../src/ThreadPool/ReadFilePool.cpp | 10 +- + 10 files changed, 248 insertions(+), 282 deletions(-) + delete mode 100644 deepin-devicemanager-server/src/UsbDetect/DetectJob.cpp + delete mode 100644 deepin-devicemanager-server/src/UsbDetect/DetectJob.h + +diff --git a/deepin-devicemanager-server/src/LoadInfo/ThreadPool.cpp b/deepin-devicemanager-server/src/LoadInfo/ThreadPool.cpp +index 73680f8..370482d 100644 +--- a/deepin-devicemanager-server/src/LoadInfo/ThreadPool.cpp ++++ b/deepin-devicemanager-server/src/LoadInfo/ThreadPool.cpp +@@ -45,21 +45,6 @@ void ThreadPool::updateDeviceFile() + + void ThreadPool::initCmd() + { +- // According to Huawei's requirements , Modify the way of judging klu and panguv +- // 获取华为KLU、PanguV信息 +- Cmd cmdDbus; +- cmdDbus.cmd = QString("%1 %2%3").arg("gdbus introspect -y -d com.deepin.system.SystemInfo -o /com/deepin/system/SystemInfo -p >").arg(PATH).arg("gdbus.txt"); +- cmdDbus.file = "gdbus.txt"; +- cmdDbus.canNotReplace = false; +- m_ListCmd.append(cmdDbus); +- +- // 获取架构信息 +- Cmd cmdUname; +- cmdUname.cmd = QString("%1 %2%3").arg("uname -m > ").arg(PATH).arg("uname_m.txt"); +- cmdUname.file = "uname_m.txt"; +- cmdUname.canNotReplace = false; +- m_ListCmd.append(cmdUname); +- + // 添加lshw命令 + Cmd cmdLshw; + cmdLshw.cmd = QString("%1 %2%3").arg("lshw > ").arg(PATH).arg("lshw.txt"); +@@ -124,70 +109,6 @@ void ThreadPool::initCmd() + cmdDmi17.canNotReplace = true; + m_ListCmd.append(cmdDmi17); + +- // 添加hwinfo --sound命令 +- Cmd cmdHwinfoSound; +- cmdHwinfoSound.cmd = QString("%1 %2%3").arg("hwinfo --sound > ").arg(PATH).arg("hwinfo_sound.txt"); +- cmdHwinfoSound.file = "hwinfo_sound.txt"; +- cmdHwinfoSound.canNotReplace = false; +- m_ListCmd.append(cmdHwinfoSound); +- m_ListUpdate.append(cmdHwinfoSound); +- +- // 添加hwinfo --usb命令 +- Cmd cmdHwinfoUsb; +- cmdHwinfoUsb.cmd = QString("%1 %2%3").arg("hwinfo --usb > ").arg(PATH).arg("hwinfo_usb.txt"); +- cmdHwinfoUsb.file = "hwinfo_usb.txt"; +- cmdHwinfoUsb.canNotReplace = false; +- m_ListCmd.append(cmdHwinfoUsb); +- m_ListUpdate.append(cmdHwinfoUsb); +- +- // 添加hwinfo --network命令 +- Cmd cmdHwinfoNetwork; +- cmdHwinfoNetwork.cmd = QString("%1 %2%3").arg("hwinfo --network > ").arg(PATH).arg("hwinfo_network.txt"); +- cmdHwinfoNetwork.file = "hwinfo_network.txt"; +- cmdHwinfoNetwork.canNotReplace = false; +- m_ListCmd.append(cmdHwinfoNetwork); +- m_ListUpdate.append(cmdHwinfoNetwork); +- +- // 添加hwinfo --keyboard命令 +- Cmd cmdHwinfoKeyboard; +- cmdHwinfoKeyboard.cmd = QString("%1 %2%3").arg("hwinfo --keyboard > ").arg(PATH).arg("hwinfo_keyboard.txt"); +- cmdHwinfoKeyboard.file = "hwinfo_keyboard.txt"; +- cmdHwinfoKeyboard.canNotReplace = false; +- m_ListCmd.append(cmdHwinfoKeyboard); +- m_ListUpdate.append(cmdHwinfoKeyboard); +- +- // 添加hwinfo --network命令 +- Cmd cmdHwinfoCdrom; +- cmdHwinfoCdrom.cmd = QString("%1 %2%3").arg("hwinfo --cdrom > ").arg(PATH).arg("hwinfo_cdrom.txt"); +- cmdHwinfoCdrom.file = "hwinfo_cdrom.txt"; +- cmdHwinfoCdrom.canNotReplace = false; +- m_ListCmd.append(cmdHwinfoCdrom); +- m_ListUpdate.append(cmdHwinfoCdrom); +- +- // 添加hwinfo --disk命令 +- Cmd cmdHwinfoDisk; +- cmdHwinfoDisk.cmd = QString("%1 %2%3").arg("hwinfo --disk > ").arg(PATH).arg("hwinfo_disk.txt"); +- cmdHwinfoDisk.file = "hwinfo_disk.txt"; +- cmdHwinfoDisk.canNotReplace = false; +- m_ListCmd.append(cmdHwinfoDisk); +- m_ListUpdate.append(cmdHwinfoDisk); +- +- // 添加hwinfo --display命令 +- Cmd cmdHwinfoDisplay; +- cmdHwinfoDisplay.cmd = QString("%1 %2%3").arg("hwinfo --display > ").arg(PATH).arg("hwinfo_display.txt"); +- cmdHwinfoDisplay.file = "hwinfo_display.txt"; +- cmdHwinfoDisplay.canNotReplace = true; +- m_ListCmd.append(cmdHwinfoDisplay); +- m_ListUpdate.append(cmdHwinfoDisplay); +- +- // 添加hwinfo --mouse命令 +- Cmd cmdHwinfoMouse; +- cmdHwinfoMouse.cmd = QString("%1 %2%3").arg("hwinfo --mouse > ").arg(PATH).arg("hwinfo_mouse.txt"); +- cmdHwinfoMouse.file = "hwinfo_mouse.txt"; +- cmdHwinfoMouse.canNotReplace = false; +- m_ListCmd.append(cmdHwinfoMouse); +- m_ListUpdate.append(cmdHwinfoMouse); +- + // 添加hwinfo --power命令 + Cmd cmdUpower; + cmdUpower.cmd = QString("%1 %2%3").arg("upower --dump > ").arg(PATH).arg("upower_dump.txt"); +@@ -268,42 +189,10 @@ void ThreadPool::initCmd() + cmdLsMod.canNotReplace = true; + m_ListCmd.append(cmdLsMod); + +- // if (info.contains("klu")) { +- // Cmd cmdGpuinfo; +- // cmdGpuinfo.cmd = "gpuinfo"; +- // cmdGpuinfo.file = "gpuinfo.txt"; +- // cmdGpuinfo.canNotReplace = true; +- // m_ListCmd.append(cmdGpuinfo); +- +- // Cmd cmdBootdevice; +- // cmdBootdevice.cmd = "cat /proc/bootdevice/product_name"; +- // cmdBootdevice.file = "bootdevice.txt"; +- // cmdBootdevice.canNotReplace = false; +- // m_ListCmd.append(cmdBootdevice); +- +- // } else if (info.contains("panguV")) { +- // Cmd cmdGpuinfo; +- // cmdGpuinfo.cmd = "gpuinfo"; +- // cmdGpuinfo.file = "gpuinfo.txt"; +- // cmdGpuinfo.canNotReplace = true; +- // m_ListCmd.append(cmdGpuinfo); +- +- // Cmd cmdBootdevice; +- // cmdBootdevice.cmd = "cat /proc/bootdevice/product_name"; +- // cmdBootdevice.file = "bootdevice.txt"; +- // cmdBootdevice.canNotReplace = false; +- // m_ListCmd.append(cmdBootdevice); +- +- // Cmd cmdEdidHdmi; +- // cmdEdidHdmi.cmd = "hexdump /sys/devices/platform/hisi-drm/drm/card0/card0-HDMI-A-1/edid"; +- // cmdEdidHdmi.file = "EDID_HDMI.txt"; +- // cmdEdidHdmi.canNotReplace = false; +- // m_ListCmd.append(cmdEdidHdmi); +- +- // Cmd cmdEdidVGA; +- // cmdEdidVGA.cmd = "hexdump /sys/devices/platform/hisi-drm/drm/card0/card0-VGA-1/edid"; +- // cmdEdidVGA.file = "EDID_VGA.txt"; +- // cmdEdidVGA.canNotReplace = false; +- // m_ListCmd.append(cmdEdidVGA); +- // } ++ Cmd cmdHwinfo; ++ cmdHwinfo.cmd = QString("%1 %2%3").arg("hwinfo --sound --network --keyboard --cdrom --disk --display --mouse --usb > ").arg(PATH).arg("hwinfo.txt"); ++ cmdHwinfo.file = "hwinfo.txt"; ++ cmdHwinfo.canNotReplace = false; ++ m_ListCmd.append(cmdHwinfo); ++ m_ListUpdate.append(cmdHwinfo); + } +diff --git a/deepin-devicemanager-server/src/UsbDetect/DetectJob.cpp b/deepin-devicemanager-server/src/UsbDetect/DetectJob.cpp +deleted file mode 100644 +index cac00e8..0000000 +--- a/deepin-devicemanager-server/src/UsbDetect/DetectJob.cpp ++++ /dev/null +@@ -1,72 +0,0 @@ +-#include "DetectJob.h" +- +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-DetectJob::DetectJob(QObject *parent) +- : QObject(parent) +- , m_LaskTime(QDateTime::currentMSecsSinceEpoch()) +- , m_Elapse(10000) +-{ +- +-} +- +-void DetectJob::working() +-{ +- int sockfd; +- struct sockaddr_nl sa; +- char buf[4096]; +- struct iovec iov; +- struct msghdr msg; +- // int i; +- memset(buf, 0, sizeof(buf)); +- memset(&sa, 0, sizeof(sa)); +- sa.nl_family = AF_NETLINK; +- sa.nl_groups = NETLINK_KOBJECT_UEVENT; +- sa.nl_pid = 0;//getpid(); both is ok +- memset(&msg, 0, sizeof(msg)); +- iov.iov_base = static_cast(buf); +- iov.iov_len = sizeof(buf); +- msg.msg_name = static_cast(&sa); +- msg.msg_namelen = sizeof(sa); +- msg.msg_iov = &iov; +- msg.msg_iovlen = 1; +- +- sockfd = socket(AF_NETLINK/*PF_NETLINK*/, SOCK_RAW, NETLINK_KOBJECT_UEVENT); +- if (sockfd == -1) +- printf("socket creating failed:%s\n", strerror(errno)); +- if (bind(sockfd, reinterpret_cast(&sa), sizeof(sa)) == -1) +- printf("bind error:%s\n", strerror(errno)); +- +- while (true) { +- // len未使用到,但是,这句话不可删除,否则影响USB插拔时,/tmp/device-info的自动属性 +- int len = int(recvmsg(sockfd, &msg, 0)); //MSG_WAITALL +- int midLen = -1; +- QString Buf(buf); +- if (Buf.startsWith("add@/devices/pci")) { +- midLen = 36; +- } else if (Buf.startsWith("remove@/devices/pci")) { +- midLen = 39; +- } +- +- // 过滤部分信息 +- if (midLen == -1) { +- continue; +- } +- +- emit usbChanged(); +- +- memset(buf, 0, sizeof(buf)); +- usleep(m_Elapse); +- } +-} +- +-void DetectJob::setUSleepElapse(unsigned int elapse) +-{ +- m_Elapse = elapse; +-} +diff --git a/deepin-devicemanager-server/src/UsbDetect/DetectJob.h b/deepin-devicemanager-server/src/UsbDetect/DetectJob.h +deleted file mode 100644 +index dc14958..0000000 +--- a/deepin-devicemanager-server/src/UsbDetect/DetectJob.h ++++ /dev/null +@@ -1,59 +0,0 @@ +-/* +-* Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. +-* +-* Author: Jun.Liu +-* +-* Maintainer: XiaoMei.Ji +-* Maintainer: Jun.Liu +-* +-* This program is free software: you can redistribute it and/or modify +-* it under the terms of the GNU General Public License as published by +-* the Free Software Foundation, either version 3 of the License, or +-* any later version. +-* +-* This program is distributed in the hope that it will be useful, +-* but WITHOUT ANY WARRANTY; without even the implied warranty of +-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-* GNU General Public License for more details. +-* +-* You should have received a copy of the GNU General Public License +-* along with this program. If not, see . +-*/ +- +-#ifndef DETECTJOB_H +-#define DETECTJOB_H +- +-#include +- +-/** +- * @brief The DetectJob class +- */ +-class DetectJob : public QObject +-{ +- Q_OBJECT +-public: +- explicit DetectJob(QObject *parent = nullptr); +- +- /** +- * @brief working : main job +- */ +- [[noreturn]]void working(); +- +- /** +- * @brief setUSleepElapse : 设置while循环sleep时间 +- * @param elapse +- */ +- void setUSleepElapse(unsigned int elapse); +- +-signals: +- /** +- * @brief usbChanged +- */ +- void usbChanged(); +- +-private: +- qint64 m_LaskTime; // ++ ++#define LEAST_NUM 10 ++ + DetectThread::DetectThread(QObject *parent) + : QThread(parent) + , mp_MonitorUsb(new MonitorUsb()) + { + // 连接槽函数 +- connect(mp_MonitorUsb, SIGNAL(usbChanged()), this, SIGNAL(usbChanged()), Qt::QueuedConnection); ++ connect(mp_MonitorUsb, SIGNAL(usbChanged()), this, SLOT(slotUsbChanged()), Qt::QueuedConnection); ++ ++ QMap> usbInfo; ++ curHwinfoUsbInfo(usbInfo); ++ updateMemUsbInfo(usbInfo); + } + + void DetectThread::run() +@@ -15,3 +24,94 @@ void DetectThread::run() + mp_MonitorUsb->monitor(); + } + } ++ ++void DetectThread::slotUsbChanged() ++{ ++ // 当监听到新的usb时,内核需要加载usb信息,而上层应用需要在内核处理之后获取信息 ++ // 为了确保缓存信息之前,内核已经处理完毕,先判断内核是否处理完信息,且判断时间不能多于10s ++ qint64 begin = QDateTime::currentMSecsSinceEpoch(); ++ qint64 end = begin; ++ while ((end - begin) <= 10000) { ++ if(isUsbDevicesChanged()) ++ break; ++ sleep(1); ++ end = QDateTime::currentMSecsSinceEpoch(); ++ } ++ qInfo() << " 此次判断插拔是否完成的时间为 ************ " << QDateTime::currentMSecsSinceEpoch() - begin; ++ emit usbChanged(); ++} ++ ++bool DetectThread::isUsbDevicesChanged() ++{ ++ QMap> curUsbInfo; ++ curHwinfoUsbInfo(curUsbInfo); ++ ++ // 拔出的时候,如果当前的usb设备个数小于m_MapUsbInfo的个数则返回true ++ if(curUsbInfo.size() < m_MapUsbInfo.size()){ ++ updateMemUsbInfo(curUsbInfo); ++ return true; ++ } ++ ++ // 数量一样或curUsbInfo的大小大于m_MapUsbInfo的大小,则一个一个的比较 ++ // 如果curUsbInfo里面的在m_MapUsbInfo里面找不到则说明内核信息还没有处理完 ++ foreach(const QString& key,curUsbInfo.keys()){ ++ if(m_MapUsbInfo.find(key) != m_MapUsbInfo.end()) ++ continue; ++ if(curUsbInfo[key]["Hardware Class"] == "disk" ++ && curUsbInfo[key].find("Capacity") == curUsbInfo[key].end()) ++ continue; ++ updateMemUsbInfo(curUsbInfo); ++ return true; ++ } ++ return false; ++} ++ ++void DetectThread::updateMemUsbInfo(const QMap>& usbInfo) ++{ ++ m_MapUsbInfo.clear(); ++ m_MapUsbInfo = usbInfo; ++} ++ ++void DetectThread::curHwinfoUsbInfo(QMap>& usbInfo) ++{ ++ QProcess process; ++ process.start("hwinfo --usb"); ++ process.waitForFinished(-1); ++ QString info = process.readAllStandardOutput(); ++ ++ QStringList items = info.split("\n\n"); ++ foreach(const QString& item,items){ ++ QMap mapItem; ++ if(!getMapInfo(item,mapItem)) ++ continue; ++ usbInfo.insert(mapItem["SysFS BusID"],mapItem); ++ } ++} ++ ++bool DetectThread::getMapInfo(const QString& item,QMap& mapInfo) ++{ ++ QStringList lines = item.split("\n"); ++ // 行数太少则为无用信息 ++ if(lines.size() <= LEAST_NUM){ ++ return false; ++ } ++ ++ foreach(const QString& line,lines){ ++ QStringList words = line.split(": "); ++ if(words.size() != 2) ++ continue; ++ mapInfo.insert(words[0].trimmed(),words[1].trimmed()); ++ } ++ ++ // hub为usb接口,可以直接过滤 ++ if(mapInfo["Hardware Class"] == "hub"){ ++ return false; ++ } ++ ++ // 没有总线信息的设备可以过滤 ++ if(mapInfo.find("SysFS BusID") == mapInfo.end()){ ++ return false; ++ } ++ ++ return true; ++} +diff --git a/deepin-devicemanager-server/src/UsbDetect/DetectThread.h b/deepin-devicemanager-server/src/UsbDetect/DetectThread.h +index b5fe5a9..f5f5b7c 100644 +--- a/deepin-devicemanager-server/src/UsbDetect/DetectThread.h ++++ b/deepin-devicemanager-server/src/UsbDetect/DetectThread.h +@@ -23,6 +23,8 @@ + #define DETECTTHREAD_H + + #include ++#include ++#include + + class MonitorUsb; + +@@ -46,8 +48,22 @@ signals: + */ + void usbChanged(); + ++private slots: ++ /** ++ * @brief slotUsbChanged usb发生变化时的曹函数处理 ++ */ ++ void slotUsbChanged(); ++ ++private: ++ // 判断hwinfo --usb信息是否发生变化 ++ bool isUsbDevicesChanged(); ++ void updateMemUsbInfo(const QMap>& usbInfo); ++ void curHwinfoUsbInfo(QMap>& usbInfo); ++ bool getMapInfo(const QString& item,QMap& mapInfo); ++ + private: +- MonitorUsb *mp_MonitorUsb; //> m_MapUsbInfo; // &mapInfo) + if (vendor.size() < 1) + return false; + +- if (!m_Vendor.contains(vendor[0])) ++ if (!m_Vendor.isEmpty() && !m_Vendor.contains(vendor[0])) + return false; + + // 获取设备基本信息 +diff --git a/deepin-devicemanager/src/LoadInfo/CmdTool.cpp b/deepin-devicemanager/src/LoadInfo/CmdTool.cpp +index 1dbceca..c9b6d7a 100644 +--- a/deepin-devicemanager/src/LoadInfo/CmdTool.cpp ++++ b/deepin-devicemanager/src/LoadInfo/CmdTool.cpp +@@ -28,7 +28,64 @@ void CmdTool::addMapInfo(const QString &key, const QMap &mapIn + lstMap.append(mapInfo); + m_cmdInfo.insert(key, lstMap); + } ++} ++ ++void CmdTool::addMouseKeyboardInfoMapInfo(const QString &key, const QMap &mapInfo) ++{ ++ if (containsInfoInTheMap("Linux Foundation", mapInfo) // 在服务器版本中发现,hwinfo --mouse 和 hwinfo --keyboard获取的信息里面有多余的无用信息,需要过滤 ++ || containsInfoInTheMap("Elite Remote Control Driver", mapInfo) // 在笔记本中发现了一个多余信息,做特殊处理 Elite Remote Control Driver ++ || containsInfoInTheMap("serial console", mapInfo) // 鲲鹏台式机子上发现一条多余信息 Model: "serial console" ++ || containsInfoInTheMap("Wacom", mapInfo)) { // 数位板信息被显示成了mouse信息,这里需要做特殊处理(搞不懂数位板为什么不能显示成鼠标) ++ return; ++ } ++ addMapInfo(key, mapInfo); ++} ++ ++void CmdTool::addUsbMapInfo(const QString &key, const QMap &mapInfo) ++{ ++ QList>::iterator it = m_cmdInfo["hwinfo_usb"].begin(); ++ // 有的是有同一个设备有两段信息,我们只需要一个 ++ // 比如 SysFS BusID: 1-3:1.2 和 SysFS BusID: 1-3:1.0 这个是同一个设备 ++ // 我们只需要一个 ++ for (; it != m_cmdInfo["hwinfo_usb"].end(); ++it) { ++ QString curBus = (*it)["SysFS BusID"]; ++ QString newBus = mapInfo["SysFS BusID"]; ++ curBus.replace(QRegExp("\\.[0-9]{1,2}$"), ""); ++ newBus.replace(QRegExp("\\.[0-9]{1,2}$"), ""); ++ if (curBus == newBus) { ++ return; ++ } ++ } ++ ++ // 这个是用来过滤,没有接入任何设备的usb接口 ++ if (mapInfo["Model"].contains("Linux Foundation")) ++ return; ++ ++ if (mapInfo["Hardware Class"].contains("hub", Qt::CaseInsensitive)) ++ return; + ++ // 打印机几信息不从hwinfo --usb里面获取,需要过滤 ++ if (containsInfoInTheMap("Printer", mapInfo) || containsInfoInTheMap("LaserJet", mapInfo)) ++ return; ++ ++ // 提前过滤掉键盘鼠标 ++ if (containsInfoInTheMap("mouse", mapInfo) || containsInfoInTheMap("keyboard", mapInfo)) ++ return; ++ ++ // 这里特殊处理数位板信息,通过hwinfo --mouse可以获取到数位板信息,但是根据需求数位板应该在其它设备里面(虽然这很不合理) ++ // 所以这里需要做特殊处理 即 item 里面包含了 Wacom 的 就说明是数位板设备,那就应该添加到其它设备里面 ++ if (containsInfoInTheMap("Wacom", mapInfo)) ++ return; ++ addMapInfo(key, mapInfo); ++} ++ ++bool CmdTool::containsInfoInTheMap(const QString &info, const QMap &mapInfo) ++{ ++ foreach (const QString &key, mapInfo.keys()) { ++ if (mapInfo[key].contains(info, Qt::CaseInsensitive)) ++ return true; ++ } ++ return false; + } + + void CmdTool::getMapInfo(QMap &mapInfo, cups_dest_t *src) +@@ -399,7 +456,6 @@ void CmdTool::loadPrinterInfo() + QMap mapInfo; + dest = dests + i; + getMapInfo(mapInfo, dest); +- + // 这里为了和打印机管理保持一致,做出限制 + if (mapInfo.size() > 10) + addMapInfo("printer", mapInfo); +@@ -409,34 +465,50 @@ void CmdTool::loadPrinterInfo() + + void CmdTool::loadHwinfoInfo(const QString &key, const QString &debugfile) + { +- // 获取文件信息 ++ // 显示屏信息从前台直接获取 + QString deviceInfo; +- if (key == "hwinfo_monitor") ++ if (key == "hwinfo_monitor") { + getDeviceInfoFromCmd(deviceInfo, "hwinfo --monitor"); +- else ++ QStringList items = deviceInfo.split("\n\n"); ++ foreach (const QString &item, items) { ++ if (item.isEmpty()) ++ continue; ++ QMap mapInfo; ++ getMapInfoFromHwinfo(item, mapInfo); ++ addMapInfo(key, mapInfo); ++ } ++ } else { // 处理其它信息 mouse sound keyboard usb display cdrom disk + getDeviceInfo(deviceInfo, debugfile); ++ getMulHwinfoInfo(deviceInfo); ++ } ++} + +- QStringList items = deviceInfo.split("\n\n"); ++void CmdTool::getMulHwinfoInfo(const QString &info) ++{ ++ QStringList items = info.split("\n\n"); + foreach (const QString &item, items) { + if (item.isEmpty()) + continue; +- + QMap mapInfo; + getMapInfoFromHwinfo(item, mapInfo); +- +- // hwinfo --usb 里面有很多的无用信息,需要特殊处理 +- if (key == "hwinfo_usb") { +- loadHwinfoUsbInfo(item, mapInfo); +- } else if (key == "hwinfo_mouse" || key == "hwinfo_keyboard") { +- if (!item.contains("Linux Foundation") && // 在服务器版本中发现,hwinfo --mouse 和 hwinfo --keyboard获取的信息里面有多余的无用信息,需要过滤 +- !item.contains("Elite Remote Control Driver") && // 在笔记本中发现了一个多余信息,做特殊处理 Elite Remote Control Driver +- !item.contains("Model: \"serial console\"") && // 鲲鹏台式机子上发现一条多余信息 Model: "serial console" +- !item.contains("Wacom", Qt::CaseInsensitive)) { // 数位板信息被显示成了mouse信息,这里需要做特殊处理(搞不懂数位板为什么不能显示成鼠标) +- +- addMapInfo(key, mapInfo); +- } ++ if (mapInfo["Hardware Class"] == "sound") { ++ addMapInfo("hwinfo_sound", mapInfo); ++ } else if (mapInfo["Hardware Class"] == "network interface") { ++ addMapInfo("hwinfo_network", mapInfo); ++ } else if (mapInfo["Hardware Class"] == "keyboard") { ++ addMouseKeyboardInfoMapInfo("hwinfo_keyboard", mapInfo); ++ } else if (mapInfo["Hardware Class"] == "mouse") { ++ addMouseKeyboardInfoMapInfo("hwinfo_mouse", mapInfo); ++ } else if (mapInfo["Hardware Class"] == "cdrom") { ++ addMapInfo("hwinfo_cdrom", mapInfo); ++ } else if (mapInfo["Hardware Class"] == "disk") { ++ addMapInfo("hwinfo_disk", mapInfo); ++ } else if (mapInfo["Hardware Class"] == "graphics card") { ++ if (mapInfo["Device"].contains("Graphics Processing Unit")) ++ continue; ++ addMapInfo("hwinfo_display", mapInfo); + } else { +- addMapInfo(key, mapInfo); ++ addUsbMapInfo("hwinfo_usb", mapInfo); + } + } + } +diff --git a/deepin-devicemanager/src/LoadInfo/CmdTool.h b/deepin-devicemanager/src/LoadInfo/CmdTool.h +index c707762..ff9286f 100644 +--- a/deepin-devicemanager/src/LoadInfo/CmdTool.h ++++ b/deepin-devicemanager/src/LoadInfo/CmdTool.h +@@ -139,6 +139,12 @@ private: + */ + void loadHwinfoInfo(const QString &key, const QString &debugfile); + ++ /** ++ * @brief getMulHwinfoInfo : 解析 hwinfo --sound --network --keyboard --cdrom --disk --display --mouse --usb ++ * @param mapLstMap ++ */ ++ void getMulHwinfoInfo(const QString &info); ++ + /** + * @brief loadHwinfoUsbInfo + * @param item +@@ -319,6 +325,28 @@ private: + */ + void addMapInfo(const QString &key, const QMap &mapInfo); + ++ /** ++ * @brief addMouseKeyboardInfoMapInfo : 添加map信息 ++ * @param key : 与命令对应的关键字 ++ * @param mapInfo : 解析得到的设备信息map ++ */ ++ void addMouseKeyboardInfoMapInfo(const QString &key, const QMap &mapInfo); ++ ++ /** ++ * @brief addUsbMapInfo ++ * @param key ++ * @param mapInfo ++ */ ++ void addUsbMapInfo(const QString &key, const QMap &mapInfo); ++ ++ /** ++ * @brief containsInfoInTheMap 判断一个map里面有一个str ++ * @param info ++ * @param mapInfo ++ * @return ++ */ ++ bool containsInfoInTheMap(const QString &info, const QMap &mapInfo); ++ + /** + * @brief getMapInfo:解析打印机cups第三方库获取的信息 + * @param mapInfo:解析得到的map信息 +diff --git a/deepin-devicemanager/src/ThreadPool/ReadFilePool.cpp b/deepin-devicemanager/src/ThreadPool/ReadFilePool.cpp +index 135d471..b9da564 100644 +--- a/deepin-devicemanager/src/ThreadPool/ReadFilePool.cpp ++++ b/deepin-devicemanager/src/ThreadPool/ReadFilePool.cpp +@@ -85,15 +85,7 @@ void ReadFilePool::initCmd() + m_CmdList.append({"dr_config", "dr_config.txt", ""}); + + m_CmdList.append({ "hwinfo_monitor", "hwinfo_monitor.txt", tr("Loading CD-ROM Info...")}); +- m_CmdList.append({ "hwinfo_sound", "hwinfo_sound.txt", ""}); +- m_CmdList.append({ "hwinfo_usb", "hwinfo_usb.txt", ""}); +- m_CmdList.append({ "hwinfo_network", "hwinfo_network.txt", ""}); +- m_CmdList.append({ "hwinfo_keyboard", "hwinfo_keyboard.txt", tr("Loading Bluetooth Device Info...")}); +- m_CmdList.append({ "hwinfo_cdrom", "hwinfo_cdrom.txt", tr("Loading Image Devices Info...")}); +- // 注意:这里一定要用 sudo hwinfo --disk,因为很多机器只有加上sudo 才能获取硬盘的大小 +- m_CmdList.append({ "hwinfo_disk", "hwinfo_disk.txt", tr("Loading Keyboard Info...")}); +- m_CmdList.append({ "hwinfo_display", "hwinfo_display.txt", ""}); +- m_CmdList.append({ "hwinfo_mouse", "hwinfo_mouse.txt", ""}); ++ m_CmdList.append({ "hwinfo", "hwinfo.txt", ""}); + + + m_CmdList.append({ "upower", "upower_dump.txt", ""}); +-- +2.27.0 + diff --git a/9002-fix-function-virtual.patch b/9002-fix-function-virtual.patch new file mode 100644 index 0000000000000000000000000000000000000000..00b03e1da7234bbbdde8f022045ab319a94e11cc --- /dev/null +++ b/9002-fix-function-virtual.patch @@ -0,0 +1,24 @@ +From 9a5c0031d756fe7329de0fa268ede1a8fb993772 Mon Sep 17 00:00:00 2001 +From: loong ci +Date: Fri, 22 Jul 2022 08:57:06 +0800 +Subject: [PATCH] fix function virtual + +--- + deepin-devicemanager/tests/src/ThreadPool/ut_readfilepool.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/deepin-devicemanager/tests/src/ThreadPool/ut_readfilepool.cpp b/deepin-devicemanager/tests/src/ThreadPool/ut_readfilepool.cpp +index 6928820..7b1fc61 100644 +--- a/deepin-devicemanager/tests/src/ThreadPool/ut_readfilepool.cpp ++++ b/deepin-devicemanager/tests/src/ThreadPool/ut_readfilepool.cpp +@@ -70,6 +70,6 @@ void ut_ThreadPool_start() + TEST_F(ReadFilePool_UT, ReadFilePool_UT_readAllFile) + { + Stub stub; +- stub.set(ADDR(QThreadPool, start), ut_ThreadPool_start); ++ stub.set((void (QThreadPool::*)(QRunnable *, int))ADDR(QThreadPool, start), ut_ThreadPool_start); + m_readFilePool->readAllFile(); + } +-- +2.20.1 + diff --git a/deepin-devicemanager-5.5.9.36.tar.gz b/deepin-devicemanager-5.5.9.36.tar.gz deleted file mode 100644 index 2868377ef0c2c8c0925921f11f4d6ea03b6946cc..0000000000000000000000000000000000000000 Binary files a/deepin-devicemanager-5.5.9.36.tar.gz and /dev/null differ diff --git a/deepin-devicemanager-5.6.9.tar.gz b/deepin-devicemanager-5.6.9.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..4464ac7a07c139097d7125f106ae06d4086d16c7 Binary files /dev/null and b/deepin-devicemanager-5.6.9.tar.gz differ diff --git a/deepin-devicemanager.spec b/deepin-devicemanager.spec index 46c785c76811cf282c3141086656eb54b9d68c15..9703bee11293be39134ed88eb4790e1a0cf0ad9f 100644 --- a/deepin-devicemanager.spec +++ b/deepin-devicemanager.spec @@ -1,24 +1,35 @@ +%define specrelease 3%{?dist} +%if 0%{?openeuler} +%define specrelease 1 +%endif + Name: deepin-devicemanager -Version: 5.5.9.36 -Release: 3 +Version: 5.6.9 +Release: %{specrelease} Summary: Device Manager is a handy tool for viewing hardware information and managing the devices License: GPLv3+ URL: https://github.com/linuxdeepin/deepin-devicemanager Source0: %{name}-%{version}.tar.gz -Patch0: fix-no-open.patch +Patch9000: 9000-fix-show-256-core-cpuinfo-issue.patch +Patch9001: 9001-fix-can-not-distinguish-hdd-issue.patch +Patch9002: 9002-fix-function-virtual.patch BuildRequires: gcc-c++ BuildRequires: cmake3 -BuildRequires: dtkcore-devel BuildRequires: dtkwidget-devel +BuildRequires: dtkgui-devel BuildRequires: systemd-devel BuildRequires: libicu-devel BuildRequires: qt5-rpm-macros BuildRequires: qt5-qtbase-devel +BuildRequires: qt5-qtbase-private-devel BuildRequires: qt5-qttools-devel BuildRequires: cups-devel BuildRequires: pkgconfig(dframeworkdbus) -BuildRequires: qt5-qtbase-private-devel +BuildRequires: zeromq-devel +BuildRequires: git +BuildRequires: gtest-devel +BuildRequires: gmock-devel Requires: smartmontools @@ -35,7 +46,10 @@ Requires: util-linux %{summary}. %prep -%autosetup -p1 +%setup -q +git apply %{PATCH9000} +git apply %{PATCH9001} +git apply %{PATCH9002} %build # help find (and prefer) qt5 utilities, e.g. qmake, lrelease @@ -50,17 +64,26 @@ popd %install %make_install -C build INSTALL_ROOT="%buildroot" +%post +systemctl enable deepin-devicemanager-server.service + + %files %doc README.md %license LICENSE %{_bindir}/%{name} -%{_bindir}/%{name}-authenticateProxy %{_datadir}/applications/%{name}.desktop %{_datadir}/%{name}/translations/*.qm %{_datadir}/icons/hicolor/scalable/apps/%{name}.svg -%{_datadir}/polkit-1/actions/*.policy +/lib/systemd/system/deepin-devicemanager-server.service +%{_bindir}/deepin-devicemanager-server +%{_datadir}/deepin-manual/manual-assets/application/deepin-devicemanager/device-manager/* +/etc/dbus-1/system.d/com.deepin.devicemanager.conf %changelog +* Mon Jul 18 2022 konglidong 5.6.9-1 +- update to 5.6.9 + * Fri Mar 11 2022 liweigang - 5.5.9.36-3 - fix not open @@ -75,4 +98,3 @@ popd * Thu Jul 30 2020 openEuler Buildteam - 5.5.4.4-1 - Package init - diff --git a/fix-no-open.patch b/fix-no-open.patch deleted file mode 100644 index 142de618cc993160cfd88ff6991427b6e632fe22..0000000000000000000000000000000000000000 --- a/fix-no-open.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/deepin-devicemanager/src/ThreadPool/ThreadPool.cpp b/deepin-devicemanager/src/ThreadPool/ThreadPool.cpp -index 7337b56..7de5391 100644 ---- a/deepin-devicemanager/src/ThreadPool/ThreadPool.cpp -+++ b/deepin-devicemanager/src/ThreadPool/ThreadPool.cpp -@@ -178,11 +178,11 @@ void ThreadPool::loadCmdInfo() - getCmdList(lstCmd, m_Arch); - QList::iterator it = lstCmd.begin(); - -- QObjectCleanupHandler *cleaner = new QObjectCleanupHandler; -- cleaner->setParent(this); -+ //QObjectCleanupHandler *cleaner = new QObjectCleanupHandler; -+ //cleaner->setParent(this); - for (; it != lstCmd.end(); ++it) { - CmdTask *task = new CmdTask((*it)[0], (*it)[1], (*it)[2], (*it)[3], this); -- cleaner->add(task); -+ //cleaner->add(task); - start(task); - task->setAutoDelete(true); - }