This commit is contained in:
Sebastian Hildebrandt
2020-03-08 15:43:18 +01:00
11 changed files with 126 additions and 11 deletions
+6
View File
@@ -133,10 +133,16 @@ function graphics(callback) {
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vendor') !== -1) currentController.vendor = parts[1].split('(')[0].trim();
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vram(total)') !== -1) {
currentController.vram = parseInt(parts[1]); // in MB
if (parts[1].toLowerCase().indexOf('gb') !== -1) {
currentController.vram = currentController.vram * 1024;
}
currentController.vramDynamic = false;
}
if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('vram(dynamic,max)') !== -1) {
currentController.vram = parseInt(parts[1]); // in MB
if (parts[1].toLowerCase().indexOf('gb') !== -1) {
currentController.vram = currentController.vram * 1024;
}
currentController.vramDynamic = true;
}
}
+4 -3
View File
@@ -83,9 +83,9 @@ export namespace Systeminformation {
}
interface CpuCurrentSpeedData {
min: string;
max: string;
avg: string;
min: number;
max: number;
avg: number;
cores: number[];
}
@@ -243,6 +243,7 @@ export namespace Systeminformation {
java: string;
gcc: string;
virtualbox: string;
dotnet: string;
}
interface UserData {
+57
View File
@@ -15,6 +15,7 @@
const os = require('os');
const exec = require('child_process').exec;
const execSync = require('child_process').execSync;
const util = require('./util');
let _platform = process.platform;
@@ -314,6 +315,62 @@ function memLayout(callback) {
}
});
}
if (!result.length) {
result.push({
size: os.totalmem(),
bank: '',
type: '',
clockSpeed: 0,
formFactor: '',
partNum: '',
serialNum: '',
voltageConfigured: -1,
voltageMin: -1,
voltageMax: -1,
});
// Try Raspberry PI
try {
let stdout = execSync('cat /proc/cpuinfo 2>/dev/null');
let lines = stdout.toString().split('\n');
let model = util.getValue(lines, 'hardware', ':', true).toUpperCase();
let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
if (model === 'BCM2835' || model === 'BCM2708' || model === 'BCM2709' || model === 'BCM2835' || model === 'BCM2837') {
const clockSpeed = {
'0': 400,
'1': 450,
'2': 450,
'3': 3200
};
result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
result[0].clockSpeed = version && version[4] && version[4] === 'd' ? '500' : result[0].clockSpeed;
result[0].type = 'LPDDR2';
result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type;
result[0].formFactor = 'SoC';
stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null');
lines = stdout.toString().split('\n');
let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
if (freq) {
result.clockSpeed = freq;
}
stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null');
lines = stdout.toString().split('\n');
let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0;
if (voltage) {
result[0].voltageConfigured = voltage;
result[0].voltageMin = voltage;
result[0].voltageMax = voltage;
}
}
} catch (e) {
util.noop();
}
}
if (callback) { callback(result); }
resolve(result);
});
+10 -2
View File
@@ -384,11 +384,12 @@ function versions(callback) {
pip3: '',
java: '',
gcc: '',
virtualbox: ''
virtualbox: '',
dotnet: ''
};
let functionProcessed = (function () {
let totalFunctions = 25;
let totalFunctions = 26;
return function () {
if (--totalFunctions === 0) {
if (callback) {
@@ -694,6 +695,13 @@ function versions(callback) {
}
functionProcessed();
});
exec('dotnet --version 2>&1', function (error, stdout) {
if (!error) {
const dotnet = stdout.toString().split('\n')[0] || '';
result.dotnet = dotnet.trim();
}
functionProcessed();
});
} catch (e) {
if (callback) { callback(result); }
resolve(result);
+3
View File
@@ -260,11 +260,13 @@ function services(srv, callback) {
let srvName = util.getValue(lines, 'Name', '=', true).toLowerCase();
let started = util.getValue(lines, 'Started', '=', true);
let startMode = util.getValue(lines, 'StartMode', '=', true);
let pid = util.getValue(lines, 'ProcessId', '=', true);
if (srv === '*' || srvs.indexOf(srvName) >= 0) {
result.push({
name: srvName,
running: (started === 'TRUE'),
startmode: startMode,
pids: [ pid],
pcpu: 0,
pmem: 0
});
@@ -281,6 +283,7 @@ function services(srv, callback) {
name: srvName,
running: false,
startmode: '',
pids: [],
pcpu: 0,
pmem: 0
});
+4
View File
@@ -100,6 +100,10 @@ function system(callback) {
if (result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2835' || result.model === 'BCM2837') {
// Pi 4
if (['c03112'].indexOf(result.version) >= 0) {
result.model = result.model + ' - Pi 4 Model B';
result.version = result.version + ' - Rev. 1.2';
}
if (['a03111', 'b03111', 'c03111'].indexOf(result.version) >= 0) {
result.model = result.model + ' - Pi 4 Model B';
result.version = result.version + ' - Rev. 1.1';