adapted doc & coding stle a bit more to LCDproc
This commit is contained in:
@@ -9,33 +9,37 @@
|
|||||||
The picoLCD page indicates that the device can be connected via I2C or USART.
|
The picoLCD page indicates that the device can be connected via I2C or USART.
|
||||||
This lcdproc driver, however, is limited to the USB connected model.
|
This lcdproc driver, however, is limited to the USB connected model.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect2 id="picolcd-setup">
|
<sect2 id="picolcd-setup">
|
||||||
<title>Setting up the picoLCD</title>
|
<title>Setting up the picoLCD</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The picoLCD device as used by this driver is USB connected and may be purchased
|
The picoLCD device as used by this driver is USB connected and may be purchased
|
||||||
with an internal USB header connector (5-pin to 5-pin) or an external cable
|
with an internal USB header connector (5-pin to 5-pin) or an external cable
|
||||||
(Type-A to 5-pin). See: http://www.mini-box.com/picoLCD-20x2-OEM. It may also
|
(Type-A to 5-pin). See: <ulink url="http://www.mini-box.com/picoLCD-20x2-OEM"/>.
|
||||||
come pre-installed on systems like the Mini-Box M300:
|
It may also come pre-installed on systems like the Mini-Box M300:
|
||||||
http://www.mini-box.com/Mini-Box-M300-LCD.
|
<ulink url="http://www.mini-box.com/Mini-Box-M300-LCD"/>.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Using the USB LCD with this driver requires the usblcd library from Mini-box.com
|
Using the USB LCD with this driver requires the usblcd library from Mini-box.com
|
||||||
(avaiable at http://www.mini-box.com/picoLCD-20x2-OEM). The usblcd library
|
(avaiable at <ulink url="http://www.mini-box.com/picoLCD-20x2-OEM"/>).i
|
||||||
|
The usblcd library
|
||||||
requires libusb and libhcd. Your distribution may or may not already provide
|
requires libusb and libhcd. Your distribution may or may not already provide
|
||||||
these libraries. The only kernel driver required is the USB host controller
|
these libraries. The only kernel driver required is the USB host controller
|
||||||
driver (uhci_hcd on the M300) required to fire up the usb bus to which the LCD is
|
driver (uhci_hcd on the M300) required to fire up the usb bus to which the LCD is
|
||||||
attached.
|
attached.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Lastly, the usbfs file system must be mounted on /proc/bus/usb.
|
Lastly, the usbfs file system must be mounted on <filename>/proc/bus/usb</filename>.
|
||||||
<code>mount -t usbfs usbfs /proc/bus/usb</code>
|
<code>mount -t usbfs usbfs /proc/bus/usb</code>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Once connected and with libusblcd, libusb and libhid installed, testing the USB LCD
|
Once connected and with libusblcd, libusb and libhid installed, testing the USB LCD
|
||||||
can be done with the "usblcd" program that comes with the usblcd library. You can
|
can be done with the <command>usblcd</command> program that comes with the usblcd
|
||||||
also change the USB LCD's initial display (what it shows when you initialize the
|
library.
|
||||||
device) by using the usblcd binary's "splash" command.
|
You can also change the USB LCD's initial display (what it shows when you
|
||||||
|
initialize the device) by using the <command>usblcd</command> binary's
|
||||||
|
<command>splash</command> command.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
To use the picolcd with lcdproc, add picolcd to the lcdproc configure drivers option
|
To use the picolcd with lcdproc, add picolcd to the lcdproc configure drivers option
|
||||||
@@ -44,59 +48,145 @@
|
|||||||
simple items, like contrast and which keys to lights up.
|
simple items, like contrast and which keys to lights up.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="picolcd-options">
|
|
||||||
<para>
|
<sect2 id="picolcd-config">
|
||||||
|
<title>Configuration in LCDd.conf</title>
|
||||||
|
|
||||||
|
<sect3 id="picolcd-config-section">
|
||||||
|
<title>[picolcd]</title>
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>Contrast=</command>
|
||||||
|
<arg choice="plain"><replaceable>CONTRAST</replaceable></arg>
|
||||||
|
</term>
|
||||||
|
<listitem><para>
|
||||||
Contrast: 0-1000. 0 is visible, and 1000 is not on my M300. Default is 0.
|
Contrast: 0-1000. 0 is visible, and 1000 is not on my M300. Default is 0.
|
||||||
</para>
|
</para></listitem>
|
||||||
<para>
|
</varlistentry>
|
||||||
Keylights: 0/1. 0 turns off the key LEDs and 1 turns them on. Default is 1.
|
<varlistentry>
|
||||||
</para>
|
<term>
|
||||||
</sect2>
|
<command>KeyLights=</command>
|
||||||
<sect2>
|
<arg choice="plain">
|
||||||
<para>
|
<group choice="req">
|
||||||
Key0Light: if Keylights is set to 1, you can disable the directional pad LED by
|
<arg choice="plain"><literal><emphasis>yes</emphasis></literal></arg>
|
||||||
setting this value to 0. Default is 1.
|
<arg choice="plain"><literal>no</literal></arg>
|
||||||
</para>
|
</group>
|
||||||
</sect2>
|
</arg>
|
||||||
<sect2>
|
</term>
|
||||||
<para>
|
<listitem><para>
|
||||||
Key1Light: if Keylights is set to 1, you can disable the F1 LED by setting this value
|
Allow key LEDs to be turned on or off. Default is <literal>yes</literal>.
|
||||||
to 0. Default is 1.
|
</para></listitem>
|
||||||
</para>
|
</varlistentry>
|
||||||
</sect2>
|
<varlistentry>
|
||||||
<sect2>
|
<term>
|
||||||
<para>
|
<command>Key0Light=</command>
|
||||||
Key2Light: if Keylights is set to 1, you can disable the F2 LED by setting this value
|
<arg choice="plain">
|
||||||
to 0. Default is 1.
|
<group choice="req">
|
||||||
</para>
|
<arg choice="plain"><literal><emphasis>yes</emphasis></literal></arg>
|
||||||
</sect2>
|
<arg choice="plain"><literal>no</literal></arg>
|
||||||
<sect2>
|
</group>
|
||||||
<para>
|
</arg>
|
||||||
Key3Light: if Keylights is set to 1, you can disable the F3 LED by setting this value
|
</term>
|
||||||
to 0. Default is 1.
|
<listitem><para>
|
||||||
</para>
|
If Keylights is set, you can disable the directional pad LED by
|
||||||
</sect2>
|
setting this value to <literal>no</literal>. Default is <literal>yes</literal>.
|
||||||
<sect2>
|
</para></listitem>
|
||||||
<para>
|
</varlistentry>
|
||||||
Key4Light: if Keylights is set to 1, you can disable the F4 LED by setting this value
|
<varlistentry>
|
||||||
to 0. Default is 1.
|
<term>
|
||||||
</para>
|
<command>Key1Light=</command>
|
||||||
</sect2>
|
<arg choice="plain">
|
||||||
<sect2>
|
<group choice="req">
|
||||||
<para>
|
<arg choice="plain"><literal><emphasis>yes</emphasis></literal></arg>
|
||||||
Key5Light: if Keylights is set to 1, you can disable the F5 LED by setting this value
|
<arg choice="plain"><literal>no</literal></arg>
|
||||||
to 0. Default is 1.
|
</group>
|
||||||
</para>
|
</arg>
|
||||||
</sect2>
|
</term>
|
||||||
<sect2>
|
<listitem><para>
|
||||||
<para>
|
If Keylights is set, you can disable the F1 LED by setting this value
|
||||||
KeyTimeout: (Advanced) This value controls how long LCDd waits for a key press when
|
to <literal>no</literal>. Default is <literal>yes</literal>.
|
||||||
get_key is called. The value represents microseconds and the default is 500 or .5
|
</para></listitem>
|
||||||
seconds. Lowering this value will make LCDd more responsive but also causes LCDd to use
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>Key2Light=</command>
|
||||||
|
<arg choice="plain">
|
||||||
|
<group choice="req">
|
||||||
|
<arg choice="plain"><literal><emphasis>yes</emphasis></literal></arg>
|
||||||
|
<arg choice="plain"><literal>no</literal></arg>
|
||||||
|
</group>
|
||||||
|
</arg>
|
||||||
|
</term>
|
||||||
|
<listitem><para>
|
||||||
|
If Keylights is set, you can disable the F2 LED by setting this value
|
||||||
|
to <literal>no</literal>. Default is <literal>yes</literal>.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>Key3Light=</command>
|
||||||
|
<arg choice="plain">
|
||||||
|
<group choice="req">
|
||||||
|
<arg choice="plain"><literal><emphasis>yes</emphasis></literal></arg>
|
||||||
|
<arg choice="plain"><literal>no</literal></arg>
|
||||||
|
</group>
|
||||||
|
</arg>
|
||||||
|
</term>
|
||||||
|
<listitem><para>
|
||||||
|
If Keylights is set, you can disable the F3 LED by setting this value
|
||||||
|
to <literal>no</literal>. Default is <literal>yes</literal>.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>Key4Light=</command>
|
||||||
|
<arg choice="plain">
|
||||||
|
<group choice="req">
|
||||||
|
<arg choice="plain"><literal><emphasis>yes</emphasis></literal></arg>
|
||||||
|
<arg choice="plain"><literal>no</literal></arg>
|
||||||
|
</group>
|
||||||
|
</arg>
|
||||||
|
</term>
|
||||||
|
<listitem><para>
|
||||||
|
If Keylights is set, you can disable the F4 LED by setting this value
|
||||||
|
to <literal>no</literal>. Default is <literal>yes</literal>.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>Key5Light=</command>
|
||||||
|
<arg choice="plain">
|
||||||
|
<group choice="req">
|
||||||
|
<arg choice="plain"><literal><emphasis>yes</emphasis></literal></arg>
|
||||||
|
<arg choice="plain"><literal>no</literal></arg>
|
||||||
|
</group>
|
||||||
|
</arg>
|
||||||
|
</term>
|
||||||
|
<listitem><para>
|
||||||
|
If Keylights is set, you can disable the F5 LED by setting this value
|
||||||
|
to <literal>no</literal>. Default is <literal>yes</literal>.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command>KeyTimeout=</command>
|
||||||
|
<arg choice="plain"><replaceable>DURATION</replaceable></arg>
|
||||||
|
</term>
|
||||||
|
<listitem><para>
|
||||||
|
(Advanced) This value controls how long LCDd waits for a key press when
|
||||||
|
get_key() is called. The value represents microseconds and the default is <literal>500</literal>
|
||||||
|
or .5 seconds. Lowering this value will make LCDd more responsive but also causes LCDd to use
|
||||||
more CPU time and, as the timeout grows shorter, key presses become harder to detect.
|
more CPU time and, as the timeout grows shorter, key presses become harder to detect.
|
||||||
Larger values make key presses more reliable if somewhat slow to take effect.
|
Larger values make key presses more reliable if somewhat slow to take effect.
|
||||||
</para>
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
|
||||||
|
</sect3>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="picolcd-status">
|
<sect2 id="picolcd-status">
|
||||||
<title>picolcd driver status</title>
|
<title>picolcd driver status</title>
|
||||||
|
|
||||||
@@ -129,6 +219,7 @@
|
|||||||
the user is more than a tenth of a second (maybe less?) off in motions.
|
the user is more than a tenth of a second (maybe less?) off in motions.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="picolcd-copy">
|
<sect2 id="picolcd-copy">
|
||||||
<title>Copyright</title>
|
<title>Copyright</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -136,4 +227,5 @@
|
|||||||
or (woody@linif.org) and paid for by NitroSecurity, Inc (nitrosecurity.com).
|
or (woody@linif.org) and paid for by NitroSecurity, Inc (nitrosecurity.com).
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
<!ENTITY mtc_s16209x SYSTEM "drivers/mtc_s16209x.docbook">
|
<!ENTITY mtc_s16209x SYSTEM "drivers/mtc_s16209x.docbook">
|
||||||
<!ENTITY MtxOrb SYSTEM "drivers/mtxorb.docbook">
|
<!ENTITY MtxOrb SYSTEM "drivers/mtxorb.docbook">
|
||||||
<!ENTITY NoritakeVFD SYSTEM "drivers/NoritakeVFD.docbook">
|
<!ENTITY NoritakeVFD SYSTEM "drivers/NoritakeVFD.docbook">
|
||||||
|
<!ENTITY picolcd SYSTEM "drivers/picolcd.docbook">
|
||||||
<!ENTITY pylcd SYSTEM "drivers/pylcd.docbook">
|
<!ENTITY pylcd SYSTEM "drivers/pylcd.docbook">
|
||||||
<!ENTITY sed1330 SYSTEM "drivers/sed1330.docbook">
|
<!ENTITY sed1330 SYSTEM "drivers/sed1330.docbook">
|
||||||
<!ENTITY sed1520 SYSTEM "drivers/sed1520.docbook">
|
<!ENTITY sed1520 SYSTEM "drivers/sed1520.docbook">
|
||||||
|
|||||||
+26
-42
@@ -3,6 +3,7 @@
|
|||||||
*
|
*
|
||||||
* (c) 2007 NitroSecurity, Inc.
|
* (c) 2007 NitroSecurity, Inc.
|
||||||
* Written by Gatewood Green <woody@nitrosecurity.com> or <woody@linif.org>
|
* Written by Gatewood Green <woody@nitrosecurity.com> or <woody@linif.org>
|
||||||
|
* (c) 2007 Peter Marschall - adapted coding style and reporting to LCDproc
|
||||||
*
|
*
|
||||||
* License: GPL (same as usblcd and lcdPROC)
|
* License: GPL (same as usblcd and lcdPROC)
|
||||||
*
|
*
|
||||||
@@ -45,8 +46,16 @@
|
|||||||
/* lcdPROC includes */
|
/* lcdPROC includes */
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "picolcd.h"
|
#include "picolcd.h"
|
||||||
|
|
||||||
|
/* Debug mode: un-comment to turn on debugging messages in the server */
|
||||||
|
/* #define DEBUG 1 */
|
||||||
|
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* These three includes are the Mini-box.com libusblcd (usblcd) and company. */
|
/* These three includes are the Mini-box.com libusblcd (usblcd) and company. */
|
||||||
#include <usblcd.h>
|
#include <usblcd.h>
|
||||||
#include <widgets.h>
|
#include <widgets.h>
|
||||||
@@ -59,9 +68,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* This is a hack */
|
|
||||||
#define API_VERSION "0.5"
|
|
||||||
|
|
||||||
/* 12 keys plus a 0 placeholder */
|
/* 12 keys plus a 0 placeholder */
|
||||||
#define KEYPAD_MAX 13
|
#define KEYPAD_MAX 13
|
||||||
#define KEYPAD_LIGHTS 6
|
#define KEYPAD_LIGHTS 6
|
||||||
@@ -71,8 +77,6 @@
|
|||||||
#define DEFAULT_KEYLIGHTS 1 /* On */
|
#define DEFAULT_KEYLIGHTS 1 /* On */
|
||||||
#define DEFAULT_TIMEOUT 500 /* Half second */
|
#define DEFAULT_TIMEOUT 500 /* Half second */
|
||||||
|
|
||||||
/* Set this to 1 and get lots of cruft on stderr when using "LCDd -f 1 -d picolcd" */
|
|
||||||
#define DEBUG_PICO 0
|
|
||||||
|
|
||||||
/* PrivateData struct */
|
/* PrivateData struct */
|
||||||
typedef struct pd {
|
typedef struct pd {
|
||||||
@@ -181,9 +185,6 @@ MODULE_EXPORT int picoLCD_init( Driver *drvthis ) {
|
|||||||
|
|
||||||
report(RPT_INFO, "picolcd: init complete\n", __FUNCTION__);
|
report(RPT_INFO, "picolcd: init complete\n", __FUNCTION__);
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
|
||||||
fprintf( stderr, "picolcd: init complete\n" );
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,8 +193,7 @@ MODULE_EXPORT void picoLCD_close( Driver *drvthis ) {
|
|||||||
|
|
||||||
pd->lcd->close(pd->lcd); /* This actually does not do anything in usblcd (yet?) */
|
pd->lcd->close(pd->lcd); /* This actually does not do anything in usblcd (yet?) */
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: close complete\n");
|
||||||
fprintf( stderr, "picolcd: close complete\n" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lcd_logical_driver Essential output functions */
|
/* lcd_logical_driver Essential output functions */
|
||||||
@@ -214,8 +214,7 @@ MODULE_EXPORT void picoLCD_clear( Driver *drvthis ) {
|
|||||||
|
|
||||||
memset(pd->framebuf, ' ', pd->width * pd->height);
|
memset(pd->framebuf, ' ', pd->width * pd->height);
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: clear complete\n");
|
||||||
fprintf( stderr, "picolcd: clear complete\n" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_EXPORT void picoLCD_flush(Driver *drvthis) {
|
MODULE_EXPORT void picoLCD_flush(Driver *drvthis) {
|
||||||
@@ -225,8 +224,7 @@ MODULE_EXPORT void picoLCD_flush( Driver *drvthis ) {
|
|||||||
static char text[48];
|
static char text[48];
|
||||||
int i, line, offset;
|
int i, line, offset;
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: flush started\n");
|
||||||
fprintf( stderr, "picolcd: flush started\n" );
|
|
||||||
|
|
||||||
for (line = 0; line < pd->height; line++) {
|
for (line = 0; line < pd->height; line++) {
|
||||||
memset(text, 0, 48);
|
memset(text, 0, 48);
|
||||||
@@ -240,16 +238,14 @@ MODULE_EXPORT void picoLCD_flush( Driver *drvthis ) {
|
|||||||
pd->lcd->settext(pd->lcd, line, 0, text);
|
pd->lcd->settext(pd->lcd, line, 0, text);
|
||||||
memcpy(pd->lstframe + offset, pd->framebuf + offset, pd->width);
|
memcpy(pd->lstframe + offset, pd->framebuf + offset, pd->width);
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: flush wrote line %d (%s)\n", line + 1, text);
|
||||||
fprintf( stderr, "picolcd: flush wrote line %d (%s)\n", line + 1, text );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: flush complete\n\t(%s)\n\t(%s)\n", pd->framebuf, pd->lstframe);
|
||||||
fprintf( stderr, "picolcd: flush complete\n\t(%s)\n\t(%s)\n", pd->framebuf, pd->lstframe );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_EXPORT void picoLCD_string(Driver *drvthis, int x, int y, char *str) {
|
MODULE_EXPORT void picoLCD_string(Driver *drvthis, int x, int y, char *str) {
|
||||||
@@ -257,8 +253,7 @@ MODULE_EXPORT void picoLCD_string( Driver *drvthis, int x, int y, char *str ) {
|
|||||||
char *dest;
|
char *dest;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: string start (%s)\n", str);
|
||||||
fprintf( stderr, "picolcd: string start (%s)\n", str );
|
|
||||||
|
|
||||||
if (y < 1 || y > pd->height)
|
if (y < 1 || y > pd->height)
|
||||||
return;
|
return;
|
||||||
@@ -267,8 +262,7 @@ MODULE_EXPORT void picoLCD_string( Driver *drvthis, int x, int y, char *str ) {
|
|||||||
|
|
||||||
len = strlen(str);
|
len = strlen(str);
|
||||||
if (len + x > pd->width) {
|
if (len + x > pd->width) {
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: string overlength (>%d). Start: %d Length: %d (%s)\n", pd->width, x, len ,str);
|
||||||
fprintf( stderr, "picolcd: string overlength (>%d). Start: %d Length: %d (%s)\n", pd->width, x, len ,str );
|
|
||||||
|
|
||||||
len = pd->width - x; /* Copy what we can */
|
len = pd->width - x; /* Copy what we can */
|
||||||
}
|
}
|
||||||
@@ -277,16 +271,14 @@ MODULE_EXPORT void picoLCD_string( Driver *drvthis, int x, int y, char *str ) {
|
|||||||
dest = pd->framebuf + (y * pd->width + x);
|
dest = pd->framebuf + (y * pd->width + x);
|
||||||
memcpy(dest, str, len * sizeof(char));
|
memcpy(dest, str, len * sizeof(char));
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: string complete (%s)\n", str);
|
||||||
fprintf( stderr, "picolcd: string complete (%s)\n", str );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_EXPORT void picoLCD_chr(Driver *drvthis, int x, int y, char chr) {
|
MODULE_EXPORT void picoLCD_chr(Driver *drvthis, int x, int y, char chr) {
|
||||||
PrivateData *pd = drvthis->private_data;
|
PrivateData *pd = drvthis->private_data;
|
||||||
char *dest;
|
char *dest;
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: chr start (%c)\n", chr);
|
||||||
fprintf( stderr, "picolcd: chr start (%c)\n", chr );
|
|
||||||
|
|
||||||
if (y < 1 || y > pd->height)
|
if (y < 1 || y > pd->height)
|
||||||
return;
|
return;
|
||||||
@@ -297,8 +289,7 @@ MODULE_EXPORT void picoLCD_chr( Driver *drvthis, int x, int y, char chr ) {
|
|||||||
dest = pd->framebuf + (y * pd->width + x);
|
dest = pd->framebuf + (y * pd->width + x);
|
||||||
memcpy(dest, &chr, sizeof(char));
|
memcpy(dest, &chr, sizeof(char));
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: chr complete (%c)\n", chr);
|
||||||
fprintf( stderr, "picolcd: chr complete (%c)\n", chr );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lcd_logical_driver Essential input functions */
|
/* lcd_logical_driver Essential input functions */
|
||||||
@@ -311,39 +302,33 @@ MODULE_EXPORT char *picoLCD_get_key( Driver *drvthis ) {
|
|||||||
int key_pass = 0;
|
int key_pass = 0;
|
||||||
int two_keys = 0;
|
int two_keys = 0;
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: get_key start (timeout %d)\n", pd->key_timeout);
|
||||||
fprintf( stderr, "picolcd: get_key start (timeout %d)\n", pd->key_timeout );
|
|
||||||
|
|
||||||
keydata = malloc(sizeof(lcd_packet));
|
keydata = malloc(sizeof(lcd_packet));
|
||||||
|
|
||||||
while (! keys_read) {
|
while (! keys_read) {
|
||||||
get_key_event(pd->lcd, keydata, pd->key_timeout);
|
get_key_event(pd->lcd, keydata, pd->key_timeout);
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: get_key got an event\n");
|
||||||
fprintf( stderr, "picolcd: get_key got an event\n" );
|
|
||||||
|
|
||||||
if (keydata->type == IN_REPORT_KEY_STATE) {
|
if (keydata->type == IN_REPORT_KEY_STATE) {
|
||||||
if (! keydata->data[1] && key_pass) {
|
if (! keydata->data[1] && key_pass) {
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: get_key got all clear\n");
|
||||||
fprintf( stderr, "picolcd: get_key got all clear\n" );
|
|
||||||
/* Got a <0, 0> key-up event after reading a valid key press event */
|
/* Got a <0, 0> key-up event after reading a valid key press event */
|
||||||
keys_read++; /* All clear */
|
keys_read++; /* All clear */
|
||||||
} else if (! keydata->data[2] && ! two_keys) {
|
} else if (! keydata->data[2] && ! two_keys) {
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: get_key got one key\n");
|
||||||
fprintf( stderr, "picolcd: get_key got one key\n" );
|
|
||||||
/* We got one key (but not after a two key event and before and all clear) */
|
/* We got one key (but not after a two key event and before and all clear) */
|
||||||
keystr = pd->key_matrix[keydata->data[1]];
|
keystr = pd->key_matrix[keydata->data[1]];
|
||||||
} else {
|
} else {
|
||||||
/* We got two keys */
|
/* We got two keys */
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: get_key got two keys\n");
|
||||||
fprintf( stderr, "picolcd: get_key got two keys\n" );
|
|
||||||
two_keys++;
|
two_keys++;
|
||||||
sprintf(keystr, "%s+%s", pd->key_matrix[keydata->data[1]], pd->key_matrix[keydata->data[2]]);
|
sprintf(keystr, "%s+%s", pd->key_matrix[keydata->data[1]], pd->key_matrix[keydata->data[2]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
key_pass++; /* This hack allows us to deal with receiving left over <0,0> first */
|
key_pass++; /* This hack allows us to deal with receiving left over <0,0> first */
|
||||||
} else {
|
} else {
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: get_key got non-key data or timeout\n");
|
||||||
fprintf( stderr, "picolcd: get_key got non-key data or timeout\n" );
|
|
||||||
/* We got IR or otherwise bad data */
|
/* We got IR or otherwise bad data */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -352,8 +337,7 @@ MODULE_EXPORT char *picoLCD_get_key( Driver *drvthis ) {
|
|||||||
|
|
||||||
free(keydata);
|
free(keydata);
|
||||||
|
|
||||||
if ( DEBUG_PICO )
|
debug(RPT_DEBUG, "picolcd: get_key complete (%s)\n", keystr);
|
||||||
fprintf( stderr, "picolcd: get_key complete (%s)\n", keystr );
|
|
||||||
|
|
||||||
if (! strlen(keystr))
|
if (! strlen(keystr))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user