From: tmk Date: Mon, 18 Nov 2013 18:20:25 +0000 (+0900) Subject: Wait for USB starting up to make debug print available X-Git-Url: https://git.gir.st/tmk_keyboard.git/commitdiff_plain/9d40be19908394e44cdda5d3c73d21e8d3795e72 Wait for USB starting up to make debug print available --- diff --git a/common/action_util.h b/common/action_util.h index 939bc2b6..f9d3161a 100644 --- a/common/action_util.h +++ b/common/action_util.h @@ -18,6 +18,7 @@ along with this program. If not, see . #define ACTION_UTIL_H #include +#include "report.h" extern report_keyboard_t *keyboard_report; diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index a230d5ba..04e8e78f 100644 --- a/protocol/lufa/lufa.c +++ b/protocol/lufa/lufa.c @@ -539,11 +539,18 @@ int main(void) { SetupHardware(); sei(); + + /* wait for USB startup & debug output */ + while (USB_DeviceState != DEVICE_STATE_Configured) { #if defined(INTERRUPT_CONTROL_ENDPOINT) - while (USB_DeviceState != DEVICE_STATE_Configured) ; + ; +#else + USB_USBTask(); #endif + } print("USB configured.\n"); + /* init modules */ keyboard_init(); host_set_driver(&lufa_driver); #ifdef SLEEP_LED_ENABLE