]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
Fix LUFA host driver for unconfigured state
authortmk <nobody@nowhere>
Sat, 13 Apr 2013 02:55:57 +0000 (11:55 +0900)
committertmk <nobody@nowhere>
Sat, 13 Apr 2013 02:55:57 +0000 (11:55 +0900)
protocol/lufa/lufa.c

index 7c707209014f94569b2d9bf190532bc6407d0f04..a863b8d23cbb842e4b7a3f2bd9b28a88bf190ecb 100644 (file)
@@ -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