1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

WindowServer: Try to auto-add unconfigured framebuffer devices

This will try to auto-add framebuffer devices that haven't been
explicitly configured to the right-hand side.
This commit is contained in:
Tom 2021-06-26 13:20:41 -06:00 committed by Andreas Kling
parent 38af4c29e6
commit a9906cfcd1
3 changed files with 93 additions and 1 deletions

View file

@ -10,6 +10,8 @@
#include "Screen.h"
#include "WindowManager.h"
#include <LibCore/ConfigFile.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibGfx/Palette.h>
#include <LibGfx/SystemTheme.h>
#include <signal.h>
@ -88,7 +90,20 @@ int main(int, char**)
for (auto& screen_info : screen_layout.screens)
fb_devices_configured.set(screen_info.device);
// TODO: Enumerate the /dev/fbX devices and set up any ones we find that we haven't already used
// Enumerate the /dev/fbX devices and try to set up any ones we find that we haven't already used
Core::DirIterator di("/dev", Core::DirIterator::SkipParentAndBaseDir);
while (di.has_next()) {
auto path = di.next_path();
if (!path.starts_with("fb"))
continue;
auto full_path = String::formatted("/dev/{}", path);
if (!Core::File::is_device(full_path))
continue;
if (fb_devices_configured.find(full_path) != fb_devices_configured.end())
continue;
if (!screen_layout.try_auto_add_framebuffer(full_path))
dbgln("Could not auto-add framebuffer device {} to screen layout", full_path);
}
if (!WindowServer::Screen::apply_layout(move(screen_layout), error_msg)) {
dbgln("Error applying screen layout: {}", error_msg);