Re-add hd44780-usblcd connection type for devices made by Adams IT Services.
This driver has been part of v0.4.5 but was never ported to v0.5.x.
This commit is contained in:
@@ -68,6 +68,7 @@ v.0.5dev (ongoing development)
|
|||||||
+ lcdproc: Retrieve per CPU usage statistics on FreeBSD (M. Dolze)
|
+ lcdproc: Retrieve per CPU usage statistics on FreeBSD (M. Dolze)
|
||||||
* Change drivers to start in background by default: bayrad, CFontz, ea65, glk
|
* Change drivers to start in background by default: bayrad, CFontz, ea65, glk
|
||||||
* imon driver: Change hbars to make last char in-/decrease vertically
|
* imon driver: Change hbars to make last char in-/decrease vertically
|
||||||
|
+ hd44780 driver: port usblcd connection type from 0.4.5 to 0.5 (M. Dolze)
|
||||||
|
|
||||||
v.0.5.2
|
v.0.5.2
|
||||||
* fix switching on/off the Load screen in lcdproc client using the menu
|
* fix switching on/off the Load screen in lcdproc client using the menu
|
||||||
|
|||||||
+1
-1
@@ -188,7 +188,7 @@ dnl else
|
|||||||
actdrivers=["$actdrivers glk"]
|
actdrivers=["$actdrivers glk"]
|
||||||
;;
|
;;
|
||||||
hd44780)
|
hd44780)
|
||||||
HD44780_DRIVERS="hd44780-hd44780-serial.o hd44780-hd44780-lis2.o"
|
HD44780_DRIVERS="hd44780-hd44780-serial.o hd44780-hd44780-lis2.o hd44780-hd44780-usblcd.o"
|
||||||
if test "$ac_cv_port_have_lpt" = yes ; then
|
if test "$ac_cv_port_have_lpt" = yes ; then
|
||||||
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-4bit.o hd44780-hd44780-ext8bit.o hd44780-lcd_sem.o hd44780-hd44780-winamp.o hd44780-hd44780-serialLpt.o"
|
HD44780_DRIVERS="$HD44780_DRIVERS hd44780-hd44780-4bit.o hd44780-hd44780-ext8bit.o hd44780-lcd_sem.o hd44780-hd44780-winamp.o hd44780-hd44780-serialLpt.o"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -172,6 +172,9 @@ USB connection via a FTDI FT2232D chip in bitbang mode
|
|||||||
.TP
|
.TP
|
||||||
.B ethlcd
|
.B ethlcd
|
||||||
TCP connection using open source/open hardware ethlcd (http://manio.skyboo.net/ethlcd/)
|
TCP connection using open source/open hardware ethlcd (http://manio.skyboo.net/ethlcd/)
|
||||||
|
.TP
|
||||||
|
.B usblcd
|
||||||
|
LCD device from Adams IT Services (http://www.usblcd.de/)
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B i2500vfd
|
.B i2500vfd
|
||||||
|
|||||||
@@ -123,6 +123,11 @@ more important. Here are the USB connection types the HD44780 driver supports:
|
|||||||
<link linkend="hd44780-ftdi">ftdi</link>:
|
<link linkend="hd44780-ftdi">ftdi</link>:
|
||||||
Display connected to a dual channel FTDI 2232D USB chip
|
Display connected to a dual channel FTDI 2232D USB chip
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<link linkend="hd44780-usblcd">usblcd</link>:
|
||||||
|
USBLCD from Adams IT Services (<ulink url="http://www.usblcd.de/"></ulink>)
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@@ -2480,6 +2485,32 @@ The default is <filename>ethlcd</filename>.
|
|||||||
|
|
||||||
</sect3>
|
</sect3>
|
||||||
|
|
||||||
|
<sect3 id="hd44780-usblcd">
|
||||||
|
<title>USBLCD adapter</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The USBLCD adapter from Adams IT Services (<ulink url="http://www.usblcd.de/"></ulink>)
|
||||||
|
is a small interface board which allows you to connect an alphanumerical display
|
||||||
|
module based on the HD44780 or compatible controller to the USB. The display
|
||||||
|
will be powered by the USB. It features a switchable backlight (on or off) and
|
||||||
|
can be used with 16x2, 16x4 or 20x4 displays.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The <code>usblcd</code> connection type communicates with a kernel
|
||||||
|
driver by using a device file <filename class="devicefile">/dev/usb/lcd<replaceable>x</replaceable></filename>.
|
||||||
|
The kernel driver providing this device currently only exists for Linux kernels
|
||||||
|
newer than 2.4.20-pre7.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
As of 2007 these device are not sold anymore. This driver has been ported from
|
||||||
|
lcdproc 0.4.5 to support existing users.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
</sect3>
|
||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
|
|
||||||
@@ -2552,6 +2583,7 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
|
|||||||
<arg choice="plain"><literal>mplay</literal></arg>
|
<arg choice="plain"><literal>mplay</literal></arg>
|
||||||
<arg choice="plain"><literal>i2c</literal></arg>
|
<arg choice="plain"><literal>i2c</literal></arg>
|
||||||
<arg choice="plain"><literal>ftdi</literal></arg>
|
<arg choice="plain"><literal>ftdi</literal></arg>
|
||||||
|
<arg choice="plain"><literal>usblcd</literal></arg>
|
||||||
</group>
|
</group>
|
||||||
</arg>
|
</arg>
|
||||||
</term>
|
</term>
|
||||||
@@ -2631,6 +2663,10 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
|
|||||||
<entry><literal><link linkend="hd44780-ftdi">ftdi</link></literal></entry>
|
<entry><literal><link linkend="hd44780-ftdi">ftdi</link></literal></entry>
|
||||||
<entry>Display connected to a dual channel FTDI 2232D USB chip</entry>
|
<entry>Display connected to a dual channel FTDI 2232D USB chip</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal><link linkend="hd44780-usblcd">usblcd</link></literal></entry>
|
||||||
|
<entry>USBLCD adapter from Adams IT Services (<ulink url="http://www.usblcd.de/"></ulink>)</entry>
|
||||||
|
</row>
|
||||||
<!-- I2C -->
|
<!-- I2C -->
|
||||||
<row>
|
<row>
|
||||||
<entry><literal><link linkend="hd44780-i2c">i2c</link></literal></entry>
|
<entry><literal><link linkend="hd44780-i2c">i2c</link></literal></entry>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ g15_SOURCES = lcd.h lcd_lib.h g15.h g15-num.c g15.c report.h
|
|||||||
glcdlib_SOURCES = lcd.h lcd_lib.h glcdlib.h glcdlib.c report.h
|
glcdlib_SOURCES = lcd.h lcd_lib.h glcdlib.h glcdlib.c report.h
|
||||||
glk_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
|
glk_SOURCES = lcd.h glk.c glk.h glkproto.c glkproto.h report.h
|
||||||
hd44780_SOURCES = lcd.h lcd_lib.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h adv_bignum.h
|
hd44780_SOURCES = lcd.h lcd_lib.h hd44780.h hd44780.c hd44780-drivers.h hd44780-low.h hd44780-charmap.h report.h adv_bignum.h
|
||||||
EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-serial.c hd44780-serial.h hd44780-winamp.c hd44780-winamp.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h hd44780-ftdi.c hd44780-ftdi.h hd44780-ethlcd.c hd44780-ethlcd.h hd44780-uss720.c hd44780-uss720.h port.h lpt-port.h timing.h
|
EXTRA_hd44780_SOURCES = hd44780-4bit.c hd44780-4bit.h hd44780-ext8bit.c hd44780-ext8bit.h lcd_sem.c lcd_sem.h hd44780-serialLpt.c hd44780-serialLpt.h hd44780-serial.c hd44780-serial.h hd44780-winamp.c hd44780-winamp.h hd44780-bwct-usb.c hd44780-bwct-usb.h hd44780-lcd2usb.c hd44780-lcd2usb.h hd44780-lis2.c hd44780-lis2.h hd44780-i2c.c hd44780-i2c.h hd44780-ftdi.c hd44780-ftdi.h hd44780-ethlcd.c hd44780-ethlcd.h hd44780-uss720.c hd44780-uss720.h hd44780-usblcd.c hd44780-usblcd.h port.h lpt-port.h timing.h
|
||||||
|
|
||||||
icp_a106_SOURCES = lcd.h lcd_lib.h icp_a106.c icp_a106.h report.h
|
icp_a106_SOURCES = lcd.h lcd_lib.h icp_a106.c icp_a106.h report.h
|
||||||
imon_SOURCES = lcd.h lcd_lib.h imon.h imon.c report.h
|
imon_SOURCES = lcd.h lcd_lib.h imon.h imon.c report.h
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
# include "hd44780-i2c.h"
|
# include "hd44780-i2c.h"
|
||||||
#endif
|
#endif
|
||||||
# include "hd44780-ethlcd.h"
|
# include "hd44780-ethlcd.h"
|
||||||
|
# include "hd44780-usblcd.h"
|
||||||
// add new connection type header files here
|
// add new connection type header files here
|
||||||
|
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ static const ConnectionMapping connectionMapping[] = {
|
|||||||
#endif
|
#endif
|
||||||
/* TCP socket connection types */
|
/* TCP socket connection types */
|
||||||
{ "ethlcd", HD44780_CT_ETHLCD, IF_TYPE_TCP, hd_init_ethlcd },
|
{ "ethlcd", HD44780_CT_ETHLCD, IF_TYPE_TCP, hd_init_ethlcd },
|
||||||
|
{ "usblcd", HD44780_CT_USBLCD, IF_TYPE_USB, hd_init_usblcd },
|
||||||
// add new connection types here
|
// add new connection types here
|
||||||
// ....
|
// ....
|
||||||
// default, end of structure element (do not delete)
|
// default, end of structure element (do not delete)
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
#define HD44780_CT_I2C 16
|
#define HD44780_CT_I2C 16
|
||||||
#define HD44780_CT_ETHLCD 17
|
#define HD44780_CT_ETHLCD 17
|
||||||
#define HD44780_CT_USS720 18
|
#define HD44780_CT_USS720 18
|
||||||
|
#define HD44780_CT_USBLCD 19
|
||||||
|
|
||||||
// symbolic names for interface types
|
// symbolic names for interface types
|
||||||
#define IF_TYPE_UNKNOWN 0
|
#define IF_TYPE_UNKNOWN 0
|
||||||
|
|||||||
@@ -0,0 +1,174 @@
|
|||||||
|
/** \file server/drivers/hd44780-usblcd.c
|
||||||
|
* \c ucdlcd connection type of \c hd44780 driver for Hitachi HD44780 based LCD
|
||||||
|
* displays. This driver does only work with Linux and requires a kernel driver
|
||||||
|
* available since 2.4.20-pre7.
|
||||||
|
*
|
||||||
|
* See http://www.usblcd.de for hardware and documentation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2002 Adams IT Services <info@usblcd.de>
|
||||||
|
*
|
||||||
|
* This driver is based on pic-an-lcd driver. See file hd44780-serial.c for
|
||||||
|
* additional Copyrights.
|
||||||
|
*
|
||||||
|
* This file is released under the GNU General Public License. Refer to the
|
||||||
|
* COPYING file distributed with this package.
|
||||||
|
*
|
||||||
|
* Modified February 2009 by Markus Dolze to use API v0.5.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "hd44780-usblcd.h"
|
||||||
|
#include "shared/report.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_DEVICE "/dev/usb/lcd"
|
||||||
|
|
||||||
|
#define IOCTL_GET_HARD_VERSION 1
|
||||||
|
#define IOCTL_GET_DRV_VERSION 2
|
||||||
|
|
||||||
|
void usblcd_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
|
||||||
|
void usblcd_HD44780_backlight(PrivateData *p, unsigned char state);
|
||||||
|
void usblcd_HD44780_close(PrivateData *p);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the driver.
|
||||||
|
* \param drvthis Pointer to driver structure.
|
||||||
|
* \retval 0 Success.
|
||||||
|
* \retval -1 Error opening device.
|
||||||
|
* \retval -2 Error reading or unsupported driver version.
|
||||||
|
* \retval -3 Error reading or unsupported hardware version.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
hd_init_usblcd(Driver *drvthis)
|
||||||
|
{
|
||||||
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
|
|
||||||
|
char device[256] = DEFAULT_DEVICE;
|
||||||
|
char buf[128];
|
||||||
|
int major, minor;
|
||||||
|
|
||||||
|
/* Get device to use */
|
||||||
|
strncpy(device, drvthis->config_get_string(drvthis->name, "device", 0, DEFAULT_DEVICE), sizeof(device));
|
||||||
|
device[sizeof(device) - 1] = '\0';
|
||||||
|
report(RPT_INFO, "HD44780: USBLCD: using device: %s", device);
|
||||||
|
|
||||||
|
/* Set up io port correctly, and open it... */
|
||||||
|
p->fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||||
|
if (p->fd == -1) {
|
||||||
|
report(RPT_ERR, "HD44780: USBLCD: could not open device %s (%s)", device, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read and check kernel driver version */
|
||||||
|
memset(buf, 0, 128);
|
||||||
|
if (ioctl(p->fd, IOCTL_GET_DRV_VERSION, buf) != 0) {
|
||||||
|
report(RPT_ERR, "IOCTL failed, could not get Driver Version");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
report(RPT_INFO, "Driver Version: %s", buf);
|
||||||
|
|
||||||
|
if (sscanf(buf, "USBLCD Driver Version %d.%d", &major, &minor) != 2) {
|
||||||
|
report(RPT_ERR, "Could not read Driver Version");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
if (major != 1) {
|
||||||
|
report(RPT_ERR, "Driver Version not supported");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read and check hardware version */
|
||||||
|
memset(buf, 0, 128);
|
||||||
|
if (ioctl(p->fd, IOCTL_GET_HARD_VERSION, buf) != 0) {
|
||||||
|
report(RPT_ERR, "IOCTL failed, could not get Hardware Version");
|
||||||
|
return -3;
|
||||||
|
};
|
||||||
|
report(RPT_INFO, "Hardware Version: %s", buf);
|
||||||
|
if (sscanf(buf, "%d.%d", &major, &minor) != 2) {
|
||||||
|
report(RPT_ERR, "Could not read Hardware Version");
|
||||||
|
return -3;
|
||||||
|
};
|
||||||
|
if (major != 1) {
|
||||||
|
report(RPT_ERR, "Hardware Version not supported");
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set local functions */
|
||||||
|
p->hd44780_functions->senddata = usblcd_HD44780_senddata;
|
||||||
|
p->hd44780_functions->backlight = usblcd_HD44780_backlight;
|
||||||
|
p->hd44780_functions->close = usblcd_HD44780_close;
|
||||||
|
|
||||||
|
common_init(p, IF_8BIT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send data or commands to the display.
|
||||||
|
* \param p Pointer to driver's private data structure.
|
||||||
|
* \param displayID ID of the display (or 0 for all) to send data to.
|
||||||
|
* \param flags Defines whether to end a command or data.
|
||||||
|
* \param ch The value to send.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
usblcd_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
|
||||||
|
{
|
||||||
|
static const char instr_byte = 0;
|
||||||
|
|
||||||
|
if (flags == RS_DATA) {
|
||||||
|
/*
|
||||||
|
* Escape data byte 0x00 by sending it twice because it is
|
||||||
|
* used as instruction byte
|
||||||
|
*/
|
||||||
|
if (ch == '\0')
|
||||||
|
write(p->fd, &ch, 1);
|
||||||
|
write(p->fd, &ch, 1);
|
||||||
|
} else {
|
||||||
|
/* Instructions are sent prepending 0x00 as escape sequence */
|
||||||
|
write(p->fd, &instr_byte, 1);
|
||||||
|
write(p->fd, &ch, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn display backlight on or off.
|
||||||
|
* \param p Pointer to driver's private data structure.
|
||||||
|
* \param state New backlight status.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
usblcd_HD44780_backlight(PrivateData *p, unsigned char state)
|
||||||
|
{
|
||||||
|
static const char instr_byte = 0;
|
||||||
|
static const char bl_on = 0x21;
|
||||||
|
static const char bl_off = 0x20;
|
||||||
|
|
||||||
|
write(p->fd, &instr_byte, 1);
|
||||||
|
|
||||||
|
if (state == BACKLIGHT_OFF)
|
||||||
|
write(p->fd, &bl_off, 1);
|
||||||
|
else
|
||||||
|
write(p->fd, &bl_on, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the driver (do necessary clean-up).
|
||||||
|
* \param p Pointer to driver's private data structure.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
usblcd_HD44780_close(PrivateData *p)
|
||||||
|
{
|
||||||
|
close(p->fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef HD_USBLCD_H
|
||||||
|
#define HD_USBLCD_H
|
||||||
|
|
||||||
|
#include "lcd.h" /* for lcd_logical_driver */
|
||||||
|
#include "hd44780-low.h" /* for HD44780_functions */
|
||||||
|
|
||||||
|
// initialise this particular driver, args is probably not used but keep
|
||||||
|
// for consistency
|
||||||
|
int hd_init_usblcd(Driver *drvthis);
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user