* Changed MatrixOrbital driver to support the traditional -t option
(for type: 20x2, 20x4, 20x6) etc. * Fixed bug that appeared when using a size larger than 80 characters (20x4): framebuffer was allocated before size was known! Drivers should NOT look for framebuffer to be allocated before they start - but 80 characters are there anyway (for now).
This commit is contained in:
@@ -420,7 +420,7 @@ int
|
||||
lcd_add_driver (char *driver, char *args)
|
||||
{
|
||||
int i;
|
||||
char buf[64];
|
||||
char buf[80];
|
||||
int (*init_driver) ();
|
||||
|
||||
lcd_logical_driver *ptr = NULL;
|
||||
@@ -445,7 +445,13 @@ lcd_add_driver (char *driver, char *args)
|
||||
// Default settings for the driver...
|
||||
lcd_drv_init(add, NULL);
|
||||
|
||||
// Allocate space for a framebuffer...
|
||||
memset(buf, '\0', sizeof(buf));
|
||||
add->framebuf = buf; // *** HACK: makes drivers think framebuffer is allocated!
|
||||
|
||||
i = init_driver (add, args);
|
||||
|
||||
// Allocate space for a framebuffer... *AFTER* the driver
|
||||
// has a chance to initialize height and width!!
|
||||
if ((add->framebuf = malloc (add->wid * add->hgt)) == NULL) {
|
||||
snprintf (buf, sizeof(buf), "couldn't allocate framebuffer for driver \"%s\"", driver);
|
||||
syslog (LOG_ERR, buf);
|
||||
@@ -454,8 +460,6 @@ lcd_add_driver (char *driver, char *args)
|
||||
}
|
||||
memset (add->framebuf, ' ', (add->wid * add->hgt));
|
||||
|
||||
i = init_driver (add, args);
|
||||
|
||||
// Now patch up the returned driver structure
|
||||
// before returning
|
||||
lcd_drv_patch_init (add); // patches drivers that think NULL is okay...
|
||||
|
||||
Reference in New Issue
Block a user