graphics().controllers bugfix linux
This commit is contained in:
parent
e34a0e8a64
commit
85d11129c3
@ -100,6 +100,7 @@ Other changes
|
||||
|
||||
| Version | Date | Comment |
|
||||
| -------------- | -------------- | -------- |
|
||||
| 3.52.4 | 2018-12-27 | `graphics().controllers` bugfix linux |
|
||||
| 3.52.3 | 2018-12-27 | `os().codepage` bugfix |
|
||||
| 3.52.2 | 2018-12-17 | code cleanup |
|
||||
| 3.52.1 | 2018-12-17 | `inetChecksite()` bugfix windows |
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
const exec = require('child_process').exec;
|
||||
const execSync = require('child_process').execSync;
|
||||
const util = require('./util');
|
||||
|
||||
let _platform = process.platform;
|
||||
@ -123,10 +124,24 @@ function graphics(callback) {
|
||||
let controllers = [];
|
||||
let currentController = {};
|
||||
let isGraphicsController = false;
|
||||
// PCI bus IDs
|
||||
let pciIDs = [];
|
||||
try {
|
||||
pciIDs = execSync('dmidecode -t 9 | grep "Bus Address: "').toString().split('\n');
|
||||
for (let i = 0; i < pciIDs.length; i++) {
|
||||
pciIDs[i] = pciIDs[i].replace('Bus Address:', '').replace('0000:', '').trim();
|
||||
}
|
||||
pciIDs = pciIDs.filter(function (el) {
|
||||
return el != null && el;
|
||||
});
|
||||
} catch (e) {
|
||||
util.noop();
|
||||
}
|
||||
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');
|
||||
let isExternal = (pciIDs.indexOf(lines[i].split(' ')[0]) >= 0);
|
||||
let vgapos = lines[i].toLowerCase().indexOf(' vga ');
|
||||
let _3dcontrollerpos = lines[i].toLowerCase().indexOf('3d controller');
|
||||
if (vgapos !== -1 || _3dcontrollerpos !== -1) { // VGA
|
||||
if (_3dcontrollerpos !== -1 && vgapos === -1) {
|
||||
@ -144,20 +159,28 @@ function graphics(callback) {
|
||||
if (parts[1].toLowerCase().indexOf('corporation') >= 0) {
|
||||
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.bus = '';
|
||||
currentController.bus = (pciIDs.length > 0 && isExternal) ? 'PCIe' : 'Onboard';
|
||||
currentController.vram = -1;
|
||||
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];
|
||||
currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(']') + 1, 200).trim().split('(')[0].trim();
|
||||
} 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.model = parts[1].substr(parts[1].toLowerCase().indexOf(' inc.') + 5, 200).trim().split('(')[0].trim();
|
||||
}
|
||||
currentController.bus = '';
|
||||
currentController.bus = (pciIDs.length > 0 && isExternal) ? 'PCIe' : 'Onboard';
|
||||
currentController.vram = -1;
|
||||
currentController.vramDynamic = false;
|
||||
} else if (parts[1].toLowerCase().indexOf(' ltd.') >= 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].trim();
|
||||
} else {
|
||||
currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(' ltd.') + 5).trim();
|
||||
currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(' ltd.') + 5, 200).trim().split('(')[0].trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +190,7 @@ function graphics(callback) {
|
||||
}
|
||||
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('devicename') !== -1 && parts[1].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) {
|
||||
let memparts = parts[1].split('=');
|
||||
if (memparts.length > 1) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user