diff --git a/src/platforms/native/platform.c b/src/platforms/native/platform.c index 355441adee6..c1b17bf6814 100644 --- a/src/platforms/native/platform.c +++ b/src/platforms/native/platform.c @@ -40,6 +40,7 @@ static void adc_init(void); static void setup_vbus_irq(void); +static void wait_for_usb_host_config_request(void); /* This is defined by the linker script */ extern char vector_table; @@ -240,6 +241,7 @@ void platform_init(void) aux_serial_init(); setup_vbus_irq(); + wait_for_usb_host_config_request(); } void platform_nrst_set_val(bool assert) @@ -485,3 +487,16 @@ static void setup_vbus_irq(void) exti15_10_isr(); } + +static void wait_for_usb_host_config_request(void) +{ + if (usb_get_config() == 0) { + morse("NO USB HOST.", true); + } + + /* Wait for completion of USB serial or DFU configuration */ + while (usb_get_config() == 0) { + } + + morse(NULL, false); +}