[Lcdproc] [patch] Export report/debug to hd44780 functions

Thomas Jarosch thomas.jarosch@intra2net.com
Wed Oct 31 14:11:02 2007


--Boundary-00=_RzIKH+ysB8R/h8Y
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello together,

attached patch exports the report/debug functions for the hd44780 
driver-dependent functions so we can log errors.

report() and debug() are already part of the "Driver" structure,
but only PrivateData is exported to these functions. A different fix
would be to change that function argument from "PrivateData" to "Driver",
but that's a rather massive change.

Unfortunately we cannot name the new variable "report"
as the compiler expands the macro to drvthis->report,
that's why I have chosen "drv_report".

Cheers,
Thomas

--Boundary-00=_RzIKH+ysB8R/h8Y
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="lcdproc-export-report.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="lcdproc-export-report.patch"

diff -u -r -p lcdproc.clean/server/drivers/hd44780.c lcdproc-CVS-current-20071031/server/drivers/hd44780.c
--- lcdproc.clean/server/drivers/hd44780.c	2007-10-21 21:39:24.000000000 +0200
+++ lcdproc-CVS-current-20071031/server/drivers/hd44780.c	2007-10-31 14:48:51.000000000 +0100
@@ -369,6 +369,8 @@ HD44780_init(Driver *drvthis)
 	}
 	// pre-set local function pointers (may be overridden by local init function)
 	p->hd44780_functions->uPause = uPause;
+	p->hd44780_functions->drv_report = report;
+	p->hd44780_functions->drv_debug = debug;
 	p->hd44780_functions->senddata = NULL;
 	p->hd44780_functions->backlight = NULL;
 	p->hd44780_functions->set_contrast = NULL;
diff -u -r -p lcdproc.clean/server/drivers/hd44780-low.h lcdproc-CVS-current-20071031/server/drivers/hd44780-low.h
--- lcdproc.clean/server/drivers/hd44780-low.h	2007-10-21 21:39:24.000000000 +0200
+++ lcdproc-CVS-current-20071031/server/drivers/hd44780-low.h	2007-10-31 14:48:31.000000000 +0100
@@ -170,6 +170,9 @@ typedef struct driver_private_data {
 typedef struct hwDependentFns {
 	// microsec pauses
 	void (*uPause)(PrivateData *p, int usecs);
+	// report and debug helper
+	void (*drv_report)(const int level, const char *format, .../*args*/);
+	void (*drv_debug)(const int level, const char *format, .../*args*/);
 
 	// Senddata to the LCD
 	// dispID     - display to send data to (0 = all displays)

--Boundary-00=_RzIKH+ysB8R/h8Y--