Skip to content

Commit 652ae46

Browse files
shuaijiedeepin-bot[bot]
authored andcommitted
fix: 部分设备接口信息显示为UFS31
部分UFS设备接口信息显示为UFS31 Log: 部分UFS设备接口信息显示为UFS31 Bug: https://pms.uniontech.com/bug-view-251373.html
1 parent c98a782 commit 652ae46

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

deepin-devicemanager/src/DeviceManager/DeviceStorage.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "commonfunction.h"
88

99
// Qt库文件
10+
#include <QDir>
1011
#include<QDebug>
1112

1213
DeviceStorage::DeviceStorage()
@@ -133,7 +134,18 @@ bool DeviceStorage::setHwinfoInfo(const QMap<QString, QString> &mapInfo)
133134
setAttribute(mapInfo, "Device File", m_DeviceFile);
134135

135136
// 专有文件
136-
QString Path = "/sys/block" + m_DeviceFile.replace("/dev", "") + "/device/spec_version";
137+
QString logicalName = ((QString)mapInfo["SysFS ID"]).replace("/class/block", "");
138+
139+
QDir blockDir("/sys/block/");
140+
QStringList blockfs = blockDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Readable);
141+
foreach (QString fsname, blockfs) {
142+
if (m_DeviceFile.contains(fsname, Qt::CaseInsensitive)) {
143+
logicalName = fsname;
144+
break;
145+
}
146+
}
147+
148+
QString Path = "/sys/block/" + logicalName + "/device/spec_version";
137149
QFile file(Path);
138150
if (file.open(QIODevice::ReadOnly)) {
139151
QString output2 = file.readAll();

0 commit comments

Comments
 (0)