From 7459202633d99bfbec1ac38516cf62f4f7eed2a2 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 27 Dec 2012 14:01:59 +0000 Subject: [PATCH] Add support for key release events git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5464 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 4 + Documentation/NuttxPortingGuide.html | 140 +++++++++++++++++++++------ drivers/usbhost/usbhost_hidkbd.c | 8 +- include/nuttx/input/kbd_codec.h | 100 +++++++++++++------ libc/misc/lib_kbddecode.c | 99 ++++++++++--------- libc/misc/lib_kbdencode.c | 105 ++++++++++++++++---- 6 files changed, 330 insertions(+), 126 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7087656ae..2e114af8c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3832,4 +3832,8 @@ UG-2864HSWEG01 OLED for the STM32F4Discovery board. * drivers/usbhost/usbhost_hidkbd.c: Correct a logic error in how tasks waiting for read data are awakened. + * libc/misc/lib_kbdencode.c and lib_kbddecode.c: Now handles keypress + events too. However, the USB HID keyboard drier has not yet been + updated to detect key release events. That is kind of tricky in + the USB HID keyboard report data. diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index ebb3eff4bf..e626bf7a57 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -3623,20 +3623,27 @@ extern void up_ledoff(int led);

6.3.16 Keyboard/Keypad Drivers

- "Out-of-Band" Commands. - Keyboards and keypads are the same device for NuttX. + Keypads vs. Keyboards + Keyboards and keypads are really the same devices for NuttX. A keypad is thought of as simply a keyboard with fewer keys. +

+

+ Special Commands. In NuttX, a keyboard/keypad driver is simply a character driver that may have an (optional) encoding/decoding layer on the data returned by the character driver. - A keyboard may return simple text data (alphabetic, numeric, and punctuaction) or control characters (enter, control-C, etc.). - We can think about this the normal "in-band" keyboard data stream. - However, in addition, most keyboards support actions that cannot be represented as text data. + A keyboard may return simple text data (alphabetic, numeric, and punctuaction) or control characters (enter, control-C, etc.) when a key is pressed. + We can think about this the "normal" keyboard data stream. + However, in addition, most keyboards support actions that cannot be represented as text or control data. Such actions include things like cursor controls (home, up arrow, page down, etc.), editing functions (insert, delete, etc.), volume controls, (mute, volume up, etc.) and other special functions. - We can think about this as special, "out-of-band" keyboard commands. - In this case, some special encoding may be required to multiplex the in-band text data and out-of-band command streams. + In this case, some special encoding may be required to multiplex the normal text data and special command key press data streams. +

+

+ Key Press and Release Events + Sometimes the time that a key is released is needed by applications as well. + Thus, in addition to normal and special key press events, it may also be necessary to encode normal and special key release events.

Encoding/Decoding Layer. - An optional encoding/decoding layer can be used with the basic character driver to encode the out-of-band commands into the text data stream. + An optional encoding/decoding layer can be used with the basic character driver to encode the keyboard events into the text data stream. The function interfaces that comprise that encoding/decoding layer are defined in the header file include/nuttx/input/kbd_code.h. These functions provide an matched set of (a) driver encoding interfaces, and (b) application decoding interfaces.

@@ -3644,21 +3651,23 @@ extern void up_ledoff(int led);
  • Driver Encoding Interfaces. + These are interfaces used by the keyboard/keypad driver to encode keyboard events and data.