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