summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-04-13 11:55:57 +0900
committertmk <nobody@nowhere>2013-04-13 11:55:57 +0900
commit1eb67303ee7b8a037d035e97ffd2d19b030fe3f2 (patch)
tree26d7c5574cf333b9a4f1a8f3943301ca41e7b723
parent1348663a4ff1a4696db39e72bcb751608714de8e (diff)
Fix LUFA host driver for unconfigured state
-rw-r--r--protocol/lufa/lufa.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c
index 7c70720901..a863b8d23c 100644
--- a/protocol/lufa/lufa.c
+++ b/protocol/lufa/lufa.c
@@ -347,6 +347,9 @@ static void send_keyboard(report_keyboard_t *report)
{
uint8_t timeout = 0;
+ if (USB_DeviceState != DEVICE_STATE_Configured)
+ return;
+
// TODO: handle NKRO report
/* Select the Keyboard Report Endpoint */
Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);
@@ -368,6 +371,9 @@ static void send_mouse(report_mouse_t *report)
#ifdef MOUSE_ENABLE
uint8_t timeout = 0;
+ if (USB_DeviceState != DEVICE_STATE_Configured)
+ return;
+
/* Select the Mouse Report Endpoint */
Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
@@ -386,6 +392,9 @@ static void send_system(uint16_t data)
{
uint8_t timeout = 0;
+ if (USB_DeviceState != DEVICE_STATE_Configured)
+ return;
+
report_extra_t r = {
.report_id = REPORT_ID_SYSTEM,
.usage = data
@@ -400,6 +409,9 @@ static void send_consumer(uint16_t data)
{
uint8_t timeout = 0;
+ if (USB_DeviceState != DEVICE_STATE_Configured)
+ return;
+
report_extra_t r = {
.report_id = REPORT_ID_CONSUMER,
.usage = data