diff --git a/ChangeLog b/ChangeLog
index 5d173a8..a700518 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,7 +24,8 @@ v.0.5dev (ongoing development)
* enable building lcdproc client on FreeBSD AMD64 platform (M. Dolze)
* Autoconf fixes for Net/FreeBSD (M. Dolze)
* fixes for the lcpdroc client iface screen on *BSD (M.Dolze)
- * key support for hd44780/lcd2usb (M. Dolze)
+ + key support for hd44780/lcd2usb (M. Dolze)
+ + option Priority for NoritakeVFD (idea: Richard Muratti)
v.0.5.2
* fix switching on/off the Load screen in lcdproc client using the menu
diff --git a/LCDd.conf b/LCDd.conf
index 98df4d6..c3a384e 100644
--- a/LCDd.conf
+++ b/LCDd.conf
@@ -744,6 +744,9 @@ Brightness=255
# set the serial port speed [default: 9600, legal: 1200, 2400, 9600, 19200, 115200]
Speed=9600
+# Set serial data parity [default: 0 (None), legal: 0(=none), 1(=odd), 2(=even)]
+Parity=0
+
# re-initialize VFD ?
#Reboot=yes
diff --git a/docs/lcdproc-user/drivers/NoritakeVFD.docbook b/docs/lcdproc-user/drivers/NoritakeVFD.docbook
index e588175..1416d12 100644
--- a/docs/lcdproc-user/drivers/NoritakeVFD.docbook
+++ b/docs/lcdproc-user/drivers/NoritakeVFD.docbook
@@ -68,6 +68,24 @@ This section talks about using LCDproc with text mode VFD displays from
+
+
+ Parity=
+
+
+ 0
+ 1
+ 2
+
+
+
+
+ Set the parity for communication with the device to even parity (2),
+ odd parity (1) or no parity (0).
+ If not given, it defaults to 0.
+
+
+
Reboot=
diff --git a/server/drivers/NoritakeVFD.c b/server/drivers/NoritakeVFD.c
index 9c65cc0..986b17d 100644
--- a/server/drivers/NoritakeVFD.c
+++ b/server/drivers/NoritakeVFD.c
@@ -53,6 +53,7 @@ typedef struct driver_private_data {
char device[200];
int fd;
int speed;
+ int parity;
/* dimensions */
int width, height;
int cellwidth, cellheight;
@@ -150,12 +151,23 @@ NoritakeVFD_init (Driver *drvthis)
else if (tmp == 115200) p->speed = B115200;
+ /* Which parity */
+ tmp = drvthis->config_get_int(drvthis->name, "Parity", 0, DEFAULT_PARITY);
+ if ((tmp != 0) && (tmp != 1) && (tmp != 2) ) {
+ report(RPT_WARNING, "%s: Parity must be 0(=none), 1(=odd), 2(=even); using default %d",
+ drvthis->name, DEFAULT_PARITY);
+ tmp = DEFAULT_PARITY;
+ }
+ if (tmp != 0)
+ p->parity = (tmp & 1) ? (PARENB | PARODD) : PARENB;
+
+
/* Reboot display? */
reboot = drvthis->config_get_bool(drvthis->name, "Reboot", 0, 0);
/* Set up io port correctly, and open it...*/
debug(RPT_DEBUG, "%s: Opening device: %s", __FUNCTION__, p->device);
- p->fd = open (p->device, O_RDWR | O_NOCTTY | O_NDELAY);
+ p->fd = open(p->device, O_RDWR | O_NOCTTY | O_NDELAY);
if (p->fd == -1) {
report(RPT_ERR, "%s: open() of %s failed (%s)", drvthis->name, p->device, strerror(errno));
@@ -164,10 +176,13 @@ NoritakeVFD_init (Driver *drvthis)
tcgetattr(p->fd, &portset);
- // We use RAW mode
+ // We use RAW mode (with varying parity)
#ifdef HAVE_CFMAKERAW
// The easy way
cfmakeraw(&portset);
+ // set parity the way we want it
+ portset.c_cflag &= ~(PARENB | PARODD);
+ portset.c_cflag |= p->parity;
#else
// The hard way
portset.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP
@@ -175,8 +190,8 @@ NoritakeVFD_init (Driver *drvthis)
portset.c_oflag &= ~OPOST;
portset.c_lflag &= ~( ECHO | ECHONL | ICANON | ISIG | IEXTEN );
portset.c_cflag &= ~( CSIZE | PARENB | CRTSCTS );
- portset.c_cflag |= CS8 | CREAD | CLOCAL;
-#endif
+ portset.c_cflag |= CS8 | CREAD | CLOCAL | p->parity;
+#endif
// Set port speed
cfsetospeed(&portset, p->speed);
@@ -356,7 +371,7 @@ NoritakeVFD_autoscroll (Driver *drvthis, int on)
}
/////////////////////////////////////////////////////////////////
-// Get rid of the blinking curson
+// Get rid of the blinking cursor
//
static void
NoritakeVFD_hidecursor (Driver *drvthis)
diff --git a/server/drivers/NoritakeVFD.h b/server/drivers/NoritakeVFD.h
index fb3a0c9..edbdb3c 100644
--- a/server/drivers/NoritakeVFD.h
+++ b/server/drivers/NoritakeVFD.h
@@ -29,6 +29,7 @@
#define DEFAULT_SPEED 9600
#define DEFAULT_BRIGHTNESS 140
#define DEFAULT_SIZE "20x4"
+#define DEFAULT_PARITY 0
MODULE_EXPORT int NoritakeVFD_init (Driver *drvthis);
MODULE_EXPORT void NoritakeVFD_close (Driver *drvthis);