[Lcdproc] patch to fix backlight disable on HD44780 in lcdproc-0.5.2

Will Frazer will.frazer@eurotech-ltd.co.uk
Wed Mar 5 11:31:02 2008


This is a multi-part message in MIME format.

------=_NextPart_000_0019_01C87EB4.599291D0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi all,
	Spotted a bug in HD44780.c that caused a crash if no backlight support
function was loaded (NULL pointer). Also noted that without this patch
'bachlight=no' doesn't work right (support function if present gets called
irregardless of the setting in .conf file). Patch attached.

New to this list & haven't seen this reported previously, so apologies if
this is old news.

/Will

------=_NextPart_000_0019_01C87EB4.599291D0
Content-Type: application/octet-stream;
	name="lcdproc-0.5.2-have_backlight.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="lcdproc-0.5.2-have_backlight.diff"

diff -urN lcdproc-0.5.2.orig/server/drivers/hd44780.c =
lcdproc-0.5.2/server/drivers/hd44780.c=0A=
--- lcdproc-0.5.2.orig/server/drivers/hd44780.c	2007-04-14 =
15:38:14.000000000 +0100=0A=
+++ lcdproc-0.5.2/server/drivers/hd44780.c	2008-03-04 17:28:41.000000000 =
+0000=0A=
@@ -634,6 +634,10 @@=0A=
 HD44780_backlight(Driver *drvthis, int on)=0A=
 {=0A=
 	PrivateData *p =3D (PrivateData *) drvthis->private_data;=0A=
+=0A=
+	if (!p->have_backlight) return; /* backlight disabled */=0A=
+	if (!p->hd44780_functions->backlight) return; /* unsupported for =
selected connectiontype */=0A=
+=0A=
 	p->hd44780_functions->backlight (p, on);=0A=
 }=0A=
 =0A=

------=_NextPart_000_0019_01C87EB4.599291D0--