summaryrefslogtreecommitdiffstats
path: root/app/consumer.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/consumer.c')
-rw-r--r--app/consumer.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/consumer.c b/app/consumer.c
index 79d25bb..b1b6290 100644
--- a/app/consumer.c
+++ b/app/consumer.c
@@ -99,13 +99,15 @@ consumer_send (uint16_t keys)
/*Last byte is the power wakeup stuff that we don't yet support */
uint8_t buf[CONSUMER_EP_TXN_SIZE] = { keys & 0xff, keys >> 8 };
- usbd_ep_write_packet (usbd_dev, CONSUMER_EP, buf, sizeof (buf));
+ if (!usb_is_suspended)
+ usbd_ep_write_packet (usbd_dev, CONSUMER_EP, buf, sizeof (buf));
}
+static uint16_t keys;
+
void
consumer_dispatch (int bit, int updown)
{
- static uint16_t keys;
if (updown)
keys |= bit;
@@ -117,7 +119,14 @@ consumer_dispatch (int bit, int updown)
printf ("CNS> %02x %02x\r\n", keys & 0xff, keys >> 8);
#endif
- consumer_send (keys);
+ usb_wakeup_host();
+ consumer_send (keys);
+}
+void
+consumer_error (void)
+{
+ keys = 0;
+ consumer_send (keys);
}