LCDproc development and user support list

Text archives Help


Fwd: Re: [Lcdproc] Re: VLSYS L.I.S 2005 Driver written


Chronological Thread 
  • From: daryl AT rainyday.ca (Daryl F)
  • Subject: Fwd: Re: [Lcdproc] Re: VLSYS L.I.S 2005 Driver written
  • Date: Thu May 24 01:31:01 2007

Peter Marschall wrote:
> Hi Daryl,
>
> On Monday, 14. May 2007 06:21, Daryl F wrote:
>> I obtained the latest CVS tarball and retrofitted my changes to it as
>> you requested.
>>
>> I addressed one of the issues from paul_c and Todd Luliak, namely I
>> added a test for the correct level of support in libftdi to acinclude.m4.
>>
>> The other issue of 'configure: error: Unknown driver lis' will already
>> be handled when compiling from CVS due to the use of `sh autogen.sh` to
>> run aclocal, automake, and autoconf. That also reduces the size of my
>> patch greatly since I don't have to provide an update to the configure
>> script, just patch acinclude.m4.
>>
>> If I need to make any more changes I look forward to your requests.
>
> I committed the lis driver to CVS (with a few little aesthetical
> changes ;-).
>
> While browsing through the code a bit, I found a few issues:
> - I consider set_custom_chars() a kludge.
> In principle it does the same as the standard set_chars(),
> but uses a different way of
> Try to switch to set_char().
> This will make the implementation of hbar() simpler,
> and allow for a simple implementation of vbar()
> as well as num() because you can use the helper functions
> that use set_char().
> Have a look at the IOWarrior or CFontzPacket() drivers
> for examples.
>
> - Please add the missing functions:
> cellheight(), cellwidth(), get_free_chars()
> You'll need them, because the support functions require them.
>
> - Please document the requirements (required libraries)
> of the lis driver and its restrictions in the docbook file
> so that users know what they need to get it running and
> what they can expect from it.
> (Hopefully you do not need to document restrictions
> due to my constant nagging ;-)))
>
> Thanks for supporting LCDproc
> Peter
>

Hi Peter,

I analyzed the CFontPacket and IOWarrior code's use of the helper
functions. They won't work well with lis because the device won't let me
write to specific columns and only has eight customizable characters.

The problem occurs when the lib_hbar function writes on the left side of
the display and uses custom characters to do it. Later, if a client
writes on the right side of the display, also using say bignums, the
custom characters for the horizontal bar are no longer present in the
device when lis is forced to rewrite the line starting at column 1.
Garbage results. Too bad VLSystem wouldn't release more information on
the device.

I can't believe I managed to lose my updates to the docbook files. But
it turned out for the best. In thoroughly documenting it I found I'd
left support in for Device= in the config file from an earlier attempt
to use libusb. It should be VendorID= and ProductID= now that I'm using
libftdi.

I documented the requirement to have libftdi installed when building
lcdproc with the lis driver.

I also cleaned up the lis.c source file a bit, moving some constants to
lis.h where they belong, getting rid of some spaces that should have
been tabs to make the code format better. And removing some unreachable
code, namely a test function I'd used in the past.

Cleaned unneeded function prototypes out of lis.h

Also changed the default Brightness= in lis.c to 1000 as that is what
the comments in LCDd.conf actually said. Update the comments in
LCDd.conf as Brightness= can only control four different settings on the
actual device.

Regards,
Daryl
diff -ruN lcdproc-CVS-current-20070521/LCDd.conf
lcdproc-CVS-current-20070521-lis-r1/LCDd.conf
--- lcdproc-CVS-current-20070521/LCDd.conf 2007-05-18 02:00:38.000000000
-0500
+++ lcdproc-CVS-current-20070521-lis-r1/LCDd.conf 2007-05-23
07:09:45.000000000 -0500
@@ -622,12 +622,18 @@
## LIS MCE 2005 driver ##
[lis]

-# USB device to use [default: /dev/ttyUSB0]
-Device=/dev/ttyUSB0
-
# Set the initial brightness [default: 1000; legal: 0 - 1000]
-Brightness=1000
+# 0-250 = 25%, 251-500 = 50%, 501-750 = 75%, 751-1000 = 100%
+#Brightness=1000
+
+# Columns by lines (default 20x2)
+#Size=20x2
+
+# USB Vendor ID (default 0x0403)
+VendorID=0x0403

+# USB Product ID (default 0x6001
+ProductID=0x6001


