Add code to use libusb-1.0 asynchronous transfers to fix problem of
occasional missed keys and eliminate use of key_timeout which disrupts the main loop timing (by M. Jones).
This commit is contained in:
@@ -20,6 +20,7 @@ v0.5dev (ongoing development)
|
||||
+ glcd driver: new connection type 'serdisplib'
|
||||
+ glcd driver: new connection type 'glcd2usb'
|
||||
* lcdproc client: On FreeBSD show only unique processes in 'S' screen
|
||||
* picolcd: Use libusb-1.0 asynchronous transfers to fix missed keys (M. Jones)
|
||||
|
||||
v0.5.5
|
||||
+ sed1330 driver: Add support for HG25504 (L. Lagendijk)
|
||||
|
||||
@@ -926,6 +926,9 @@ Reboot=no
|
||||
## Mini-box.com picoLCD (usblcd) driver ##
|
||||
[picolcd]
|
||||
|
||||
# KeyTimeout is only used if the picoLCD driver is built with libusb-0.1. When
|
||||
# built with libusb-1.0 key and IR data is input asynchronously so there is no
|
||||
# need to wait for the USB data.
|
||||
# KeyTimeout is the time in ms that LCDd spends waiting for a key press before
|
||||
# cycling through other duties. Higher values make LCDd use less CPU time and
|
||||
# make key presses more detectable. Lower values make LCDd more responsive
|
||||
@@ -933,6 +936,18 @@ Reboot=no
|
||||
# and a balanced value. [default: 500; legal: 0 - 1000]
|
||||
KeyTimeout=500
|
||||
|
||||
# Key auto repeat is only available if the picoLCD driver is built with
|
||||
# libusb-1.0. Use KeyRepeatDelay and KeyRepeatInterval to configure key auto
|
||||
# repeat.
|
||||
#
|
||||
# Key auto repeat delay (time in ms from first key report to first repeat). Use
|
||||
# zero to disable auto repeat. [default: 300; legal: 0 - 3000]
|
||||
KeyRepeatDelay=300
|
||||
|
||||
# Key auto repeat interval (time in ms between repeat reports). Only used if
|
||||
# KeyRepeatDelay is not zero. [default: 200; legal: 0 - 3000]
|
||||
KeyRepeatInterval=200
|
||||
|
||||
# Sets the initial state of the backlight upon start-up.
|
||||
# [default: on; legal: on, off]
|
||||
#Backlight=on
|
||||
@@ -948,6 +963,9 @@ Brightness=1000
|
||||
# Set the initial contrast [default: 1000; legal: 0 - 1000]
|
||||
Contrast=1000
|
||||
|
||||
# Link the key lights to the backlight? [default: on; legal: on, off]
|
||||
#LinkLights=off
|
||||
|
||||
# Light the keys? [default: on; legal: on, off]
|
||||
Keylights=on
|
||||
|
||||
|
||||
@@ -381,6 +381,11 @@ dnl else
|
||||
if test "$enable_libusb" = yes ; then
|
||||
DRIVERS="$DRIVERS picolcd${SO}"
|
||||
actdrivers=["$actdrivers picolcd"]
|
||||
if test "$enable_libusb_1_0" = yes ; then
|
||||
AC_MSG_RESULT([The picolcd driver is using the libusb-1.0 library.])
|
||||
else
|
||||
AC_MSG_RESULT([The picolcd driver is using the libusb-0.1 library.])
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN([The picolcd driver needs the libusb library.])
|
||||
fi
|
||||
|
||||
@@ -270,6 +270,29 @@ fi
|
||||
AC_SUBST(LIBUSB_LIBS)
|
||||
AC_SUBST(LIBUSB_CFLAGS)
|
||||
|
||||
dnl ######################################################################
|
||||
dnl libusb-1.0 support
|
||||
dnl ######################################################################
|
||||
AC_MSG_CHECKING([if libusb-1-0 support has been enabled]);
|
||||
AC_ARG_ENABLE(libusb_1_0,
|
||||
[AS_HELP_STRING([--disable-libusb-1-0],[disable USB support using libusb-1.0])],
|
||||
[ if test "$enableval" != "no"; then
|
||||
enable_libusb_1_0="yes"
|
||||
fi ],
|
||||
[ enable_libusb_1_0=yes ]
|
||||
)
|
||||
AC_MSG_RESULT($enable_libusb_1_0)
|
||||
|
||||
if test "$enable_libusb_1_0" = "yes"; then
|
||||
ifdef([PKG_CHECK_MODULES],
|
||||
[PKG_CHECK_MODULES(LIBUSB_1_0, libusb-1.0 >= 1.0,
|
||||
[AC_DEFINE(HAVE_LIBUSB_1_0, [1], [Define to 1 if you have libusb-1.0])],
|
||||
[ enable_libusb_1_0=no ])],
|
||||
[AC_MSG_WARN([pkg-config not (fully) installed; drivers requiring libusb-1.0 may not be built])])
|
||||
fi
|
||||
AC_SUBST(LIBUSB_1_0_LIBS)
|
||||
AC_SUBST(LIBUSB_1_0_CFLAGS)
|
||||
|
||||
dnl ######################################################################
|
||||
dnl libftdi support
|
||||
dnl ######################################################################
|
||||
|
||||
@@ -56,7 +56,10 @@
|
||||
<para>
|
||||
Finally, the picoLCD 20x2 (OEM) supports 8 general purpose outputs
|
||||
and 10 custom splash screens.
|
||||
Although these features are not supported by this driver, the
|
||||
When the keypad is connected the outputs control the key LEDs. The
|
||||
output command and KeyLight settings below can be used to control the
|
||||
outputs.
|
||||
Although splash screens are not supported by this driver, the
|
||||
splash screens can be changed using the <command>usblcd</command>
|
||||
tool, that can be built from the Linux SDK available on the picoLCD web page.
|
||||
</para>
|
||||
@@ -115,7 +118,7 @@
|
||||
<para>
|
||||
The Brightness and OffBrightness settings only have an effect on the 20x4
|
||||
device. With the 20x2 device the backlight can only be set on (any value
|
||||
greater than <literal>1000</literal>) or off (<literal>0</literal>).
|
||||
<literal>1</literal> or greater) or off (<literal>0</literal>).
|
||||
</para>
|
||||
</note>
|
||||
|
||||
@@ -167,6 +170,15 @@
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<property>LinkLights</property> = ¶meters.yesdefno;
|
||||
</term>
|
||||
<listitem><para>
|
||||
Allow key LEDs to be turned on or off with the backlight. Default is <literal>yes</literal>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<property>KeyLights</property> = ¶meters.yesdefno;
|
||||
@@ -243,14 +255,60 @@
|
||||
<property>KeyTimeout</property> =
|
||||
<parameter><replaceable>DURATION</replaceable></parameter>
|
||||
</term>
|
||||
<listitem><para>
|
||||
<listitem>
|
||||
<para>
|
||||
KeyTimeout is only used if the picoLCD driver is built with libusb-0.1, when
|
||||
built with libusb-1.0 key and IR data is input asynchronously so there is no
|
||||
need to wait for the USB data thus allowing LCDd to process other inputs at
|
||||
the correct rate.
|
||||
</para>
|
||||
<para>
|
||||
This value controls how long <application>LCDd</application> waits for a key press when
|
||||
get_key() is called. The value represents milliseconds 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.
|
||||
Large values make key presses more reliable but may slow down LCDd. Values
|
||||
in the range <literal>0</literal>-<literal>1000</literal> (1s) are allowed.
|
||||
</para></listitem>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<property>KeyRepeatDelay</property> =
|
||||
<parameter><replaceable>DURATION</replaceable></parameter>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
KeyRepeatDelay is only used if the picoLCD driver is built with libusb-1.0, when
|
||||
built with libusb-0.1 key input blocks all other processing until the key is released.
|
||||
</para>
|
||||
<para>
|
||||
This value controls how long <application>LCDd</application> waits from when a key is
|
||||
pressed and reported before generating the first repeat. The value represents milliseconds
|
||||
and the default is <literal>300</literal> (0.3 second). Use zero to disable auto repeat.
|
||||
Values in the range <literal>0</literal>-<literal>3000</literal> (3s) are allowed.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<property>KeyRepeatInterval</property> =
|
||||
<parameter><replaceable>DURATION</replaceable></parameter>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
KeyRepeatInterval is only used if the picoLCD driver is built with libusb-1.0, when
|
||||
built with libusb-0.1 key input blocks all other processing until the key is released.
|
||||
</para>
|
||||
<para>
|
||||
This value controls how long <application>LCDd</application> waits between key reports
|
||||
after generating the first repeat. The value represents milliseconds and the default
|
||||
is <literal>200</literal> (0.2 second). Use zero to disable auto repeat.
|
||||
Values in the range <literal>0</literal>-<literal>3000</literal> (3s) are allowed.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@@ -320,6 +378,10 @@
|
||||
deal with this in a sane way and toss out all key-up events for now. The hardware is
|
||||
touchy and both combo key-down and key-up actions may be reported as multiple events if
|
||||
the user is more than a tenth of a second (maybe less?) off in motions.
|
||||
The hardware is <emphasis>not</emphasis> "touchy" it reports what it receives. Two key
|
||||
presses or releases may appear simultaneous to a human but they are always some time apart.
|
||||
The hardware probably samples the keys for every USB transfer cycle; that is every 10ms,
|
||||
significantly faster than the typical human response time of a few hundred milliseconds!
|
||||
</para>
|
||||
|
||||
<sect3 id="picolcd-ir-status">
|
||||
|
||||
@@ -32,7 +32,7 @@ i2500vfd_CFLAGS = @LIBFTDI_CFLAGS@ $(AM_CFLAGS)
|
||||
IOWarrior_CFLAGS = @LIBUSB_CFLAGS@ $(AM_CFLAGS)
|
||||
lis_CFLAGS = @LIBUSB_CFLAGS@ @LIBFTDI_CFLAGS@ $(AM_CFLAGS)
|
||||
mdm166a_CFLAGS = @LIBHID_CFLAGS@ $(AM_CFLAGS)
|
||||
picolcd_CFLAGS = @LIBUSB_CFLAGS@ $(AM_CFLAGS)
|
||||
picolcd_CFLAGS = @LIBUSB_CFLAGS@ @LIBUSB_1_0_CFLAGS@ $(AM_CFLAGS)
|
||||
shuttleVFD_CFLAGS = @LIBUSB_CFLAGS@ $(AM_CFLAGS)
|
||||
ula200_CFLAGS = @LIBFTDI_CFLAGS@ $(AM_CFLAGS)
|
||||
xosd_CFLAGS = @LIBXOSD_CFLAGS@ $(AM_CFLAGS)
|
||||
@@ -63,7 +63,7 @@ mtc_s16209x_LDADD = libLCD.a
|
||||
MtxOrb_LDADD = libLCD.a libbignum.a
|
||||
mx5000_LDADD = @LIBMX5000@
|
||||
NoritakeVFD_LDADD = libbignum.a
|
||||
picolcd_LDADD = @LIBUSB_LIBS@ libLCD.a libbignum.a
|
||||
picolcd_LDADD = @LIBUSB_LIBS@ @LIBUSB_1_0_LIBS@ libLCD.a libbignum.a
|
||||
pyramid_LDADD = libLCD.a libbignum.a
|
||||
serialPOS_LDADD = libbignum.a
|
||||
serialVFD_LDADD = libLCD.a libbignum.a
|
||||
|
||||
+751
-270
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,14 @@
|
||||
#ifndef PICOLCD_H
|
||||
#define PCIOLCD_H
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
# include <libusb.h>
|
||||
# define USB_DEVICE_HANDLE libusb_device_handle
|
||||
#else
|
||||
# include <usb.h>
|
||||
# define USB_DEVICE_HANDLE usb_dev_handle
|
||||
#endif
|
||||
|
||||
/* 12 keys plus a 0 placeholder */
|
||||
#define KEYPAD_MAX 13
|
||||
#define KEYPAD_LIGHTS 8
|
||||
@@ -34,7 +42,10 @@
|
||||
#define DEFAULT_OFFBRIGHTNESS 0 /* Off */
|
||||
#define DEFAULT_BACKLIGHT 1 /* On */
|
||||
#define DEFAULT_KEYLIGHTS 1 /* On */
|
||||
#define DEFAULT_LINKLIGHTS 1 /* On */
|
||||
#define DEFAULT_TIMEOUT 500 /* Half second */
|
||||
#define DEFAULT_REPEAT_DELAY 300 /* milliseconds */
|
||||
#define DEFAULT_REPEAT_INTERVAL 200 /* milliseconds */
|
||||
|
||||
|
||||
typedef struct _lcd_packet {
|
||||
@@ -56,7 +67,7 @@ typedef struct _picolcd_device {
|
||||
int width; /* width of lcd screen */
|
||||
int height; /* height of lcd screen */
|
||||
/* Pointer to function that writes data to the LCD format */
|
||||
void (*write) (usb_dev_handle *lcd, const int row, const int col, const unsigned char *data);
|
||||
void (*write) (USB_DEVICE_HANDLE *lcd, const int row, const int col, const unsigned char *data);
|
||||
/* Pointer to function that defines a custom character */
|
||||
void (*cchar) (Driver *drvthis, int n, unsigned char *dat);
|
||||
} picolcd_device;
|
||||
|
||||
Reference in New Issue
Block a user