Add support for key release events
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5464 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
f18028f1bc
commit
42149b6373
@ -455,4 +455,7 @@
|
|||||||
this build phase.
|
this build phase.
|
||||||
* apps/examples/hidbkd: Now supports decoding of encoded special keys
|
* apps/examples/hidbkd: Now supports decoding of encoded special keys
|
||||||
if CONFIG_EXAMPLES_HIDKBD_ENCODED is defined.
|
if CONFIG_EXAMPLES_HIDKBD_ENCODED is defined.
|
||||||
|
* apps/examples/hidbkd: Add support for decoding key release events
|
||||||
|
as well. 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.
|
||||||
|
@ -176,7 +176,7 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes)
|
|||||||
{
|
{
|
||||||
/* Decode the next thing from the buffer */
|
/* Decode the next thing from the buffer */
|
||||||
|
|
||||||
ret = kbd_get((FAR struct lib_instream_s *)&kbdstream, &state, &ch);
|
ret = kbd_decode((FAR struct lib_instream_s *)&kbdstream, &state, &ch);
|
||||||
if (ret == KBD_ERROR)
|
if (ret == KBD_ERROR)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@ -184,14 +184,31 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes)
|
|||||||
|
|
||||||
/* Normal data? Or special key? */
|
/* Normal data? Or special key? */
|
||||||
|
|
||||||
if (ret == KBD_NORMAL)
|
switch (ret)
|
||||||
{
|
{
|
||||||
printf("Data: %c [%02x]\n", isprint(ch) ? ch : '.', ch);
|
case KBD_PRESS: /* Key press event */
|
||||||
}
|
printf("Normal Press: %c [%02x]\n", isprint(ch) ? ch : '.', ch);
|
||||||
else
|
break;
|
||||||
{
|
|
||||||
DEBUGASSERT(ret == KBD_SPECIAL);
|
case KBD_RELEASE: /* Key release event */
|
||||||
printf("Special: %d\n", ch);
|
printf("Normal Release: %c [%02x]\n", isprint(ch) ? ch : '.', ch);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBD_SPECPRESS: /* Special key press event */
|
||||||
|
printf("Special Press: %d\n", ch);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBD_SPECREL: /* Special key release event */
|
||||||
|
printf("Special Release: %d\n", ch);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBD_ERROR: /* Error or end-of-file */
|
||||||
|
printf("EOF: %d\n", ret);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("Unexpected: %d\n", ret);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user