浏览代码

WindowServer: Print the error when failing to open /dev/fb0

Sergey Bugaev 5 年之前
父节点
当前提交
88f5991c29
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Servers/WindowServer/WSScreen.cpp

+ 5 - 1
Servers/WindowServer/WSScreen.cpp

@@ -31,6 +31,7 @@
 #include "WSWindowManager.h"
 #include <Kernel/FB.h>
 #include <fcntl.h>
+#include <stdio.h>
 #include <sys/mman.h>
 #include <unistd.h>
 
@@ -47,7 +48,10 @@ WSScreen::WSScreen(unsigned desired_width, unsigned desired_height)
     ASSERT(!s_the);
     s_the = this;
     m_framebuffer_fd = open("/dev/fb0", O_RDWR | O_CLOEXEC);
-    ASSERT(m_framebuffer_fd >= 0);
+    if (m_framebuffer_fd < 0) {
+        perror("failed to open /dev/fb0");
+        ASSERT_NOT_REACHED();
+    }
 
     if (fb_set_buffer(m_framebuffer_fd, 0) == 0) {
         m_can_set_buffer = true;