summaryrefslogtreecommitdiffstats
path: root/app/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/keyboard.c')
-rw-r--r--app/keyboard.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/app/keyboard.c b/app/keyboard.c
index f780ccc..dcbd824 100644
--- a/app/keyboard.c
+++ b/app/keyboard.c
@@ -128,7 +128,7 @@ keyboard_send (uint8_t modifiers, uint8_t * key_list)
};
if (!usb_is_suspended)
- usbd_ep_write_packet (usbd_dev, KEYBOARD_EP, buf, sizeof (buf));
+ usbd_ep_write_packet (usbd_dev, KEYBOARD_EP, buf, sizeof (buf));
}
static uint8_t modifiers;
@@ -142,7 +142,7 @@ keyboard_dispatch (int sc, int updown)
/*Windows needs the modifiers spliting out, so we do this as per our
* descriptor, others need them in the list so we do that as well */
- usb_wakeup_host();
+ usb_wakeup_host ();
switch (sc)
{
@@ -166,14 +166,28 @@ keyboard_dispatch (int sc, int updown)
if (updown)
{
+ int found = 0;
+
for (i = 0; i < KEY_LIST_LEN; ++i)
{
- if ((key_list[i] == 0) || (key_list[i] == sc))
+ if (key_list[i] == sc)
{
- key_list[i] = sc;
- break;
+ found++;
}
}
+
+ if (!found)
+ {
+ for (i = 0; i < KEY_LIST_LEN; ++i)
+ {
+ if (!key_list[i])
+ {
+ key_list[i] = sc;
+ break;
+ }
+ }
+ }
+
}
else
{