systeminformation 5.25.6 → 5.25.8

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/graphics.js CHANGED
@@ -733,8 +733,8 @@ function graphics(callback) {
733
733
  }
734
734
  if (_linux) {
735
735
  // Raspberry: https://elinux.org/RPI_vcgencmd_usage
736
- if (util.isRaspberry() && util.isRaspbian()) {
737
- let cmd = 'fbset -s | grep \'mode "\'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;';
736
+ if (util.isRaspberry()) {
737
+ let cmd = 'fbset -s 2> /dev/null | grep \'mode "\' ; vcgencmd get_mem gpu 2> /dev/null; tvservice -s 2> /dev/null; tvservice -n 2> /dev/null;';
738
738
  exec(cmd, function (error, stdout) {
739
739
  let lines = stdout.toString().split('\n');
740
740
  if (lines.length > 3 && lines[0].indexOf('mode "') >= -1 && lines[2].indexOf('0x12000a') > -1) {
@@ -759,7 +759,7 @@ function graphics(callback) {
759
759
  });
760
760
  }
761
761
  }
762
- if (lines.length > 1 && stdout.toString().indexOf('gpu=') >= -1) {
762
+ if (lines.length >= 1 && stdout.toString().indexOf('gpu=') >= -1) {
763
763
  result.controllers.push({
764
764
  vendor: 'Broadcom',
765
765
  model: util.getRpiGpu(),
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' || result.model === '') && 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;
@@ -884,6 +882,8 @@ function decodePiCpuinfo(lines) {
884
882
 
885
883
  if (_rpi_cpuinfo === null) {
886
884
  _rpi_cpuinfo = lines;
885
+ } else if (lines === undefined) {
886
+ lines = _rpi_cpuinfo;
887
887
  }
888
888
 
889
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.6",
3
+ "version": "5.25.8",
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)",