aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-05-02 05:15:46 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2005-05-02 05:15:46 +0000
commitdfcd00a79bf78f14f8699b303b1e8bb4d77d53f0 (patch)
tree459f531085547461e564ff669c892fd4fdeddbfb
parent733a1141da1f25e986ee423d67f5342673102b30 (diff)
downloadlcd4linux-dfcd00a79bf78f14f8699b303b1e8bb4d77d53f0.tar.gz
[lcd4linux @ 2005-05-02 05:15:46 by reinelt]
make busy-flag checking configurable for LCD-Linux driver git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@535 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--cfg.c9
-rw-r--r--drv_LCDLinux.c47
-rw-r--r--drv_LCDLinux.h3
-rw-r--r--lcd4linux.conf.sample1
4 files changed, 51 insertions, 9 deletions
diff --git a/cfg.c b/cfg.c
index 9e17439..4bd834c 100644
--- a/cfg.c
+++ b/cfg.c
@@ -1,4 +1,4 @@
-/* $Id: cfg.c,v 1.45 2005/01/18 06:30:21 reinelt Exp $^
+/* $Id: cfg.c,v 1.46 2005/05/02 05:15:46 reinelt Exp $^
*
* config file stuff
*
@@ -23,6 +23,9 @@
*
*
* $Log: cfg.c,v $
+ * Revision 1.46 2005/05/02 05:15:46 reinelt
+ * make busy-flag checking configurable for LCD-Linux driver
+ *
* Revision 1.45 2005/01/18 06:30:21 reinelt
* added (C) to all copyright statements
*
@@ -583,13 +586,13 @@ int cfg_number (const char *section, const char *key, const int defval, const in
DelResult(&result);
if (*value<min) {
- error ("bad %s value '%d' in %s, minimum is %d", key, *value, cfg_source(), min);
+ error ("bad '%s' value '%d' in %s, minimum is %d", key, *value, cfg_source(), min);
*value=min;
return -1;
}
if (max > min && max != -1 && *value > max) {
- error ("bad %s value '%d' in %s, maximum is %d", key, *value, cfg_source(), max);
+ error ("bad '%s' value '%d' in %s, maximum is %d", key, *value, cfg_source(), max);
*value=max;
return -1;
}
diff --git a/drv_LCDLinux.c b/drv_LCDLinux.c
index fbd8401..29731fb 100644
--- a/drv_LCDLinux.c
+++ b/drv_LCDLinux.c
@@ -1,4 +1,4 @@
-/* $Id: drv_LCDLinux.c,v 1.6 2005/04/30 06:02:09 reinelt Exp $
+/* $Id: drv_LCDLinux.c,v 1.7 2005/05/02 05:15:46 reinelt Exp $
*
* driver for the LCD-Linux HD44780 kernel driver
* http://lcd-linux.sourceforge.net
@@ -24,6 +24,9 @@
*
*
* $Log: drv_LCDLinux.c,v $
+ * Revision 1.7 2005/05/02 05:15:46 reinelt
+ * make busy-flag checking configurable for LCD-Linux driver
+ *
* Revision 1.6 2005/04/30 06:02:09 reinelt
* LCD-Linux display size set up from lcd4linux.conf
*
@@ -148,9 +151,13 @@ static void drv_LL_defchar (const int ascii, const unsigned char *matrix)
static int drv_LL_start (const char *section, const int quiet)
{
char *s;
- int rows=-1, cols=-1;
+ int rows = -1, cols = -1;
+ int use_busy = 0;
struct lcd_driver buf;
+ /* emit version information */
+ info ("%s: Version %s", Name, LCD_LINUX_VERSION);
+
/* get size from config file */
s=cfg_get(section, "Size", NULL);
if (s != NULL || *s != '\0') {
@@ -173,13 +180,23 @@ static int drv_LL_start (const char *section, const int quiet)
memset(&buf, 0, sizeof(buf));
if (ioctl(lcdlinux_fd, IOCTL_GET_PARAM, &buf) != 0) {
error ("%s: ioctl(IOCTL_GET_PARAM) failed: %s", Name, strerror(errno));
- error ("%s: Could not get display geometry!", Name);
+ error ("%s: Could not query display information!", Name);
return -1;
}
- info("%s: %dx%d display (%d controllers)", Name, buf.disp_cols, buf.cntr_rows, buf.num_cntr);
+ info("%s: %dx%d display at 0x%x, %d controllers, flags=0x%02x:",
+ Name, buf.disp_cols, buf.cntr_rows, buf.io, buf.num_cntr, buf.flags);
+
+ info("%s: /proc support %sabled", Name, buf.flags & LCD_PROC_ON ? "en" : "dis");
+ info("%s: tty support %sabled", Name, buf.flags & LCD_ETTY_ON ? "en" : "dis");
+ info("%s: console support %sabled", Name, buf.flags & LCD_CONSOLE ? "en" : "dis");
+ info("%s: bus width %d bits", Name, buf.flags & LCD_4BITS_BUS ? 4 : 8);
+ info("%s: font size %s", Name, buf.flags & LCD_5X10_FONT ? "5x10" : "5x8");
+ info("%s: busy-flag checking %sabled", Name, buf.flags & LCD_CHECK_BF ? "en" : "dis");
+
/* overwrite with size from lcd4linux.conf */
if ((rows > 0 && rows != buf.cntr_rows) || (cols > 0 && cols != buf.disp_cols)) {
+ info("%s: changing size to %dx%d", Name, cols, rows);
buf.cntr_rows = rows;
buf.disp_cols = cols;
if (ioctl(lcdlinux_fd, IOCTL_SET_PARAM, &buf) != 0) {
@@ -187,12 +204,32 @@ static int drv_LL_start (const char *section, const int quiet)
error ("%s: Could not set display geometry!", Name);
return -1;
}
- info("%s: size changed to %dx%d", Name, buf.disp_cols, buf.cntr_rows);
}
DROWS = buf.cntr_rows;
DCOLS = buf.disp_cols;
+ /* overwrite busy-flag checking from lcd4linux.conf */
+ cfg_number(section, "UseBusy", 0, 0, 1, &use_busy);
+ if (use_busy && !(buf.flags & LCD_CHECK_BF)) {
+ info ("%s: activating busy-flag checking", Name);
+ buf.flags |= LCD_CHECK_BF;
+ if (ioctl(lcdlinux_fd, IOCTL_SET_PARAM, &buf) != 0) {
+ error ("%s: ioctl(IOCTL_SET_PARAM) failed: %s", Name, strerror(errno));
+ error ("%s: Could not activate busy-flag checking!", Name);
+ return -1;
+ }
+ }
+ else if (!use_busy && (buf.flags & LCD_CHECK_BF)) {
+ info ("%s: deactivating busy-flag checking", Name);
+ buf.flags &= ~LCD_CHECK_BF;
+ if (ioctl(lcdlinux_fd, IOCTL_SET_PARAM, &buf) != 0) {
+ error ("%s: ioctl(IOCTL_SET_PARAM) failed: %s", Name, strerror(errno));
+ error ("%s: Could not deactivate busy-flag checking!", Name);
+ return -1;
+ }
+ }
+
/* initialize display */
drv_LL_clear(); /* clear display */
diff --git a/drv_LCDLinux.h b/drv_LCDLinux.h
index 2063a04..ae7f4cb 100644
--- a/drv_LCDLinux.h
+++ b/drv_LCDLinux.h
@@ -1,6 +1,6 @@
/* lcd.h
*
- * $Id: drv_LCDLinux.h,v 1.2 2005/04/30 06:02:09 reinelt Exp $
+ * $Id: drv_LCDLinux.h,v 1.3 2005/05/02 05:15:46 reinelt Exp $
*
* LCD driver for HD44780 compatible displays connected to the parallel port.
*
@@ -59,6 +59,7 @@ struct lcd_driver {
#define LCD_CONSOLE 0x0004 /* Enable the console support */
#define LCD_4BITS_BUS 0x0008 /* Set the bus length to 4 bits */
#define LCD_5X10_FONT 0x0010 /* Use 5x10 dots fonts */
+#define LCD_CHECK_BF 0x0020 /* Do busy flag checking */
diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample
index f8fa773..1175b34 100644
--- a/lcd4linux.conf.sample
+++ b/lcd4linux.conf.sample
@@ -9,6 +9,7 @@ Display Trefon {
Display LCD-Linux {
Driver 'LCD-Linux'
Size '20x2'
+ UseBusy 0
}
Display LK204 {