bugfix graphics() vendor and model parsing linux VGA/3D

This commit is contained in:
Sebastian Hildebrandt 2017-10-16 09:56:08 +02:00
parent 179dfa6e33
commit dbb9fb5dd7
2 changed files with 7 additions and 5 deletions

View File

@ -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 |

View File

@ -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) {