##The driver for the VFD of the Medion MD8800 PC ##
diff -ruN lcdproc-CVS-current-20070521/docs/lcdproc-user/drivers/lis.docbook
lcdproc-CVS-current-20070521-lis-r1/docs/lcdproc-user/drivers/lis.docbook
--- lcdproc-CVS-current-20070521/docs/lcdproc-user/drivers/lis.docbook
1969-12-31 18:00:00.000000000 -0600
+++ lcdproc-CVS-current-20070521-lis-r1/docs/lcdproc-user/drivers/lis.docbook
2007-05-23 07:26:19.000000000 -0500
@@ -0,0 +1,116 @@
+<sect1 id="lis-howto">
+<title>The lis Driver</title>
+
+<para>
+ This section talks about using LCDproc with the VLSystem L.I.S
+ MCE 2005 Vacuum Flourescent Display (VFD) based on the FTDI USB-to-serial
+ converter, the Microchip PIC-16F716 microcontroller, and
+ the NEC UPD16314 display driver manufactured by
+ <ulink url="http://www.vlsys.co.kr";>VLSystem
(http://www.vlsys.co.kr)</ulink>.
+</para>
+
+<!-- ## VLSys lis driver ## -->
+<sect2 id="lis-features">
+<title>Features</title>
+
+<para>
+This device uses a vacuum flourescent display of 20 characters by 2 lines.
Each each
+character is 5 pixels wide by 8 pixels high. The device is connected by USB.
The FTDI chip
+translates the USB protocol to serial expected by the VFD driver chip, an
NEC UPD16314. A
+programmable interrupt controller (PIC), the PIC16F716 by Microchip,
provides the glue
+between the FTDI and the NEC chips.
+</para>
+
+
+</sect2>
+
+<sect2 id="lis-requirements">
+<title>Requirements</title>
+
+<para>
+The driver depends on libftdi, version 0.8 or higher, from
+<ulink url="http://www.intra2net.com/opensource/ftdi/";>
+http://www.intra2net.com/opensource/ftdi/</ulink>.
+</para>
+
+</sect2>
+<sect2 id="lis-compiling">
+<title>Compiling</title>
+
+<para>
+Make sure that the L.I.S files are built when you run configure. This
+can be done by specifying "--enable-drivers=all" or by
+"--enable-drivers=lis".
+</para>
+
+</sect2>
+<sect2 id="lis-config">
+<title>Configuration in LCDd.conf</title>
+
+<sect3 id="lis-config-section">
+<title>[lis]</title>
+
+<variablelist>
+<varlistentry>
+ <term>
+ <command>Size=</command>
+ <arg choice="plain">
+ <replaceable>WIDTH</replaceable>
+ <literal>x</literal>
+ <replaceable>HEIGHT</replaceable>
+ </arg>
+ </term>
+ <listitem><para>
+ Set the display size. The default <literal>20x2</literal> should be safe
+ for most if not all users, since the device seeems to be made only with
+ this one size.
+ But who knowns &hellip;
+ </para></listitem>
+</varlistentry>
+<varlistentry>
+ <term>
+ <command>VendorID=</command>
+ <arg choice="plain">
+ <replaceable>VENDORID</replaceable>
+ </arg>
+ </term>
+ <listitem><para>
+ USB Vendor ID
+ [default: <literal>0x0403</literal>].
+ </para></listitem>
+</varlistentry>
+<varlistentry>
+ <term>
+ <command>ProductID=</command>
+ <arg choice="plain">
+ <replaceable>PRODUCTID</replaceable>
+ </arg>
+ </term>
+ <listitem><para>
+ USB Product ID
+ [default: <literal>0x6001</literal>].
+ </para></listitem>
+</varlistentry>
+<varlistentry>
+ <term>
+ <command>Brightness=</command>
+ <arg choice="plain"><replaceable>BRIGHTNESS</replaceable></arg>
+ </term>
+ <listitem>
+ <para>
+ Set the initial brightness [default: <literal>1000</literal>;
+ legal: <literal>0</literal> - <literal>1000</literal>. Values
+ between 0 and 250 give 25% brightness, 251 to 500 give 50% brightness,
+ 501 and 750, give 75% brightness, and values higher than 751 give 100%
+ brightness.
+ </para>
+ </listitem>
+</varlistentry>
+
+</variablelist>
+
+</sect3>
+
+</sect2>
+
+</sect1>
diff -ruN lcdproc-CVS-current-20070521/server/drivers/lis.c
lcdproc-CVS-current-20070521-lis-r1/server/drivers/lis.c
--- lcdproc-CVS-current-20070521/server/drivers/lis.c 2007-05-17
07:08:16.000000000 -0500
+++ lcdproc-CVS-current-20070521-lis-r1/server/drivers/lis.c 2007-05-23
19:46:38.000000000 -0500
@@ -7,8 +7,7 @@
* This driver uses the libftdi library to interface to the FTDI chip. Make
* sure kernel module ftdi_sio doesn't claim the device.
*
- * Based on the ula200 driver Copyright (C) 2006, Bernhard Walle
- * and the CrystalFontz 633 driver Copyright (C) 2002 David GLAUDE
+ * Based on: ula200 driver Copyright (C) 2006, Bernhard Walle
*
* Copyright (c) 2007, Daryl Fonseca-Holt
<wyatt AT prairieturtle.ca>
*
@@ -33,6 +32,16 @@
* was which line would be written at column 1.
*/

+/* CHANGES:
+ *
+ * 2007/05/22 Removed useless Device= config option.
+ * Added VendorID= and ProductID= config
+ * option parsting. Moved constants to
+ * lis.h where they belong. Added
+ * lis_cellheight() and lis_cellwidth().
+ * Completely commented out lis_test() to
+ * save memory.
+ */
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -57,7 +66,7 @@
#include "lcd_lib.h"
#include "timing.h"

-void lis_test(Driver *drvthis);
+// void lis_test(Driver *drvthis);

/* Vars for the server core */
MODULE_EXPORT char *api_version = API_VERSION;
@@ -66,17 +75,6 @@
MODULE_EXPORT char *symbol_prefix = "lis_";


-///////////////////////////////////////////////////////////////////////////////
-// constants
-//
-#define DISPLAY_VENDOR_ID 0x0403
-#define DISPLAY_PRODUCT_ID 0x6001
-
-#define CELLWIDTH 5
-#define CELLHEIGHT 8
-
-#define DEFAULT_BRIGHTNESS 750
-
/*
* Charactar mapping for UPD16314 device by Daryl Fonseca-Holt
*
<wyatt AT prairieturtle.ca>
taken from Mark Haemmerling's HD44780 table.
@@ -96,82 +94,50 @@
*/

const unsigned char UPD16314_charmap[] = {
- /* #0 */
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- /* #32 */
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63,
- /* #64 */
- 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 47, 93, 94, 95,
- /* #96 */
- 96, 97, 98, 99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127,
- /* #128 */
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- /* #160 */
- 160, 33, 236, 237, 164, 92, 124, 167,
- 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 186, 187, 188, 189, 190, 191,
- /* #192 */
- 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215,
- 216, 217, 218, 219, 220, 221, 223, 224,
- /* #224 */
- 224, 225, 226, 227, 228, 229, 230, 231,
- 232, 233, 234, 235, 237, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247,
- 248, 249, 250, 251, 252, 253, 254, 3
+ /* #0 */
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31,
+ /* #32 */
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63,
+ /* #64 */
+ 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 89, 90, 91, 47, 93, 94, 95,
+ /* #96 */
+ 96, 97, 98, 99, 100, 101, 102, 103,
+ 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127,
+ /* #128 */
+ 128, 129, 130, 131, 132, 133, 134, 135,
+ 136, 137, 138, 139, 140, 141, 142, 143,
+ 144, 145, 146, 147, 148, 149, 150, 151,
+ 152, 153, 154, 155, 156, 157, 158, 159,
+ /* #160 */
+ 160, 33, 236, 237, 164, 92, 124, 167,
+ 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 177, 178, 179, 180, 181, 182, 183,
+ 184, 185, 186, 187, 188, 189, 190, 191,
+ /* #192 */
+ 192, 193, 194, 195, 196, 197, 198, 199,
+ 200, 201, 202, 203, 204, 205, 206, 207,
+ 208, 209, 210, 211, 212, 213, 214, 215,
+ 216, 217, 218, 219, 220, 221, 223, 224,
+ /* #224 */
+ 224, 225, 226, 227, 228, 229, 230, 231,
+ 232, 233, 234, 235, 237, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247,
+ 248, 249, 250, 251, 252, 253, 254, 3
};



///////////////////////////////////////////////////////////////////////////////
-// private data types
-//
-typedef struct {
-
- // the handle for the USB FTDI library
- struct ftdi_context ftdic;
-
- // the width and the height (in number of characters) of the library
- int width, height;
-
- // The framebuffer and the framebuffer for the last contents (incr.
update)
- unsigned char *framebuf;
-
- // dirty line flags
- unsigned int *line_flags;
-
- // child thread flag
- int child_flag;
-
- // parent thread flag
- int parent_flag;
-
- // display brightness 0-1000
- int brightness;
-
- // custom characters loaded
- int cc_flag;
-
-} PrivateData;
-
-
-///////////////////////////////////////////////////////////////////////////////
// Write a command to the display.
//
// @param p the private data
@@ -182,18 +148,18 @@
static int
lis_ftdi_write_command(Driver *drvthis, unsigned char *data, int length)
{
- PrivateData *p = (PrivateData *) drvthis->private_data;
- int err;
+ PrivateData *p = (PrivateData *) drvthis->private_data;
+ int err;

- err = ftdi_write_data(&p->ftdic, data, length);
- if (err < 0) {
- report(RPT_WARNING, "%s: ftdi_write_data failed with %d",
drvthis->name, err);
- return -1;
- }
+ err = ftdi_write_data(&p->ftdic, data, length);
+ if (err < 0) {
+ report(RPT_WARNING, "%s: ftdi_write_data failed with %d",
drvthis->name, err);
+ return -1;
+ }

- timing_uPause(16000);
+ timing_uPause(16000);

- return 0;
+ return 0;
}


//////////////////////////////////////////////////////////////////////////////
@@ -202,30 +168,30 @@
static int
lis_ftdi_line_to_display(Driver *drvthis, int line, unsigned char *string,
int len)
{
- PrivateData *p = (PrivateData *) drvthis->private_data;
- unsigned char buffer[128];
- int err;
- int i;
-
- if (len > p->width || line < 1 || line > p->height) {
- return -EINVAL;
- }
- buffer[0] = 0xA0 + line;
- buffer[1] = 0;
- buffer[2] = 0xA7;
-
- for (i=0; i < len; i++) {
- buffer[i+3] = UPD16314_charmap[(unsigned char)string[i]];
- }
- buffer[i+3] = 0x00;
-
- err = lis_ftdi_write_command(drvthis, buffer, len+4);
- if (err < 0) {
- report(RPT_WARNING, "%s: lis_ftdi_string: "
- "lis_ftdi_write_command() failed",
drvthis->name);
- }
+ PrivateData *p = (PrivateData *) drvthis->private_data;
+ unsigned char buffer[128];
+ int err;
+ int i;
+
+ if (len > p->width || line < 1 || line > p->height) {
+ return -EINVAL;
+ }
+ buffer[0] = 0xA0 + line;
+ buffer[1] = 0;
+ buffer[2] = 0xA7;
+
+ for (i=0; i < len; i++) {
+ buffer[i+3] = UPD16314_charmap[(unsigned char)string[i]];
+ }
+ buffer[i+3] = 0x00;

- return err;
+ err = lis_ftdi_write_command(drvthis, buffer, len+4);
+ if (err < 0) {
+ report(RPT_WARNING, "%s: lis_ftdi_string: "
+ "lis_ftdi_write_command() failed", drvthis->name);
+ }
+
+ return err;
}


@@ -256,103 +222,103 @@
lis_load_custom_chars(Driver *drvthis)
{
PrivateData *p = (PrivateData *) drvthis->private_data;
- int i, col, row, err;
+ int i, col, row, err;
unsigned char buffer[65];
char custom_chars[8][CELLHEIGHT*CELLHEIGHT] = {
- { 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0 },
- { 1, 0, 0, 0, 0, /* 1-5 characters used by
hbar() */
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0,
- 1, 0, 0, 0, 0 },
- { 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0,
- 1, 1, 0, 0, 0,
-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the buffer */
+ for (row = 0; row < CELLHEIGHT; row++) {
+ unsigned char value = 0;

- for (col = 0; col < CELLWIDTH; col++) {
+ for (col = 0; col < CELLWIDTH; col++) {
value <<= 1;
value |= (custom_chars[i][(row * CELLWIDTH) +
col] > 0) ? 1 : 0;
- }
+ }
buffer[(i*8)+row+1] = value;
- }
- }
- err = lis_ftdi_write_command(drvthis, buffer, 65);
- if (err < 0) {
- report(RPT_WARNING, "%s: lis_load_custom_chars(): "
- "lis_ftdi_write_command() failed",
drvthis->name);
- }
+ }
+ }
+ err = lis_ftdi_write_command(drvthis, buffer, 65);
+ if (err < 0) {
+ report(RPT_WARNING, "%s: lis_load_custom_chars(): "
+ "lis_ftdi_write_command() failed", drvthis->name);
+ }
else
p->cc_flag = 1;

- return err;
+ return err;
}


