extended test script, updated docs v5, added USB docs

This commit is contained in:
Sebastian Hildebrandt
2021-01-12 11:19:38 +01:00
parent a10e0f909c
commit bcf9d46f67
30 changed files with 418 additions and 60 deletions
+4 -2
View File
@@ -163,11 +163,13 @@ function inetLatency(host, callback) {
});
}
if (_sunos) {
const params = '-s -a ' + hostSanitized + ' 56 2 | grep avg';
const params = '-s -a ' + hostSanitized + ' 56 2';
const filt = 'avg';
execFile('ping', params.split(' '), { timeout: 3000 }, function (error, stdout) {
let result = null;
if (!error) {
const line = stdout.toString().split('=');
const lines = stdout.toString().split('\n').filter(line => line.indexOf(filt) >= 0).join('\n');
const line = lines.split('=');
if (line.length > 1) {
const parts = line[1].split('/');
if (parts.length > 1) {
+4 -2
View File
@@ -117,6 +117,7 @@ function getDarwinUsbType(name) {
else if (name.indexOf(' hub') >= 0) { result = 'Hub'; }
else if (name.indexOf('mouse') >= 0) { result = 'Mouse'; }
else if (name.indexOf('mic') >= 0) { result = 'Microphone'; }
else if (name.indexOf('removable') >= 0) { result = 'Storage'; }
return result;
}
@@ -140,13 +141,14 @@ function parseDarwinUsb(usb, id) {
lines[i] = lines[i].replace(': No,', ': "No",');
}
const usbObj = JSON.parse(lines.join('\n'));
const removableDrive = usbObj['Built-In'].toLowerCase() !== 'yes' && usbObj['non-removable'].toLowerCase() === 'no';
result.bus = null;
result.deviceId = null;
result.id = usbObj['USB Address'] || null;
result.name = usbObj['kUSBProductString'] || usbObj['USB Product Name'] || null;
result.type = getDarwinUsbType((usbObj['kUSBProductString'] || usbObj['USB Product Name'] || '').toLowerCase());
result.removable = usbObj['Built-In'].toLowerCase() !== 'yes';
result.type = getDarwinUsbType((usbObj['kUSBProductString'] || usbObj['USB Product Name'] || '').toLowerCase() + (removableDrive ? ' removable' : ''));
result.removable = usbObj['non-removable'].toLowerCase() === 'no';
result.vendor = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
result.manufacturer = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
result.maxPower = null;