From 81167b4592a18d9d80d1ed7795953addb71844c8 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 25 Dec 2012 17:22:58 +0000 Subject: Add logic to serialize and marshal out-of-band keyboard commands git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5460 42af7a65-404d-4744-a932-0658087f49c3 --- apps/Make.defs | 4 +- apps/builtin/Makefile | 6 +- nuttx/ChangeLog | 4 +- nuttx/include/nuttx/input/kbd_codec.h | 292 ++++++++++++++++++++++++++++++++++ nuttx/include/nuttx/usb/hid.h | 2 +- nuttx/libc/misc/Make.defs | 2 +- nuttx/libc/misc/lib_kbddecode.c | 258 ++++++++++++++++++++++++++++++ nuttx/libc/misc/lib_kbdencode.c | 81 ++++++++++ 8 files changed, 641 insertions(+), 8 deletions(-) create mode 100644 nuttx/include/nuttx/input/kbd_codec.h create mode 100644 nuttx/libc/misc/lib_kbddecode.c create mode 100644 nuttx/libc/misc/lib_kbdencode.c diff --git a/apps/Make.defs b/apps/Make.defs index c62999804..f7e6aa08d 100644 --- a/apps/Make.defs +++ b/apps/Make.defs @@ -37,9 +37,9 @@ BUILTIN_REGISTRY = $(APPDIR)$(DELIM)builtin$(DELIM)registry ifeq ($(CONFIG_NUTTX_NEWCONFIG),y) -DEPCONFIG = $(TOPDIR)/.config +DEPCONFIG = $(TOPDIR)$(DELIM).config else -DEPCONFIG = $(TOPDIR)/.config $(APPDIR)/.config +DEPCONFIG = $(TOPDIR)$(DELIM).config $(APPDIR)$(DELIM).config endif define REGISTER diff --git a/apps/builtin/Makefile b/apps/builtin/Makefile index ccb860c88..8c8928886 100644 --- a/apps/builtin/Makefile +++ b/apps/builtin/Makefile @@ -75,10 +75,10 @@ $(AOBJS): %$(OBJEXT): %.S $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -registry/.updated: +registry$(DELIM).updated: $(V) $(MAKE) -C registry .updated TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -builtin_list.h: registry/.updated +builtin_list.h: registry$(DELIM).updated $(call DELFILE, builtin_list.h) $(Q) touch builtin_list.h ifeq ($(CONFIG_WINDOWS_NATIVE),y) @@ -92,7 +92,7 @@ else ) endif -builtin_proto.h: registry/.updated +builtin_proto.h: registry$(DELIM).updated $(call DELFILE, builtin_proto.h) $(Q) touch builtin_proto.h ifeq ($(CONFIG_WINDOWS_NATIVE),y) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index c5cc9b54a..80ddb56c6 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3818,4 +3818,6 @@ * arch/arm/src/up_head.S: Fix backward conditional compilation. NOTE there is a issue of ARM9 systems with low vectors and large memories that will have to be addressed in the future. - + * libc/misc/lib_kbdencode.c and lib_kbddecode.c: Add logic to marshal + and serialized "out-of-band" keyboard commands intermixed with normal + ASCII data (not yet hooked into anything). diff --git a/nuttx/include/nuttx/input/kbd_codec.h b/nuttx/include/nuttx/input/kbd_codec.h new file mode 100644 index 000000000..b103d544e --- /dev/null +++ b/nuttx/include/nuttx/input/kbd_codec.h @@ -0,0 +1,292 @@ +/************************************************************************************ + * include/nuttx/input/kbd_codec.h + * Serialize and marshaling out-of-band keyboard data + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +#ifndef __INCLUDE_NUTTX_INPUT_KBD_CODEC_H +#define __INCLUDE_NUTTX_INPUT_KBD_CODEC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* These are the special, "out-of-band" keyboard commands recognized by the + * CODEC. + */ + +enum kbd_keycode_e +{ + KEYCODE_NORMAL = 0, /* Not a special keycode */ + + /* Delete and Backspace keycodes (in case they may be different than the + * ASCII BKSP and DEL values. + */ + + KEYCODE_FWDDEL, /* DELete (forward delete) */ + KEYCODE_BACKDEL, /* Backspace (backward delete) */ + + /* Cursor movement */ + + KEYCODE_HOME, /* Home */ + KEYCODE_END, /* End */ + KEYCODE_LEFT, /* Left arrow */ + KEYCODE_RIGHT, /* Right arrow */ + KEYCODE_UP, /* Up arrow */ + KEYCODE_DOWN, /* Down arrow */ + KEYCODE_PAGEUP, /* Page up */ + KEYCODE_PAGEDOWN, /* Page down */ + + /* Edit commands */ + + KEYCODE_INSERT, /* Insert */ + KEYCODE_AGAIN, /* Again */ + KEYCODE_UNDO, /* Undo */ + KEYCODE_REDO, /* Redo */ + KEYCODE_CUT, /* Cut */ + KEYCODE_COPY, /* Copy */ + KEYCODE_PASTE, /* Paste */ + KEYCODE_FIND , /* Find */ + + /* Selection codes */ + + KEYCODE_ENTER, /* Enter */ + KEYCODE_SELECT, /* Select */ + KEYCODE_EXECUTE, /* Execute */ + + /* Keyboard modes */ + + KEYCODE_CAPSLOCK, /* Caps Lock */ + KEYCODE_SCROLLLOCK, /* Scroll Lock */ + KEYCODE_NUMLOCK, /* Keypad Num Lock and Clear */ + KEYCODE_LCAPSLOCK, /* Locking Caps Lock */ + KEYCODE_LNUMLOCK, /* Locking Num Lock */ + KEYCODE_LSCROLLLOCK, /* Locking Scroll Lock */ + + /* Misc control codes */ + + KEYCODE_POWER, /* Power */ + KEYCODE_HELP, /* Help */ + KEYCODE_MENU, /* Menu */ + KEYCODE_STOP, /* Stop */ + KEYCODE_PAUSE, /* Pause */ + KEYCODE_BREAK, /* Break */ + KEYCODE_CANCEL, /* Cancel */ + KEYCODE_PRINTSCN, /* PrintScreen */ + KEYCODE_SYSREQ, /* SysReq/Attention */ + + /* Audio */ + + KEYCODE_MUTE, /* Mute */ + KEYCODE_VOLUP, /* Volume Up */ + KEYCODE_VOLDOWN, /* Volume Down */ + + /* Telephone */ + + KEYCODE_ANSWER, /* Answer (phone) */ + KEYCODE_HANGUP, /* Hang-up (phone) */ + + /* Calculator */ + + KEYCODE_CLEAR, /* Clear */ + KEYCODE_CLEARENTRY, /* Clear entry */ + + KEYCODE_MEMSET, /* Memory set */ + KEYCODE_MEMCLEAR, /* Memory clear */ + KEYCODE_MEMRECALL, /* Memory recall */ + KEYCODE_MEMADD, /* Memory add */ + KEYCODE_MEMSUBTRACT, /* Memory substract */ + KEYCODE_MEMMULTIPY, /* Memory multiply */ + KEYCODE_MEMDIVIDE, /* Memory divide */ + + KEYCODE_BINARY, /* Binary mode */ + KEYCODE_OCTAL, /* Octal mode */ + KEYCODE_DECIMAL, /* Decimal mode */ + KEYCODE_HEXADECIMAL, /* Hexadecimal mode */ + + /* Languages */ + + KEYCODE_LANG1, /* LANG1 */ + KEYCODE_LANG2, /* LANG2 */ + KEYCODE_LANG3, /* LANG3 */ + KEYCODE_LANG4, /* LANG4 */ + KEYCODE_LANG5, /* LANG5 */ + KEYCODE_LANG6, /* LANG6 */ + KEYCODE_LANG7, /* LANG7 */ + KEYCODE_LANG8, /* LANG8 */ + + /* Context-specific function keys */ + + KEYCODE_F1, /* Function key 1 */ + KEYCODE_F2, /* Function key 2 */ + KEYCODE_F3, /* Function key 3 */ + KEYCODE_F4, /* Function key 4 */ + KEYCODE_F5, /* Function key 5 */ + KEYCODE_F6, /* Function key 6 */ + KEYCODE_F7, /* Function key 7 */ + KEYCODE_F8, /* Function key 8 */ + KEYCODE_F9, /* Function key 9 */ + KEYCODE_F10, /* Function key 10 */ + KEYCODE_F11, /* Function key 11 */ + KEYCODE_F12, /* Function key 12 */ + KEYCODE_F13, /* Function key 13 */ + KEYCODE_F14, /* Function key 14 */ + KEYCODE_F15, /* Function key 15 */ + KEYCODE_F16, /* Function key 16 */ + KEYCODE_F17, /* Function key 17 */ + KEYCODE_F18, /* Function key 18 */ + KEYCODE_F19, /* Function key 19 */ + KEYCODE_F20, /* Function key 20 */ + KEYCODE_F21, /* Function key 21 */ + KEYCODE_F22, /* Function key 22 */ + KEYCODE_F23, /* Function key 23 */ + KEYCODE_F24 /* Function key 24 */ +}; + +#define FIRST_KEYCODE KEYCODE_FWDDEL +#define LAST_KEYCODE KEYCODE_F24 + +/* kbd_get return values */ + +#define KBD_NORMAL 0 +#define KBD_SPECIAL 1 +#define KBD_ERROR EOF + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct kget_getstate_s +{ + uint8_t nch; /* Number of characters in the buffer */ + uint8_t ndx; /* Index to next character in the buffer */ + uint8_t buf[4]; /* Buffer of ungotten data */ +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/**************************************************************************** + * The following functions are intended for use by "producer", keyboard + * or keypad drivers to encode information into driver buffers. + ****************************************************************************/ + +/**************************************************************************** + * Name: kbd_puttext + * + * Description: + * Put one byte of normal, "in-band" ASCII data into the output stream. + * + * Input Parameters: + * ch - The character to be into the output stream. + * stream - An instance of lib_outstream_s to do the low-level put + * operation. + * + * Returned Value: + * None + * + ****************************************************************************/ + +#define kbd_puttext(ch, stream) (stream)->put((stream), (int)(ch)) + +/**************************************************************************** + * Name: kbd_putspecial + * + * Description: + * Put one special, "out-of-band" command into the output stream. + * + * Input Parameters: + * + * Returned Value: + * None + * + ****************************************************************************/ + +void kbd_putspecial(enum kbd_keycode_e keycode, + FAR struct lib_outstream_s *stream); + +/**************************************************************************** + * The following functions are intended for use by "consumer" applications + * to remove and decode information from the driver provided buffer. + ****************************************************************************/ + +/**************************************************************************** + * Name: kbd_get + * + * Description: + * Put one byte of data or special command from the driver provided input + * buffer. + * + * Input Parameters: + * stream - An instance of lib_instream_s to do the low-level get + * operation. + * pch - The location character to save the returned value. This may be + * either a normal, "in-band" ASCII characer or a special, "out-of-band" + * command. + * state - A user provided buffer to support parsing. This structure + * should be cleared the first time that kbd_get is called. + * + * Returned Value: + * 1 - Indicates the successful receipt of a special, "out-of-band" command + * 0 - Indicates the successful receipt of normal, "in-band" ASCII data. + * EOF - An error has getting the next character (reported by the stream). + * Normally indicates the end of file. + * + ****************************************************************************/ + +int kbd_get(FAR struct lib_instream_s *stream, + FAR struct kget_getstate_s *state, FAR uint8_t *pch); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_NUTTX_INPUT_KBD_CODEC_H */ + diff --git a/nuttx/include/nuttx/usb/hid.h b/nuttx/include/nuttx/usb/hid.h index 5b83f08fc..877203a9c 100644 --- a/nuttx/include/nuttx/usb/hid.h +++ b/nuttx/include/nuttx/usb/hid.h @@ -619,7 +619,7 @@ #define USBHID_KBDUSE_RCTRL 0xe4 /* Keyboard RightControl */ #define USBHID_KBDUSE_RSHIFT 0xe5 /* Keyboard RightShift */ #define USBHID_KBDUSE_RALT 0xe6 /* Keyboard RightAlt */ -#define USBHID_KBDUSE_RGUI 0xe7 /* Keyboard Right GUI*/ +#define USBHID_KBDUSE_RGUI 0xe7 /* Keyboard Right GUI */ #define USBHID_KBDUSE_MAX 0xe7 diff --git a/nuttx/libc/misc/Make.defs b/nuttx/libc/misc/Make.defs index f4284ac60..c6af5f860 100644 --- a/nuttx/libc/misc/Make.defs +++ b/nuttx/libc/misc/Make.defs @@ -35,7 +35,7 @@ # Add the internal C files to the build -CSRCS += lib_init.c lib_filesem.c +CSRCS += lib_init.c lib_filesem.c lib_kbdencode.c lib_kbddecode.c # Add C files that depend on file OR socket descriptors diff --git a/nuttx/libc/misc/lib_kbddecode.c b/nuttx/libc/misc/lib_kbddecode.c new file mode 100644 index 000000000..046d570f9 --- /dev/null +++ b/nuttx/libc/misc/lib_kbddecode.c @@ -0,0 +1,258 @@ +/******************************************************************************************** + * libc/msic/lib_kbddecode.c + * Decoding side of the Keyboard CODEC + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Authors: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include +#include + +#include +#include +#include + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +#define NDX_ESC 0 +#define NDX_BRACKET 1 +#define NDX_CODE 2 +#define NCX_SEMICOLON 3 + +#define NCH_ESC 1 +#define NCH_BRACKET 2 +#define NCH_CODE 3 +#define NCH_SEMICOLON 4 + +/******************************************************************************************** + * Private Functions + ********************************************************************************************/ + +/**************************************************************************** + * Name: kbd_reget + * + * Description: + * We have unused characters from the last, unsuccessful. Return one of + * these instead of the . + * + * Input Parameters: + * stream - An instance of lib_instream_s to do the low-level get + * operation. + * pch - The location character to save the returned value. This may be + * either a normal, "in-band" ASCII characer or a special, "out-of-band" + * command. + * state - A user provided buffer to support parsing. This structure + * should be cleared the first time that kbd_get is called. + * + * Returned Value: + * 2 - Indicates the successful receipt of a special, "out-of-band" command + * 1 - Indicates the successful receipt of normal, "in-band" ASCII data. + * 0 - Indicates end-of-file or that the stream has been closed + * EOF - An error has getting the next character (reported by the stream). + * + ****************************************************************************/ + +static int kbd_reget(FAR struct kget_getstate_s *state, FAR uint8_t *pch) +{ + /* Return the next character */ + + *pch = state->buf[state->ndx]; + state->ndx++; + state->nch--; + return KBD_NORMAL; +} + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +/**************************************************************************** + * Name: kbd_get + * + * Description: + * Put one byte of data or special command from the driver provided input + * buffer. + * + * Input Parameters: + * stream - An instance of lib_instream_s to do the low-level get + * operation. + * pch - The location character to save the returned value. This may be + * either a normal, "in-band" ASCII characer or a special, "out-of-band" + * command. + * state - A user provided buffer to support parsing. This structure + * should be cleared the first time that kbd_get is called. + * + * Returned Value: + * 1 - Indicates the successful receipt of a special, "out-of-band" command + * 0 - Indicates the successful receipt of normal, "in-band" ASCII data. + * EOF - An error has getting the next character (reported by the stream). + * Normally indicates the end of file. + * + ****************************************************************************/ + +int kbd_get(FAR struct lib_instream_s *stream, + FAR struct kget_getstate_s *state, FAR uint8_t *pch) +{ + int ch; + + DEBUGASSERT(stream && state && pch); + + /* Are their ungotten characters from the last, failed parse? */ + + if (state->nch > 0) + { + /* Yes, return the next ungotten character */ + + return kbd_reget(state, pch); + } + + state->ndx = 0; + + /* No, ungotten characters. Check for the beginning of an esc sequence. */ + + ch = stream->get(stream); + if (ch == EOF) + { + /* End of file/stream */ + + return KBD_ERROR; + } + else + { + state->buf[NDX_ESC] = (uint8_t)ch; + state->nch = NCH_ESC; + + if (ch != ASCII_ESC) + { + /* Not the beginning of an escape sequence. Return the character. */ + + return kbd_reget(state, pch); + } + } + + /* Check for ESC-[ */ + + ch = stream->get(stream); + if (ch == EOF) + { + /* End of file/stream. Return the escape character now. We will + * return the EOF indication next time. + */ + + return kbd_reget(state, pch); + } + else + { + state->buf[NDX_BRACKET] = ch; + state->nch = NCH_BRACKET; + + if (ch != '[') + { + /* Not the beginning of an escape sequence. Return the ESC now, + * return the following character later. + */ + + return kbd_reget(state, pch); + } + } + + /* Get and verify the special, "out-of-band" command code */ + + ch = stream->get(stream); + if (ch == EOF) + { + /* End of file/stream. Unget everything and return the ESC character. + */ + + return kbd_reget(state, pch); + } + else + { + state->buf[NDX_CODE] = (uint8_t)ch; + state->nch = NCH_CODE; + + /* Check for a valid special command code */ + + if (ch < FIRST_KEYCODE || ch > LAST_KEYCODE) + { + /* Not a special command code, return the ESC now and the next two + * characters later. + */ + + return kbd_reget(state, pch); + } + } + + /* Check for the final semicolon */ + + ch = stream->get(stream); + if (ch == EOF) + { + /* End of file/stream. Unget everything and return the ESC character. + */ + + return kbd_reget(state, pch); + } + else + { + state->buf[NCX_SEMICOLON] = (uint8_t)ch; + state->nch = NCH_SEMICOLON; + + /* Check for a valid special command code */ + + if (ch != ';') + { + /* Not a special command code, return the ESC now and the next two + * characters later. + */ + + return kbd_reget(state, pch); + } + } + + /* We have successfully parsed the the entire escape sequence. Return the + * special code in pch and the value 2. + */ + + *pch = state->buf[NDX_CODE]; + state->nch = 0; + return KBD_SPECIAL; +} + diff --git a/nuttx/libc/misc/lib_kbdencode.c b/nuttx/libc/misc/lib_kbdencode.c new file mode 100644 index 000000000..80bf14777 --- /dev/null +++ b/nuttx/libc/misc/lib_kbdencode.c @@ -0,0 +1,81 @@ +/******************************************************************************************** + * libc/msic/lib_kbdencode.c + * Encoding side of the Keyboard CODEC + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Authors: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include +#include + +#include +#include +#include + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +/**************************************************************************** + * Name: kbd_putspecial + * + * Description: + * Put one special, "out-of-band" command into the output stream. + * + * Input Parameters: + * + * Returned Value: + * None + * + ****************************************************************************/ + +void kbd_putspecial(enum kbd_keycode_e keycode, + FAR struct lib_outstream_s *stream) +{ + DEBUGASSERT(stream && keycode >= KEYCODE_FWDDEL && keycode <= LAST_KEYCODE); + + stream->put(stream, ASCII_ESC); + stream->put(stream, '['); + stream->put(stream, (int)keycode); + stream->put(stream, ';'); +} + -- cgit v1.2.3