]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2005-05-02 05:15:46 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 2 May 2005 05:15:46 +0000 (05:15 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 2 May 2005 05:15:46 +0000 (05:15 +0000)
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

cfg.c
drv_LCDLinux.c
drv_LCDLinux.h
lcd4linux.conf.sample

diff --git a/cfg.c b/cfg.c
index 9e174392a36200b2cfa4e9ad7618708c34641395..4bd834c5ffe7478595a023a0459620c77ee55fba 100644 (file)
--- 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;
   }
index fbd8401fe8b68eb7c3dd71bb6d0b89106ca64299..29731fb52f8649332eb1a8a2d0c2b9e738ccf1e5 100644 (file)
@@ -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 */
   
index 2063a04a1ce3e2039bf80b511b7d43da55d3a89f..ae7f4cbd25f1712a7a155f6284b76a8289ecab8e 100644 (file)
@@ -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 */
 
 
 
index f8fa773635f3a9d9a4d775fb368f6fca357f0212..1175b34d5032970cb739c3b83690c9eb558df3d2 100644 (file)
@@ -9,6 +9,7 @@ Display Trefon {
 Display LCD-Linux {
     Driver 'LCD-Linux'
     Size '20x2'
+    UseBusy 0
 }
 
 Display LK204 {