bugfix diskLayout().size

This commit is contained in:
Sebastian Hildebrandt 2017-11-16 17:42:28 +01:00
parent 5274144998
commit c7a99346d8
2 changed files with 5 additions and 3 deletions

View File

@ -99,6 +99,7 @@ Other changes
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | -------------- | -------------- | -------- |
| 3.33.6 | 2017-11-16 | bugfix diskLayout().size |
| 3.33.5 | 2017-11-09 | code cleanup | | 3.33.5 | 2017-11-09 | code cleanup |
| 3.33.4 | 2017-11-09 | bugfix graphics controller win (bytes) | | 3.33.4 | 2017-11-09 | bugfix graphics controller win (bytes) |
| 3.33.3 | 2017-11-08 | bugfix cpu speed arm - type | | 3.33.3 | 2017-11-08 | bugfix cpu speed arm - type |

View File

@ -583,13 +583,14 @@ function diskLayout(callback) {
} catch (e) { } catch (e) {
} }
const size = util.getValue(lines, 'size', ':', true).trim(); const sizeString = util.getValue(lines, 'size', ':', true).trim();
if (size && lines.length > 0 && lines[0].trim() === 'disk') { const sizeValue = sizeString.match(/\(([^)]+)\)/)[1];
if (sizeString && lines.length > 0 && lines[0].trim() === 'disk') {
result.push({ result.push({
type: (mediumType === '0' ? 'SSD' : (mediumType === '1' ? 'HD' : (device.indexOf('SSD') > -1 ? 'SSD' : 'HD'))), // to be tested ... /sys/block/sda/queue/rotational type: (mediumType === '0' ? 'SSD' : (mediumType === '1' ? 'HD' : (device.indexOf('SSD') > -1 ? 'SSD' : 'HD'))), // to be tested ... /sys/block/sda/queue/rotational
name: util.getValue(lines, 'product:', ':', true), name: util.getValue(lines, 'product:', ':', true),
vendor: util.getValue(lines, 'vendor:', ':', true), vendor: util.getValue(lines, 'vendor:', ':', true),
size: parseInt(size.match(/\(([^)]+)\)/)[1]) * 1000 * 1000 * 1000 * 1000, size: parseInt(sizeValue, 10) * 1000 * 1000 * 1000 * (sizeValue.indexOf('T') >= 0 ? 1000 : 1),
bytesPerSector: -1, bytesPerSector: -1,
totalCylinders: -1, totalCylinders: -1,
totalHeads: -1, totalHeads: -1,