systeminformation 5.31.10 → 5.31.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cpu.js CHANGED
@@ -1332,6 +1332,7 @@ function cpuTemperature(callback) {
1332
1332
  };
1333
1333
  if (_linux) {
1334
1334
  // CPU Chipset, Socket
1335
+ let cpuThermal = null;
1335
1336
  try {
1336
1337
  const cmd = 'cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;';
1337
1338
  const parts = execSync(cmd, util.execOptsLinux).toString().split('-----\n');
@@ -1346,6 +1347,10 @@ function cpuTemperature(callback) {
1346
1347
  if (line.startsWith('pch') && lines2[i]) {
1347
1348
  result.chipset = Math.round(parseInt(lines2[i], 10) / 100) / 10;
1348
1349
  }
1350
+ // CPU thermal zone (e.g. cpu-thermal on Raspberry Pi)
1351
+ if (cpuThermal === null && line.indexOf('cpu') !== -1 && lines2[i]) {
1352
+ cpuThermal = Math.round(parseInt(lines2[i], 10) / 100) / 10;
1353
+ }
1349
1354
  }
1350
1355
  }
1351
1356
  } catch (e) {
@@ -1397,34 +1402,42 @@ function cpuTemperature(callback) {
1397
1402
  resolve(result);
1398
1403
  return;
1399
1404
  }
1405
+ if (cpuThermal !== null) {
1406
+ result.main = cpuThermal;
1407
+ result.max = cpuThermal;
1408
+ if (callback) {
1409
+ callback(result);
1410
+ }
1411
+ resolve(result);
1412
+ return;
1413
+ }
1400
1414
  exec('sensors', (error, stdout) => {
1401
1415
  if (!error) {
1402
1416
  const lines = stdout.toString().split('\n');
1403
1417
  let tdieTemp = null;
1418
+ let cpuThermalTemp = null;
1404
1419
  let newSectionStarts = true;
1405
1420
  let section = '';
1421
+
1406
1422
  lines.forEach((line) => {
1407
- // determine section
1423
+ // Section bestimmen
1408
1424
  if (line.trim() === '') {
1409
1425
  newSectionStarts = true;
1410
1426
  } else if (newSectionStarts) {
1411
- if (line.trim().toLowerCase().startsWith('acpi')) {
1412
- section = 'acpi';
1413
- }
1414
- if (line.trim().toLowerCase().startsWith('pch')) {
1415
- section = 'pch';
1416
- }
1417
- if (line.trim().toLowerCase().startsWith('core')) {
1418
- section = 'core';
1419
- }
1420
- if (line.trim().toLowerCase().startsWith('k10temp')) {
1421
- section = 'coreAMD';
1422
- }
1427
+ const s = line.trim().toLowerCase();
1428
+ if (s.startsWith('acpi')) section = 'acpi';
1429
+ else if (s.startsWith('pch')) section = 'pch';
1430
+ else if (s.startsWith('coretemp') || s.startsWith('core')) section = 'core';
1431
+ else if (s.startsWith('k10temp')) section = 'coreAMD';
1432
+ else if (s.startsWith('cpu_thermal') || s.startsWith('cpu-thermal') || s.startsWith('soc_thermal') || s.startsWith('cpu')) section = 'cpuThermal';
1433
+ else section = 'other'; // WICHTIG: unbekannte Blöcke NICHT als CPU behandeln
1423
1434
  newSectionStarts = false;
1424
1435
  }
1436
+
1425
1437
  const regex = /[+-]([^°]*)/g;
1426
1438
  const temps = line.match(regex);
1427
1439
  const firstPart = line.split(':')[0].toUpperCase();
1440
+
1428
1441
  if (section === 'acpi') {
1429
1442
  // socket temp
1430
1443
  if (firstPart.indexOf('TEMP') !== -1) {
@@ -1437,7 +1450,7 @@ function cpuTemperature(callback) {
1437
1450
  }
1438
1451
  }
1439
1452
  // cpu temp
1440
- if (firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1 || (section === 'coreAMD' && firstPart.indexOf('TDIE') !== -1) || firstPart.indexOf('TEMP') !== -1) {
1453
+ if (firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1 || (section === 'coreAMD' && firstPart.indexOf('TDIE') !== -1)) {
1441
1454
  result.main = parseFloat(temps);
1442
1455
  }
1443
1456
  if (firstPart.indexOf('CORE ') !== -1) {
@@ -1446,13 +1459,22 @@ function cpuTemperature(callback) {
1446
1459
  if (firstPart.indexOf('TDIE') !== -1 && tdieTemp === null) {
1447
1460
  tdieTemp = parseFloat(temps);
1448
1461
  }
1462
+
1463
+ // generic temp value from cpuThermal
1464
+ if (section === 'cpuThermal' && firstPart.indexOf('TEMP') !== -1 && cpuThermalTemp === null) {
1465
+ cpuThermalTemp = parseFloat(temps);
1466
+ }
1449
1467
  });
1450
1468
  if (result.cores.length > 0) {
1451
1469
  result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
1452
1470
  const maxtmp = Math.max.apply(Math, result.cores);
1453
1471
  result.max = maxtmp > result.main ? maxtmp : result.main;
1454
1472
  } else {
1455
- if (result.main === null && tdieTemp !== null) {
1473
+ // fallback order: cpu_thermal before tdie
1474
+ if (result.main === null && cpuThermalTemp !== null) {
1475
+ result.main = cpuThermalTemp;
1476
+ result.max = cpuThermalTemp;
1477
+ } else if (result.main === null && tdieTemp !== null) {
1456
1478
  result.main = tdieTemp;
1457
1479
  result.max = tdieTemp;
1458
1480
  }
package/lib/graphics.js CHANGED
@@ -337,9 +337,17 @@ function graphics(callback) {
337
337
  currentController.bus = 'Onboard';
338
338
  }
339
339
  if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('region') !== -1 && parts[1].toLowerCase().indexOf('memory') !== -1) {
340
- let memparts = parts[1].split('=');
341
- if (memparts.length > 1) {
342
- currentController.vram = parseInt(memparts[1]);
340
+ const sizeMatch = parts[1].match(/size=(\d+)([KMG])?/i);
341
+ if (sizeMatch) {
342
+ let vram = parseInt(sizeMatch[1], 10);
343
+ const unit = (sizeMatch[2] || '').toUpperCase();
344
+ if (unit === 'G') { vram *= 1024; }
345
+ else if (unit === 'K') { vram = Math.round(vram / 1024); }
346
+ else if (unit === '') { vram = Math.round(vram / 1024 / 1024); } // bytes
347
+ // keep the largest memory region (the actual framebuffer aperture)
348
+ if (currentController.vram === null || vram > currentController.vram) {
349
+ currentController.vram = vram;
350
+ }
343
351
  }
344
352
  }
345
353
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.31.10",
3
+ "version": "5.31.12",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",