Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/sfdisk/sfdiskbackend.cpp
Context not available. | |||||
167 | 167 | | |||
---|---|---|---|---|---|
168 | if ( d == nullptr && modelCommand.run(-1) && modelCommand.exitCode() == 0 ) | 168 | if ( d == nullptr && modelCommand.run(-1) && modelCommand.exitCode() == 0 ) | ||
169 | { | 169 | { | ||
170 | QString modelName = modelCommand.output(); | 170 | QString name = modelCommand.output(); | ||
171 | modelName = modelName.left(modelName.length() - 1); | 171 | name = name.left(name.length() - 1); | ||
172 | | ||||
173 | if (name.trimmed().isEmpty()) { | ||||
174 | // Get 'lsblk --output kname' in the cases where the model name is not available. | ||||
175 | // As lsblk doesn't have an option to include a separator in its output, it is | ||||
176 | // necessary to run it again getting only the kname as output. | ||||
177 | ExternalCommand kname(QStringLiteral("lsblk"), {QStringLiteral("--nodeps"), QStringLiteral("--noheadings"), QStringLiteral("--output"), QStringLiteral("kname"), | ||||
178 | deviceNode}); | ||||
179 | | ||||
180 | if (kname.run(-1) && kname.exitCode() == 0) | ||||
181 | name = kname.output(); | ||||
182 | } | ||||
172 | 183 | | |||
173 | Log(Log::Level::information) << xi18nc("@info:status", "Device found: %1", modelName); | 184 | Log(Log::Level::information) << xi18nc("@info:status", "Device found: %1", name); | ||
174 | 185 | | |||
175 | d = new DiskDevice(modelName, deviceNode, 255, 63, deviceSize / logicalSectorSize / 255 / 63, logicalSectorSize); | 186 | d = new DiskDevice(name, deviceNode, 255, 63, deviceSize / logicalSectorSize / 255 / 63, logicalSectorSize); | ||
176 | } | 187 | } | ||
177 | 188 | | |||
178 | if ( d ) | 189 | if ( d ) | ||
Context not available. |