[BUG,with] graphlcd-0.1.2-pre5 does not show channel info after startup

Message ID d21ml3$6d8$1@fritz38552.news.dfncis.de
State New
Headers

Commit Message

Wolfgang Fritz March 25, 2005, 6:52 p.m. UTC
  On my VDR (1.3.23), the graphlcd plugin does not show the channel name
and logo after startup. When switching to another channel, name and logo
are displayed correctly.

Reason: graphlcd's display thread is not yet active when VDR calls the
SetChannel() methods of all cStatus objects. Because graphlcd creates
its cStatus object (cGraphLCDState) in the display thread, it misses the
first SetChannel.

Fix:

1. Move the plugin initialization from Start() to Initialize(). This
makes it quite sure that the display thread is running at the first
SetChannel.

2. In Start(), wait until the display thread is really active. On my
system I have never seen a real wait here, but who knows...

Patch is attached. Testers and feedback welcome.

Wolfgang
  

Patch

Index: plugin.c
===================================================================
--- plugin.c	(Revision 268)
+++ plugin.c	(Revision 269)
@@ -162,11 +162,6 @@ 
 
 bool cPluginGraphLCD::Initialize()
 {
-	return true;
-}
-
-bool cPluginGraphLCD::Start()
-{
 	const char * cfgDir;
 
 	RegisterI18n(Phrases);
@@ -181,6 +176,21 @@ 
 	return true;
 }
 
+bool cPluginGraphLCD::Start()
+{
+	int count;
+	dsyslog ("graphlcd: waiting for display thread to get ready");
+	for (count = 0; count < 50; count++) {
+		if (Display.Active()) {
+			dsyslog ("graphlcd: display thread ready");
+			return true;
+		}
+		cCondWait::SleepMs(100);
+	}
+	dsyslog ("graphlcd: timeout while waiting for display thread");
+	return false;
+}
+
 void cPluginGraphLCD::Housekeeping()
 {
 }