mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 13:03:34 +08:00
Add support for key release events
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5464 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -176,7 +176,7 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes)
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
break;
|
||||
@@ -184,14 +184,31 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes)
|
||||
|
||||
/* Normal data? Or special key? */
|
||||
|
||||
if (ret == KBD_NORMAL)
|
||||
switch (ret)
|
||||
{
|
||||
printf("Data: %c [%02x]\n", isprint(ch) ? ch : '.', ch);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUGASSERT(ret == KBD_SPECIAL);
|
||||
printf("Special: %d\n", ch);
|
||||
case KBD_PRESS: /* Key press event */
|
||||
printf("Normal Press: %c [%02x]\n", isprint(ch) ? ch : '.', ch);
|
||||
break;
|
||||
|
||||
case KBD_RELEASE: /* Key release event */
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user