graphics() add display models (macOS)

This commit is contained in:
Sebastian Hildebrandt 2021-08-26 11:51:26 +02:00
parent a69bdcb5e2
commit 9b83851a2c

View File

@ -56,6 +56,38 @@ const videoTypes = {
'2147483648': 'INTERNAL'
};
function getVendorFromModel(model) {
const diskManufacturers = [
{ pattern: '^LG.+', manufacturer: 'LG' },
{ pattern: '^BENQ.+', manufacturer: 'BenQ' },
{ pattern: '^ASUS.+', manufacturer: 'Asus' },
{ pattern: '^DELL.+', manufacturer: 'Dell' },
{ pattern: '^SAMSUNG.+', manufacturer: 'Samsung' },
{ pattern: '^SONY.+', manufacturer: 'Sony' },
{ pattern: '^ACER.+', manufacturer: 'Acer' },
{ pattern: '^AOC.+', manufacturer: 'AOC Monitors' },
{ pattern: '^HP.+', manufacturer: 'HP' },
{ pattern: '^EIZO.+', manufacturer: 'Eizo' },
{ pattern: '^PHILIPS.+', manufacturer: 'Philips' },
{ pattern: '^IIYAMA.+', manufacturer: 'Iiyama' },
{ pattern: '^SHARP.+', manufacturer: 'Sharp' },
{ pattern: '^NEC.+', manufacturer: 'NEC' },
{ pattern: '^LENOVO.+', manufacturer: 'Lenovo' },
{ pattern: 'COMPAQ.+', manufacturer: 'Compaq' },
{ pattern: 'APPLE.+', manufacturer: 'Apple' },
];
let result = '';
if (model) {
model = model.toUpperCase();
diskManufacturers.forEach((manufacturer) => {
const re = RegExp(manufacturer.pattern);
if (re.test(model)) { result = manufacturer.manufacturer; }
});
}
return result;
}
function graphics(callback) {
function parseLinesDarwin(lines) {
@ -157,7 +189,7 @@ function graphics(callback) {
}
if (3 === level) { // display controller level
if (parts.length > 1 && '' === parts[1]) {
currentDisplay.vendor = '';
currentDisplay.vendor = getVendorFromModel(parts[0].trim());
currentDisplay.model = parts[0].trim();
currentDisplay.main = false;
currentDisplay.builtin = false;