graphics() raspberry ubuntu displays

This commit is contained in:
Sebastian Hildebrandt
2025-01-10 21:50:34 +01:00
parent 36379825c3
commit e8deda9fd3
2 changed files with 33 additions and 29 deletions
+30 -26
View File
@@ -768,51 +768,55 @@ function graphics(callback) {
vramDynamic: true
});
}
if (callback) {
callback(result);
}
resolve(result);
// if (callback) {
// callback(result);
// }
// resolve(result);
});
} else {
let cmd = 'lspci -vvv 2>/dev/null';
exec(cmd, function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
}
// } else {
let cmd = 'lspci -vvv 2>/dev/null';
exec(cmd, function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
if (result.controllers.length === 0) {
result.controllers = parseLinesLinuxControllers(lines);
const nvidiaData = nvidiaDevices();
// needs to be rewritten ... using no spread operators
result.controllers = result.controllers.map((controller) => { // match by busAddress
return mergeControllerNvidia(controller, nvidiaData.find((contr) => contr.pciBus.toLowerCase().endsWith(controller.busAddress.toLowerCase())) || {});
});
}
let cmd = 'clinfo --raw';
}
let cmd = 'clinfo --raw';
exec(cmd, function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
result.controllers = parseLinesLinuxClinfo(result.controllers, lines);
}
let cmd = 'xdpyinfo 2>/dev/null | grep \'depth of root window\' | awk \'{ print $5 }\'';
exec(cmd, function (error, stdout) {
let depth = 0;
if (!error) {
let lines = stdout.toString().split('\n');
result.controllers = parseLinesLinuxClinfo(result.controllers, lines);
depth = parseInt(lines[0]) || 0;
}
let cmd = 'xdpyinfo 2>/dev/null | grep \'depth of root window\' | awk \'{ print $5 }\'';
let cmd = 'xrandr --verbose 2>/dev/null';
exec(cmd, function (error, stdout) {
let depth = 0;
if (!error) {
let lines = stdout.toString().split('\n');
depth = parseInt(lines[0]) || 0;
result.displays = parseLinesLinuxDisplays(lines, depth);
}
let cmd = 'xrandr --verbose 2>/dev/null';
exec(cmd, function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
result.displays = parseLinesLinuxDisplays(lines, depth);
}
if (callback) {
callback(result);
}
resolve(result);
});
if (callback) {
callback(result);
}
resolve(result);
});
});
});
}
});
// }
}
if (_freebsd || _openbsd || _netbsd) {
if (callback) { callback(null); }