From dbb9fb5dd704869a883d046531388ca3a44d284f Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 16 Oct 2017 09:56:08 +0200 Subject: [PATCH] bugfix graphics() vendor and model parsing linux VGA/3D --- CHANGELOG.md | 1 + lib/graphics.js | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3383258..af06c17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 3.31.2 | 2017-10-16 | bugfix `graphics()` vendor and model parsing linux VGA/3D | | 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.30.6 | 2017-10-05 | updated community profile | diff --git a/lib/graphics.js b/lib/graphics.js index cc60a88..f2907bb 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -119,17 +119,18 @@ function graphics(callback) { function parseLinesLinuxControllers(lines) { let controllers = []; let currentController = {}; - let is_vga = false; + let isGraphicsController = false; for (let i = 0; i < lines.length; i++) { if ('' !== lines[i].trim()) { if (' ' !== lines[i][0] && '\t' !== lines[i][0]) { // first line of new entry let vgapos = lines[i].toLowerCase().indexOf('vga'); - if (vgapos !== -1) { // VGA + let _3dcontrollerpos = lines[i].toLowerCase().indexOf('3d controller'); + if (vgapos !== -1 || _3dcontrollerpos !== -1) { // VGA if (Object.keys(currentController).length > 0) {// already a controller found controllers.push(currentController); currentController = {}; } - is_vga = true; + isGraphicsController = true; let endpos = lines[i].search(/\[[0-9a-f]{4}:[0-9a-f]{4}]|$/); let parts = lines[i].substr(vgapos, endpos - vgapos).split(':'); if (parts.length > 1) { @@ -155,10 +156,10 @@ function graphics(callback) { } } else { - is_vga = false; + isGraphicsController = false; } } - if (is_vga) { // within VGA details + if (isGraphicsController) { // within VGA details let parts = lines[i].split(':'); if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('devicename') !== -1 && parts[0].toLowerCase().indexOf('onboard') !== -1) currentController.bus = 'Onboard'; if (parts.length > 1 && parts[0].replace(/ +/g, "").toLowerCase().indexOf('region') !== -1 && parts[1].toLowerCase().indexOf('memory') !== -1) {