fixes during raspberry tests

This commit is contained in:
Sebastian Hildebrandt 2021-01-25 11:58:39 +01:00
parent 5fa0dbb059
commit c142bc9645
4 changed files with 14 additions and 6 deletions

View File

@ -704,12 +704,12 @@ function graphics(callback) {
});
}
}
if (lines.length > 1 && lines[1].indexOf('gpu=') >= -1) {
if (lines.length > 1 && stdout.toString().indexOf('gpu=') >= -1) {
result.controllers.push({
vendor: 'Broadcom',
model: 'VideoCore IV',
bus: '',
vram: lines[1].replace('gpu=', ''),
vram: util.getValue(lines, 'gpu', '=').replace('M', ''),
vramDynamic: true
});
}

View File

@ -1023,6 +1023,11 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
const lines = stdout.toString().split('\n');
result.os = util.getValue(lines, 'os').toLowerCase();
result.hardware = util.getValue(lines, 'hardware').toLowerCase();
if (!result.hardware) {
const lines = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
const serial = util.getValue(lines, 'serial');
result.hardware = serial || '';
}
if (callback) {
callback(result);
}

View File

@ -182,7 +182,7 @@ function system(callback) {
const model = util.getValue(lines, 'model:', ':', true);
// reference values: https://elinux.org/RPi_HardwareHistory
// https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
if ((result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2836' || result.model === 'BCM2837') && model.toLowerCase().indexOf('raspberry') >= 0) {
if ((result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2710' || result.model === 'BCM2711' || result.model === 'BCM2836' || result.model === 'BCM2837') && model.toLowerCase().indexOf('raspberry') >= 0) {
const rPIRevision = util.decodePiCpuinfo(lines);
result.model = rPIRevision.model;
result.version = rPIRevision.revisionCode;

View File

@ -425,12 +425,15 @@ function isRaspberry() {
'BCM2708',
'BCM2709',
'BCM2710',
'BCM2711',
'BCM2835',
'BCM2836',
'BCM2837',
'BCM2837B0'
];
let cpuinfo = [];
try {
cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).split('\n');
cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
} catch (e) {
return false;
}
@ -441,11 +444,11 @@ function isRaspberry() {
function isRaspbian() {
let osrelease = [];
try {
osrelease = fs.readFileSync('/etc/os-release', { encoding: 'utf8' }).split('\n');
osrelease = fs.readFileSync('/etc/os-release', { encoding: 'utf8' }).toString().split('\n');
} catch (e) {
return false;
}
const id = getValue(osrelease, 'id');
const id = getValue(osrelease, 'id', '=');
return (id && id.indexOf('raspbian') > -1);
}