summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthat <github@that.at>2016-02-22 21:09:09 +0100
committerDees Troy <dees_troy@teamw.in>2016-02-29 17:10:00 +0100
commitb9d8f62c26445d852b8d52714ab34bdfa77f6684 (patch)
tree89767b13e5aa1e08e2762549b533ecf805c70177
parentFix verifier_test build (diff)
downloadandroid_bootable_recovery-b9d8f62c26445d852b8d52714ab34bdfa77f6684.tar
android_bootable_recovery-b9d8f62c26445d852b8d52714ab34bdfa77f6684.tar.gz
android_bootable_recovery-b9d8f62c26445d852b8d52714ab34bdfa77f6684.tar.bz2
android_bootable_recovery-b9d8f62c26445d852b8d52714ab34bdfa77f6684.tar.lz
android_bootable_recovery-b9d8f62c26445d852b8d52714ab34bdfa77f6684.tar.xz
android_bootable_recovery-b9d8f62c26445d852b8d52714ab34bdfa77f6684.tar.zst
android_bootable_recovery-b9d8f62c26445d852b8d52714ab34bdfa77f6684.zip
-rw-r--r--minuitwrp/graphics_fbdev.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/minuitwrp/graphics_fbdev.cpp b/minuitwrp/graphics_fbdev.cpp
index afc4151c9..066be8dae 100644
--- a/minuitwrp/graphics_fbdev.cpp
+++ b/minuitwrp/graphics_fbdev.cpp
@@ -108,21 +108,31 @@ static void set_displayed_framebuffer(unsigned n)
}
static GRSurface* fbdev_init(minui_backend* backend) {
- int fd = open("/dev/graphics/fb0", O_RDWR);
- if (fd == -1) {
- perror("cannot open fb0");
- return NULL;
+ int retry = 20;
+ int fd = -1;
+ while (fd == -1) {
+ fd = open("/dev/graphics/fb0", O_RDWR);
+ if (fd == -1) {
+ if (--retry) {
+ // wait for init to create the device node
+ perror("cannot open fb0 (retrying)");
+ usleep(100000);
+ } else {
+ perror("cannot open fb0 (giving up)");
+ return NULL;
+ }
+ }
}
fb_fix_screeninfo fi;
if (ioctl(fd, FBIOGET_FSCREENINFO, &fi) < 0) {
- perror("failed to get fb0 info");
+ perror("failed to get fb0 info (FBIOGET_FSCREENINFO)");
close(fd);
return NULL;
}
if (ioctl(fd, FBIOGET_VSCREENINFO, &vi) < 0) {
- perror("failed to get fb0 info");
+ perror("failed to get fb0 info (FBIOGET_VSCREENINFO)");
close(fd);
return NULL;
}