From bd8f00f26bb2c5b521059682cd6412a2df17cd9e Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Tue, 7 Nov 2017 23:28:47 +0100 Subject: [PATCH] improved bios and main board information --- CHANGELOG.md | 1 + README.md | 20 ++++++++++++++++++-- lib/system.js | 14 ++++++++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7857e86..e66785b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,6 +99,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 3.33.1 | 2017-11-07 | improved bios and main board information | | 3.33.0 | 2017-11-07 | added bios and main board information | | 3.32.4 | 2017-11-02 | AMD cpu base frequencies table also for windows | | 3.32.3 | 2017-11-02 | code cleanup, AMD cpu base frequencies table | diff --git a/README.md b/README.md index 98c18f1..7422b9b 100644 --- a/README.md +++ b/README.md @@ -506,13 +506,29 @@ In some cases we also discovered that `wmic` returned incorrect temperature valu In some cases you need to install the linux `sensors` package to be able to measure temperature e.g. on DEBIAN based systems by running `sudo apt-get install lm-sensors` -#### *: Additional Notes +## *: Additional Notes In `fsStats`, `disksIO` and `networkStats` the results per second values (rx_sec, IOPS, ...) are calculated beginning with the second call of the function. It is determined by calculating the difference of transferred bytes / IOs divided by the time between two calls of the function. -#### Finding new issues +The first time you are calling oe of this functions, you will get -1 for transfer rates. The second time, you should then get statistics based on the time between the two times … + +So basically, if you e.g. need a values for network stats every second, your code should look like this: + +```js +const si = require('systeminformation'); + +setInterval(function() { + si.networkStats().then(data => { + console.log(data); + }) +}, 1000) +``` + +Beginning with the second call, you get network transfer values per second. + +## Finding new issues I am happy to discuss any comments and suggestions. Please feel free to contact me if you see any possibility of improvement! diff --git a/lib/system.js b/lib/system.js index 713b0fa..43f3268 100644 --- a/lib/system.js +++ b/lib/system.js @@ -222,7 +222,7 @@ function bios(callback) { } if (_windows) { // ToDo: check BIOS windows - exec('wmic bios get BIOSversion, BuildNumber, Caption, Description, IdentificationCode, Manufacturer, Name, ReleaseDate, Version /value', function (error, stdout) { + exec('wmic bios get /value', function (error, stdout) { if (!error) { let lines = stdout.toString().split('\r\n'); const description = util.getValue(lines, 'description', '='); @@ -230,6 +230,10 @@ function bios(callback) { // ... Phoenix ROM BIOS PLUS Version 1.10 A04 result.vendor = description.split(' Version ')[0].trim(); result.version = description.split(' Version ')[1].trim(); + } else if (description.indexOf(' Ver: ') !== -1) { + // ... BIOS Date: 06/27/16 17:50:16 Ver: 1.4.5 + result.vendor = util.getValue(lines, 'manufacturer', '='); + result.version = description.split(' Ver: ')[1].trim(); } else { result.vendor = util.getValue(lines, 'manufacturer', '='); result.version = util.getValue(lines, 'version', '='); @@ -304,15 +308,21 @@ function baseboard(callback) { } if (_windows) { // ToDo: check BIOS windows - exec('wmic baseboard get manufacturer, model, partnumber, product, serialnumber, sku, version /value', function (error, stdout) { + exec('wmic baseboard get /value', function (error, stdout) { if (!error) { let lines = stdout.toString().split('\r\n'); result.manufacturer = util.getValue(lines, 'manufacturer', '='); result.model = util.getValue(lines, 'model', '='); + if (!result.model) { + result.model = util.getValue(lines, 'product', '='); + } result.version = util.getValue(lines, 'version', '='); result.serial = util.getValue(lines, 'serialnumber', '='); result.assetTag = util.getValue(lines, 'partnumber', '='); + if (!result.assetTag) { + result.assetTag = util.getValue(lines, 'sku', '='); + } } if (callback) { callback(result); }