From 6c18a1751ae1d84661cfb70676a7a9fdcb0ad1cd Mon Sep 17 00:00:00 2001 From: marschap Date: Thu, 20 Sep 2007 09:18:21 +0000 Subject: [PATCH] key support for hd44780/lcd2usb (M. Dolze) --- ChangeLog | 1 + LCDd.conf | 5 ++++- docs/lcdproc-user/drivers/hd44780.docbook | 13 ++++--------- server/drivers/hd44780-lcd2usb.c | 12 ++++++++++++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad6fed1..5d173a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ 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) 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 bc545c8..98df4d6 100644 --- a/LCDd.conf +++ b/LCDd.conf @@ -436,9 +436,12 @@ Speed=0 # You may also need to configure the keypad layout further on in this file. Keypad=no -# set the initial contrast (for bwctusb only) [default: 0; legal: 0 - 1000] +# Set the initial contrast (bwctusb and lcd2usb) [default: 0; legal: 0 - 1000] Contrast=0 +# Set brightness of the backlight (lcd2usb only) [default: 0; legal 0 - 1000] +#Brightness=1000 + # If you have a switchable backlight. Backlight=no diff --git a/docs/lcdproc-user/drivers/hd44780.docbook b/docs/lcdproc-user/drivers/hd44780.docbook index 8f4d99c..ddc6691 100644 --- a/docs/lcdproc-user/drivers/hd44780.docbook +++ b/docs/lcdproc-user/drivers/hd44780.docbook @@ -1647,6 +1647,10 @@ This means that you can take these schematics and use it as a basis for your own e.g. for a graphic LCD + +The LCD2USB interface supports up to two keys. They can be configured as direct keys 1 and 2. + + Special config options @@ -1657,15 +1661,6 @@ Besides the standard configuration options for hd44780 displays, th Brightness= to set the display's brightness. Both options expect a number in the range from 0 to 1000. - - - -Status - - -Although the LCD2USB sports two keys, they are currently not supported by -LCDproc. Patches to fix the situation are very welcome. - diff --git a/server/drivers/hd44780-lcd2usb.c b/server/drivers/hd44780-lcd2usb.c index b4adb80..204c542 100644 --- a/server/drivers/hd44780-lcd2usb.c +++ b/server/drivers/hd44780-lcd2usb.c @@ -147,6 +147,18 @@ lcd2usb_HD44780_backlight(PrivateData *p, unsigned char state) unsigned char lcd2usb_HD44780_scankeypad(PrivateData *p) { + unsigned char buffer[2]; + int nBytes; + + /* send control request and accept return value */ + nBytes = usb_control_msg(lcd2usb, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, + LCD2USB_GET_KEYS, 0, 0, (char *) buffer, sizeof(buffer), 1000); + + if (nBytes != -1) { + return buffer[0]; + } + return 0; }