disklayout() added device (/dev/sda...) linux, mac
This commit is contained in:
+13
-4
@@ -666,8 +666,14 @@ function diskLayout(callback) {
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
let interfaceType = device.tran ? device.tran.toUpperCase().trim() : '';
|
||||
if (interfaceType === 'NVME') {
|
||||
mediumType = '2';
|
||||
interfaceType = 'PCIe'
|
||||
}
|
||||
result.push({
|
||||
type: (mediumType === '0' ? 'SSD' : (mediumType === '1' ? 'HD' : (device.model && device.model.indexOf('SSD') > -1 ? 'SSD' : 'HD'))),
|
||||
device: BSDName,
|
||||
type: (mediumType === '0' ? 'SSD' : (mediumType === '1' ? 'HD' : (mediumType === '2' ? 'NVMe' : (device.model && device.model.indexOf('SSD') > -1 ? 'SSD' : (device.model && device.model.indexOf('NVM') > -1 ? 'NVMe' : 'HD'))))),
|
||||
name: device.model || '',
|
||||
vendor: getVendorFromModel(device.model) || (device.vendor ? device.vendor.trim() : ''),
|
||||
size: device.size || 0,
|
||||
@@ -680,7 +686,7 @@ function diskLayout(callback) {
|
||||
sectorsPerTrack: -1,
|
||||
firmwareRevision: device.rev ? device.rev.trim() : '',
|
||||
serialNum: device.serial ? device.serial.trim() : '',
|
||||
interfaceType: device.tran ? device.tran.trim() : '',
|
||||
interfaceType: interfaceType,
|
||||
smartStatus: 'unknown',
|
||||
BSDName: BSDName
|
||||
});
|
||||
@@ -768,9 +774,10 @@ function diskLayout(callback) {
|
||||
}
|
||||
if (sizeValue) {
|
||||
result.push({
|
||||
device: BSDName,
|
||||
type: mediumType.startsWith('Solid') ? 'SSD' : 'HD',
|
||||
name: util.getValue(lines, 'Model', ':', true).trim(),
|
||||
vendor: '',
|
||||
vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()),
|
||||
size: sizeValue,
|
||||
bytesPerSector: -1,
|
||||
totalCylinders: -1,
|
||||
@@ -808,9 +815,10 @@ function diskLayout(callback) {
|
||||
}
|
||||
if (sizeValue) {
|
||||
result.push({
|
||||
device: BSDName,
|
||||
type: 'NVMe',
|
||||
name: util.getValue(lines, 'Model', ':', true).trim(),
|
||||
vendor: '',
|
||||
vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()),
|
||||
size: sizeValue,
|
||||
bytesPerSector: -1,
|
||||
totalCylinders: -1,
|
||||
@@ -884,6 +892,7 @@ function diskLayout(callback) {
|
||||
const status = util.getValue(lines, 'Status', '=').trim().toLowerCase();
|
||||
if (size) {
|
||||
result.push({
|
||||
device: '',
|
||||
type: device.indexOf('SSD') > -1 ? 'SSD' : 'HD', // just a starting point ... better: MSFT_PhysicalDisk - Media Type ... see below
|
||||
name: util.getValue(lines, 'Caption', '='),
|
||||
vendor: util.getValue(lines, 'Manufacturer', '='),
|
||||
|
||||
Reference in New Issue
Block a user