Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/sfdisk/sfdiskbackend.cpp
Show First 20 Lines • Show All 163 Lines • ▼ Show 20 Line(s) | 159 | if ((QStringLiteral("/dev/md") + name) == deviceNode) { | |||
---|---|---|---|---|---|
164 | break; | 164 | break; | ||
165 | } | 165 | } | ||
166 | 166 | | |||
167 | } | 167 | } | ||
168 | } | 168 | } | ||
169 | 169 | | |||
170 | if ( d == nullptr && modelCommand.run(-1) && modelCommand.exitCode() == 0 ) | 170 | if ( d == nullptr && modelCommand.run(-1) && modelCommand.exitCode() == 0 ) | ||
171 | { | 171 | { | ||
172 | QString modelName = modelCommand.output(); | 172 | QString name = modelCommand.output(); | ||
173 | modelName = modelName.left(modelName.length() - 1); | 173 | name = name.left(name.length() - 1); | ||
174 | 174 | | |||
175 | Log(Log::Level::information) << xi18nc("@info:status", "Device found: %1", modelName); | 175 | if (name.trimmed().isEmpty()) { | ||
176 | // Get 'lsblk --output kname' in the cases where the model name is not available. | ||||
177 | // As lsblk doesn't have an option to include a separator in its output, it is | ||||
178 | // necessary to run it again getting only the kname as output. | ||||
179 | ExternalCommand kname(QStringLiteral("lsblk"), {QStringLiteral("--nodeps"), QStringLiteral("--noheadings"), QStringLiteral("--output"), QStringLiteral("kname"), | ||||
180 | deviceNode}); | ||||
181 | | ||||
182 | if (kname.run(-1) && kname.exitCode() == 0) | ||||
183 | name = kname.output(); | ||||
184 | } | ||||
185 | | ||||
186 | Log(Log::Level::information) << xi18nc("@info:status", "Device found: %1", name); | ||||
176 | 187 | | |||
177 | d = new DiskDevice(modelName, deviceNode, 255, 63, deviceSize / logicalSectorSize / 255 / 63, logicalSectorSize); | 188 | d = new DiskDevice(name, deviceNode, 255, 63, deviceSize / logicalSectorSize / 255 / 63, logicalSectorSize); | ||
178 | } | 189 | } | ||
179 | 190 | | |||
180 | if ( d ) | 191 | if ( d ) | ||
181 | { | 192 | { | ||
182 | if (jsonCommand.exitCode() != 0) | 193 | if (jsonCommand.exitCode() != 0) | ||
183 | return d; | 194 | return d; | ||
184 | 195 | | |||
185 | const QJsonObject jsonObject = QJsonDocument::fromJson(jsonCommand.rawOutput()).object(); | 196 | const QJsonObject jsonObject = QJsonDocument::fromJson(jsonCommand.rawOutput()).object(); | ||
▲ Show 20 Lines • Show All 331 Lines • Show Last 20 Lines |