diff --git a/plugins/platforms/fbdev/fb_backend.h b/plugins/platforms/fbdev/fb_backend.h --- a/plugins/platforms/fbdev/fb_backend.h +++ b/plugins/platforms/fbdev/fb_backend.h @@ -27,6 +27,8 @@ namespace KWin { +class Udev; + class KWIN_EXPORT FramebufferBackend : public Platform { Q_OBJECT @@ -89,6 +91,7 @@ QSize m_resolution; QSize m_physicalSize; QByteArray m_id; + QScopedPointer m_udev; struct Color { quint32 offset; quint32 length; diff --git a/plugins/platforms/fbdev/fb_backend.cpp b/plugins/platforms/fbdev/fb_backend.cpp --- a/plugins/platforms/fbdev/fb_backend.cpp +++ b/plugins/platforms/fbdev/fb_backend.cpp @@ -24,6 +24,7 @@ #include "scene_qpainter_fb_backend.h" #include "screens.h" #include "virtual_terminal.h" +#include "udev.h" // system #include #include @@ -37,6 +38,7 @@ FramebufferBackend::FramebufferBackend(QObject *parent) : Platform(parent) + , m_udev(new Udev) { } @@ -81,13 +83,19 @@ void FramebufferBackend::openFrameBuffer() { VirtualTerminal::self()->init(); - int fd = LogindIntegration::self()->takeDevice(deviceIdentifier().constData()); + QString framebufferDevice = deviceIdentifier().constData(); + UdevDevice::Ptr device = m_udev->primaryFramebuffer(); + if (framebufferDevice.isEmpty()) { + framebufferDevice = QString(device->devNode()); + } + int fd = LogindIntegration::self()->takeDevice(framebufferDevice.toUtf8().constData()); + qCDebug(KWIN_FB) << "Using frame buffer device:" << framebufferDevice; if (fd < 0) { - qCWarning(KWIN_FB) << "Failed to open frame buffer device through logind, trying without"; + qCWarning(KWIN_FB) << "Failed to open frame buffer device:" << framebufferDevice << "through logind, trying without"; } - fd = open(deviceIdentifier().constData(), O_RDWR | O_CLOEXEC); + fd = open(framebufferDevice.toUtf8().constData(), O_RDWR | O_CLOEXEC); if (fd < 0) { - qCWarning(KWIN_FB) << "failed to open frame buffer device"; + qCWarning(KWIN_FB) << "failed to open frame buffer device:" << framebufferDevice; emit initFailed(); return; }