diff options
Diffstat (limited to 'app/keyboard.c')
-rw-r--r-- | app/keyboard.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/app/keyboard.c b/app/keyboard.c index d35f466..f780ccc 100644 --- a/app/keyboard.c +++ b/app/keyboard.c @@ -127,19 +127,23 @@ keyboard_send (uint8_t modifiers, uint8_t * key_list) key_list[4], key_list[5], 0 }; - usbd_ep_write_packet (usbd_dev, KEYBOARD_EP, buf, sizeof (buf)); + if (!usb_is_suspended) + usbd_ep_write_packet (usbd_dev, KEYBOARD_EP, buf, sizeof (buf)); } +static uint8_t modifiers; +static uint8_t key_list[KEY_LIST_LEN]; + void keyboard_dispatch (int sc, int updown) { - static uint8_t modifiers; - static uint8_t key_list[KEY_LIST_LEN]; int i; /*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(); + switch (sc) { case USB_K_SC_LEFTCTRL: @@ -156,6 +160,7 @@ keyboard_dispatch (int sc, int updown) modifiers &= ~(1 << (sc - USB_K_SC_LEFTCTRL)); break; default: + /* Some oses are picky and need these not to move about so we make * a list of the down keys */ @@ -195,6 +200,16 @@ keyboard_dispatch (int sc, int updown) } +void +keyboard_error (void) +{ + modifiers = 0; + memset (key_list, 0, sizeof (key_list)); + keyboard_send (modifiers, key_list); +} + + + int keyboard_control_request (usbd_device * usbd_dev, struct usb_setup_data *req, uint8_t ** buf, uint16_t * len, |