memory(), chassis() optimized for raspberry

This commit is contained in:
Sebastian Hildebrandt 2025-01-09 15:53:28 +01:00
parent 0be9e22f4c
commit daa8419057

View File

@ -885,11 +885,10 @@ function decodePiCpuinfo(lines) {
} else if (lines === null) {
lines = _rpi_cpuinfo;
}
}
// https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
// https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
const oldRevisionCodes = {
const oldRevisionCodes = {
'0002': {
type: 'B',
revision: '1.0',
@ -1009,24 +1008,24 @@ const oldRevisionCodes = {
manufacturer: '512MB Embest',
processor: 'BCM2835'
}
};
};
const processorList = [
const processorList = [
'BCM2835',
'BCM2836',
'BCM2837',
'BCM2711',
'BCM2712',
];
const manufacturerList = [
];
const manufacturerList = [
'Sony UK',
'Egoman',
'Embest',
'Sony Japan',
'Embest',
'Stadium'
];
const typeList = {
];
const typeList = {
'00': 'A',
'01': 'B',
'02': 'A+',
@ -1052,14 +1051,14 @@ const typeList = {
'18': 'CM5',
'19': '500',
'1a': 'CM5 Lite',
};
};
const revisionCode = getValue(lines, 'revision', ':', true);
const model = getValue(lines, 'model:', ':', true);
const serial = getValue(lines, 'serial', ':', true);
const revisionCode = getValue(lines, 'revision', ':', true);
const model = getValue(lines, 'model:', ':', true);
const serial = getValue(lines, 'serial', ':', true);
let result = {};
if ({}.hasOwnProperty.call(oldRevisionCodes, revisionCode)) {
let result = {};
if ({}.hasOwnProperty.call(oldRevisionCodes, revisionCode)) {
// old revision codes
result = {
model,
@ -1072,7 +1071,7 @@ if ({}.hasOwnProperty.call(oldRevisionCodes, revisionCode)) {
revision: oldRevisionCodes[revisionCode].revision,
};
} else {
} else {
// new revision code
const revision = ('00000000' + getValue(lines, 'revision', ':', true).toLowerCase()).substr(-8);
const memSizeCode = parseInt(hex2bin(revision.substr(2, 1)).substr(5, 3), 2) || 0;
@ -1091,8 +1090,8 @@ if ({}.hasOwnProperty.call(oldRevisionCodes, revisionCode)) {
type: {}.hasOwnProperty.call(typeList, typeCode) ? typeList[typeCode] : '',
revision: '1.' + revision.substr(7, 1),
};
}
return result;
}
return result;
}
function getRpiGpu() {