systeminformation 5.25.5 → 5.25.7

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
@@ -780,16 +780,13 @@ function getCpu() {
780
780
  result.governor = util.getValue(lines, 'governor') || '';
781
781
 
782
782
  // Test Raspberry
783
- if (result.vendor === 'ARM') {
784
- const linesRpi = fs.readFileSync('/proc/cpuinfo').toString().split('\n');
785
- const rPIRevision = util.decodePiCpuinfo(linesRpi);
786
- if (rPIRevision.model.toLowerCase().indexOf('raspberry') >= 0) {
787
- result.family = result.manufacturer;
788
- result.manufacturer = rPIRevision.manufacturer;
789
- result.brand = rPIRevision.processor;
790
- result.revision = rPIRevision.revisionCode;
791
- result.socket = 'SOC';
792
- }
783
+ if (result.vendor === 'ARM' && util.isRaspberry()) {
784
+ const rPIRevision = util.decodePiCpuinfo();
785
+ result.family = result.manufacturer;
786
+ result.manufacturer = rPIRevision.manufacturer;
787
+ result.brand = rPIRevision.processor;
788
+ result.revision = rPIRevision.revisionCode;
789
+ result.socket = 'SOC';
793
790
  }
794
791
 
795
792
  // Test RISC-V
package/lib/memory.js CHANGED
@@ -401,10 +401,9 @@ function memLayout(callback) {
401
401
  try {
402
402
  let stdout = execSync('cat /proc/cpuinfo 2>/dev/null', util.execOptsLinux);
403
403
  let lines = stdout.toString().split('\n');
404
- let model = util.getValue(lines, 'hardware', ':', true).toUpperCase();
405
404
  let version = util.getValue(lines, 'revision', ':', true).toLowerCase();
406
405
 
407
- if (model === 'BCM2835' || model === 'BCM2708' || model === 'BCM2709' || model === 'BCM2835' || model === 'BCM2837') {
406
+ if (util.isRaspberry(lines)) {
408
407
 
409
408
  const clockSpeed = {
410
409
  '0': 400,
package/lib/system.js CHANGED
@@ -189,7 +189,7 @@ function system(callback) {
189
189
  const model = util.getValue(lines, 'model:', ':', true);
190
190
  // reference values: https://elinux.org/RPi_HardwareHistory
191
191
  // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
192
- 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) {
192
+ if (util.isRaspberry(lines)) {
193
193
  const rPIRevision = util.decodePiCpuinfo(lines);
194
194
  result.model = rPIRevision.model;
195
195
  result.version = rPIRevision.revisionCode;
@@ -504,23 +504,14 @@ function baseboard(callback) {
504
504
  result.memSlots = util.toInt(util.getValue(lines, 'Number Of Devices')) || null;
505
505
 
506
506
  // raspberry
507
- let linesRpi = '';
508
- try {
509
- linesRpi = fs.readFileSync('/proc/cpuinfo').toString().split('\n');
510
- } catch (e) {
511
- util.noop();
512
- }
513
- if (linesRpi) {
514
- const hardware = util.getValue(linesRpi, 'hardware');
515
- if (hardware.startsWith('BCM')) {
516
- const rpi = util.decodePiCpuinfo(linesRpi);
517
- result.manufacturer = rpi.manufacturer;
518
- result.model = 'Raspberry Pi';
519
- result.serial = rpi.serial;
520
- result.version = rpi.type + ' - ' + rpi.revision;
521
- result.memMax = os.totalmem();
522
- result.memSlots = 0;
523
- }
507
+ if (util.isRaspberry()) {
508
+ const rpi = util.decodePiCpuinfo();
509
+ result.manufacturer = rpi.manufacturer;
510
+ result.model = 'Raspberry Pi';
511
+ result.serial = rpi.serial;
512
+ result.version = rpi.type + ' - ' + rpi.revision;
513
+ result.memMax = os.totalmem();
514
+ result.memSlots = 0;
524
515
  }
525
516
 
526
517
  if (callback) { callback(result); }
package/lib/util.js CHANGED
@@ -635,7 +635,7 @@ function smartMonToolsInstalled() {
635
635
  return _smartMonToolsInstalled;
636
636
  }
637
637
 
638
- function isRaspberry() {
638
+ function isRaspberry(cpuinfo) {
639
639
  const PI_MODEL_NO = [
640
640
  'BCM2708',
641
641
  'BCM2709',
@@ -647,11 +647,9 @@ function isRaspberry() {
647
647
  'BCM2837',
648
648
  'BCM2837B0'
649
649
  ];
650
- let cpuinfo = [];
651
-
652
650
  if (_rpi_cpuinfo !== null) {
653
651
  cpuinfo = _rpi_cpuinfo;
654
- } else {
652
+ } else if (cpuinfo === undefined) {
655
653
  try {
656
654
  cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
657
655
  _rpi_cpuinfo = cpuinfo;
@@ -661,7 +659,8 @@ function isRaspberry() {
661
659
  }
662
660
 
663
661
  const hardware = getValue(cpuinfo, 'hardware');
664
- return (hardware && PI_MODEL_NO.indexOf(hardware) > -1);
662
+ const model = getValue(cpuinfo, 'model');
663
+ return ((hardware && PI_MODEL_NO.indexOf(hardware) > -1) || (model && model.indexOf('Raspberry Pi') > -1));
665
664
  }
666
665
 
667
666
  function isRaspbian() {
@@ -883,6 +882,8 @@ function decodePiCpuinfo(lines) {
883
882
 
884
883
  if (_rpi_cpuinfo === null) {
885
884
  _rpi_cpuinfo = lines;
885
+ } else if (lines === undefined) {
886
+ lines = _rpi_cpuinfo;
886
887
  }
887
888
 
888
889
  // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.25.5",
3
+ "version": "5.25.7",
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)",