bugfix graphics() vendor and model parsing linux

This commit is contained in:
Sebastian Hildebrandt 2017-10-16 09:50:21 +02:00
parent ad28b165f6
commit fbb614b86b
3 changed files with 18 additions and 8 deletions

View File

@ -98,6 +98,7 @@ Other changes
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | -------------- | -------------- | -------- |
| 3.31.1 | 2017-10-16 | bugfix `graphics()` vendor and model parsing linux |
| 3.31.0 | 2017-10-15 | extended windows support `cpuFlags()` (partially) | | 3.31.0 | 2017-10-15 | extended windows support `cpuFlags()` (partially) |
| 3.30.6 | 2017-10-05 | updated community profile | | 3.30.6 | 2017-10-05 | updated community profile |
| 3.30.5 | 2017-10-05 | bugfix `users()` - parsing values on windows | | 3.30.5 | 2017-10-05 | bugfix `users()` - parsing values on windows |

View File

@ -149,7 +149,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (
| | cache.l1i | X | X | X | L1I (instruction) size | | | cache.l1i | X | X | X | L1I (instruction) size |
| | cache.l2 | X | X | X | L2 size | | | cache.l2 | X | X | X | L2 size |
| | cache.l3 | X | X | X | L3 size | | | cache.l3 | X | X | X | L3 size |
| si.cpuFlags(cb) | : string | X | X | | CPU flags| | si.cpuFlags(cb) | : string | X | X | X | CPU flags|
| si.cpuCache(cb) | {...} | X | X | X | CPU cache sizes | | si.cpuCache(cb) | {...} | X | X | X | CPU cache sizes |
| | l1d | X | X | X | L1D size | | | l1d | X | X | X | L1D size |
| | l1i | X | X | X | L1I size | | | l1i | X | X | X | L1I size |

View File

@ -14,7 +14,6 @@
const os = require('os'); const os = require('os');
const exec = require('child_process').exec; const exec = require('child_process').exec;
const fs = require('fs');
const util = require('./util'); const util = require('./util');
let _platform = os.type(); let _platform = os.type();
@ -22,13 +21,12 @@ let _platform = os.type();
const _linux = (_platform === 'Linux'); const _linux = (_platform === 'Linux');
const _darwin = (_platform === 'Darwin'); const _darwin = (_platform === 'Darwin');
const _windows = (_platform === 'Windows_NT'); const _windows = (_platform === 'Windows_NT');
const NOT_SUPPORTED = 'not supported';
let _resolutionx = 0; let _resolutionx = 0;
let _resolutiony = 0; let _resolutiony = 0;
let _pixeldepth = 0; let _pixeldepth = 0;
function toInt(value) { function toInt(value) {
let result = parseInt(value,10); let result = parseInt(value, 10);
if (isNaN(result)) { if (isNaN(result)) {
result = 0; result = 0;
} }
@ -136,12 +134,23 @@ function graphics(callback) {
let parts = lines[i].substr(vgapos, endpos - vgapos).split(':'); let parts = lines[i].substr(vgapos, endpos - vgapos).split(':');
if (parts.length > 1) { if (parts.length > 1) {
parts[1] = parts[1].trim(); parts[1] = parts[1].trim();
if (parts[1].toLowerCase().indexOf('corporation')) { if (parts[1].toLowerCase().indexOf('corporation') >= 0) {
currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf('corporation') + 11).trim(); currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf('corporation') + 11).trim();
currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf('corporation') + 11, 200).trim().split('(')[0]; currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf('corporation') + 11, 200).trim().split('(')[0];
currentController.bus = ''; currentController.bus = '';
currentController.vram = -1; currentController.vram = -1;
currentController.vramDynamic = false; currentController.vramDynamic = false;
} else if (parts[1].toLowerCase().indexOf(' inc.') >= 0) {
if ((parts[1].match(new RegExp("]", "g")) || []).length > 1) {
currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(']') + 1).trim();
currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(']')+1, 200).trim().split('(')[0];
} else {
currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(' inc.') + 5).trim();
currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(' inc.') + 5, 200).trim().split('(')[0];
}
currentController.bus = '';
currentController.vram = -1;
currentController.vramDynamic = false;
} }
} }
@ -341,7 +350,7 @@ function graphics(callback) {
}); });
}); });
function parseLinesWindowsControllers(sections){ function parseLinesWindowsControllers(sections) {
let controllers = []; let controllers = [];
for (let i in sections) { for (let i in sections) {
if (sections.hasOwnProperty(i)) { if (sections.hasOwnProperty(i)) {
@ -364,7 +373,7 @@ function graphics(callback) {
return controllers; return controllers;
} }
function parseLinesWindowsDisplays(sections){ function parseLinesWindowsDisplays(sections) {
let displays = []; let displays = [];
for (let i in sections) { for (let i in sections) {
if (sections.hasOwnProperty(i)) { if (sections.hasOwnProperty(i)) {