//////////////////////////////////////////////////////////////////////////////
-// Seperate thread to keep a read up on the USB device at all times
+// Separate thread to keep a read up on the USB device at all times
int
lis_read_thread(void *arg)
{
@@ -388,7 +354,7 @@
PrivateData *p = (PrivateData *) drvthis->private_data;

if (promille < 0 || promille > 1000)
- return -EINVAL;
+ return -EINVAL;

buffer[0] = 0xA5;
if ( promille < 251 )
@@ -400,11 +366,11 @@
else
buffer[1] = 0x0; // 100%

- err = ftdi_write_data(&p->ftdic, buffer, 2);
- if (err < 0) {
- report(RPT_WARNING, "%s: lis_set_brightness(): ftdi_write_data
failed with %d", drvthis->name, err);
- return err;
- }
+ err = ftdi_write_data(&p->ftdic, buffer, 2);
+ if (err < 0) {
+ report(RPT_WARNING, "%s: lis_set_brightness():
ftdi_write_data failed with %d", drvthis->name, err);
+ return err;
+ }
else
p->brightness = promille;
return 0;
@@ -448,8 +414,8 @@
// Get and parse size
s = drvthis->config_get_string( drvthis->name, "size", 0, "20x2");
if ((sscanf(s, "%dx%d", &(p->width), &(p->height)) != 2)
- || (p->width <= 0) || (p->width > LCD_MAX_WIDTH)
- || (p->height <= 0) || (p->height > LCD_MAX_HEIGHT)) {
+ || (p->width <= 0) || (p->width > LCD_MAX_WIDTH)
+ || (p->height <= 0) || (p->height > LCD_MAX_HEIGHT)) {
report(RPT_ERR, "%s: cannot read Size %s", drvthis->name, s);
return -1;
}
@@ -471,6 +437,9 @@
}
p->brightness = count;

+ p->VendorID = drvthis->config_get_int(drvthis->name, "VendorID", 0,
DISPLAY_VENDOR_ID);
+ p->ProductID = drvthis->config_get_int(drvthis->name, "ProductID", 0,
DISPLAY_PRODUCT_ID);
+
/* End of config file parsing */


@@ -492,9 +461,12 @@
// (&p->ftdic)->usb_read_timeout = 20;

// open the device
- err = ftdi_usb_open(&p->ftdic, DISPLAY_VENDOR_ID, DISPLAY_PRODUCT_ID);
+ err = ftdi_usb_open(&p->ftdic, p->VendorID, p->ProductID);
if (err < 0) {
- report(RPT_ERR, "%s: cannot open USB device", drvthis->name);
+ report(RPT_ERR, "%s: cannot open USB device %x:%x",
+ drvthis->name
+ p->VendorID,
+ p->ProductID);
goto err_framebuf;
}

@@ -1042,11 +1014,11 @@
// don't know what this does exactly
buffer[0] = 0xA4;
buffer[1] = 0x7d;
- err = ftdi_write_data(&p->ftdic, buffer, 2);
- if (err < 0) {
- report(RPT_WARNING, "%s: ftdi_write_data failed with %d",
drvthis->name, err);
- goto err_ftdi;
- }
+ err = ftdi_write_data(&p->ftdic, buffer, 2);
+ if (err < 0) {
+ report(RPT_WARNING, "%s: ftdi_write_data failed with %d",
drvthis->name, err);
+ goto err_ftdi;
+ }

timing_uPause(3*16000);

@@ -1054,7 +1026,7 @@
buffer[1] = 0xAA;
for(count = 0; count < 10; count++) {
err = ftdi_write_data(&p->ftdic, buffer, 2);
- if (err < 0) {
+ if (err < 0) {
report(RPT_WARNING, "%s: ftdi_write_data failed with
%d", drvthis->name, err);
goto err_ftdi;
}
@@ -1182,12 +1154,12 @@
// timing_uPause(2*16000);

// not sure about this
- buffer[0] = 0xA0;
- err = lis_ftdi_write_command(drvthis, buffer, 1);
- if (err < 0) {
- report(RPT_WARNING, "%s: lis_ftdi_clear: "
- "lis_ftdi_write_command failed", drvthis->name);
- }
+ buffer[0] = 0xA0;
+ err = lis_ftdi_write_command(drvthis, buffer, 1);
+ if (err < 0) {
+ report(RPT_WARNING, "%s: lis_ftdi_clear: "
+
"lis_ftdi_write_command failed", drvthis->name);
+ }

timing_uPause(10*16000);

@@ -1235,7 +1207,7 @@
ftdi_deinit(&p->ftdic);

if (p->framebuf != NULL)
- free(p->framebuf);
+ free(p->framebuf);

free(p);
}
@@ -1277,6 +1249,7 @@
memset(p->framebuf + (line * p->width), ' ', p->width);
p->line_flags[line] = 1;
}
+ p->ccmode = standard;
}


///////////////////////////////////////////////////////////////////////////////
@@ -1448,6 +1421,9 @@
}


+
+
+#if 0
void
lis_test(Driver *drvthis)
{
@@ -1463,3 +1439,4 @@
lis_flush(drvthis);
}
}
+#endif
diff -ruN lcdproc-CVS-current-20070521/server/drivers/lis.h
lcdproc-CVS-current-20070521-lis-r1/server/drivers/lis.h
--- lcdproc-CVS-current-20070521/server/drivers/lis.h 2007-05-17
07:08:16.000000000 -0500
+++ lcdproc-CVS-current-20070521-lis-r1/server/drivers/lis.h 2007-05-23
19:48:23.000000000 -0500
@@ -1,21 +1,21 @@

