diff options
| author | root <root@no.no.james.local> | 2015-06-15 18:07:21 +0100 | 
|---|---|---|
| committer | root <root@no.no.james.local> | 2015-06-15 18:07:21 +0100 | 
| commit | a7b53bdade367d877dd34ad063762e5c8feecbb0 (patch) | |
| tree | 6eec47ab558ca737e2a6bce80cb3823e4692150d | |
| parent | cd568297a41e5a6f2e130de82c07b6b789d34f4b (diff) | |
| download | tims_keyboard-a7b53bdade367d877dd34ad063762e5c8feecbb0.tar.gz tims_keyboard-a7b53bdade367d877dd34ad063762e5c8feecbb0.tar.bz2 tims_keyboard-a7b53bdade367d877dd34ad063762e5c8feecbb0.zip  | |
| -rw-r--r-- | app/Makefile | 2 | ||||
| -rw-r--r-- | app/keyboard.c | 24 | 
2 files changed, 20 insertions, 6 deletions
diff --git a/app/Makefile b/app/Makefile index 7c378cf..30debb5 100644 --- a/app/Makefile +++ b/app/Makefile @@ -32,7 +32,7 @@ OBJS = ${CSRCS:%.c=%.o}  include ../Makefile.include -CFLAGS+=-Wno-redundant-decls -Wno-unused-parameter #-DDEBUG +CFLAGS+=-Wno-redundant-decls -Wno-unused-parameter -DDEBUG  DID=$(shell printf '\#include "id.h"\nID_PRODUCT' | ${CC} -I.. -E - | grep -v ^\# ) 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          {  | 
