When starting psplash as early as possible in the boot process, the fb
device node might not be ready. This patch adds a loop on reading the
fb0 device with a timeout of 5 seconds.

Signed-off-by: Andrei Gherzan <[email protected]>
---
 psplash-fb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/psplash-fb.c b/psplash-fb.c
index 6603572..6700a3b 100644
--- a/psplash-fb.c
+++ b/psplash-fb.c
@@ -137,6 +137,7 @@ psplash_fb_new (int angle, int fbdev_id)
   struct fb_fix_screeninfo fb_fix;
   int                      off;
   char                     fbdev[9] = "/dev/fb0";
+  int retries = 0;
 
   PSplashFB *fb = NULL;
 
@@ -156,7 +157,9 @@ psplash_fb_new (int angle, int fbdev_id)
 
   fb->fd = -1;
 
-  if ((fb->fd = open (fbdev, O_RDWR)) < 0)
+  while ((fb->fd = open(fbdev, O_RDWR)) < 0 && retries++ <= 100)
+         usleep(50000);
+  if (fb->fd < 0)
     {
       fprintf(stderr,
               "Error opening %s\n",
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#48389): https://lists.yoctoproject.org/g/yocto/message/48389
Mute This Topic: https://lists.yoctoproject.org/mt/71238022/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to