/*
- Based on the lis driver Copyright (C) 2006, Bernhard Walle
- Copyright (c) 2007, Daryl Fonseca-Holt
<wyatt AT prairieturtle.ca>
+ Based on the lis driver Copyright (C) 2006, Bernhard Walle
+ Copyright (c) 2007, Daryl Fonseca-Holt
<wyatt AT prairieturtle.ca>

- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
*/
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 */
#ifndef LIS_H
#define LIS_H

@@ -27,6 +27,55 @@
# define false 0
#endif

+///////////////////////////////////////////////////////////////////////////////
+// constants
+//
+#define DISPLAY_VENDOR_ID 0x0403
+#define DISPLAY_PRODUCT_ID 0x6001
+
+#define CELLWIDTH 5
+#define CELLHEIGHT 8
+
+#define DEFAULT_BRIGHTNESS 1000
+
+
+///////////////////////////////////////////////////////////////////////////////
+// private data types
+//
+typedef struct {
+
+ // the handle for the USB FTDI library
+ struct ftdi_context ftdic;
+
+ // the width and the height (in number of characters) of the library
+ int width, height;
+
+ // The framebuffer and the framebuffer for the last contents (incr.
update)
+ unsigned char *framebuf;
+
+ // dirty line flags
+ unsigned int *line_flags;
+
+ // child thread flag
+ int child_flag;
+
+ // parent thread flag
+ int parent_flag;
+
+ // display brightness 0-1000
+ int brightness;
+
+ // custom characters loaded?
+ int cc_flag;
+
+ // USB Vendor ID
+ int VendorID;
+
+ // USB Product ID
+ int ProductID;
+
+} PrivateData;
+
MODULE_EXPORT int lis_init(Driver *drvthis);
MODULE_EXPORT void lis_close (Driver *drvthis);
MODULE_EXPORT int lis_width (Driver *drvthis);
@@ -34,11 +83,9 @@
MODULE_EXPORT void lis_clear (Driver * drvthis);
MODULE_EXPORT void lis_string (Driver * drvthis, int x, int y, char
string[]);
MODULE_EXPORT void lis_chr (Driver * drvthis, int x, int y, char c);
-MODULE_EXPORT void lis_set_char (Driver * drvthis, int n, char *dat);
MODULE_EXPORT void lis_flush (Driver * drvthis);
MODULE_EXPORT void lis_vbar (Driver * drvthis, int x, int y, int len, int
promille, int options);
MODULE_EXPORT void lis_hbar (Driver * drvthis, int x, int y, int len, int
promille, int options);
-MODULE_EXPORT void lis_num (Driver * drvthis, int x, int num);
MODULE_EXPORT int lis_icon(Driver * drvthis, int x, int y, int icon);

#endif /* LIS_H */



Archive powered by MHonArc 2.6.18.

Top of page