altos/lpc: Force idle mode if USB gets an address during boot time
[fw/altos] / src / lpc / ao_usb_lpc.c
index 8070acc36ddd1f174b285fee8bec04fd016f705f..aac0df04a8956f5b485dfcc9940ac4814fe571ef 100644 (file)
@@ -605,8 +605,14 @@ ao_usb_ep0_handle(uint8_t receive)
                /* Wait until the IN packet is received from addr 0
                 * before assigning our local address
                 */
-               if (ao_usb_address_pending)
+               if (ao_usb_address_pending) {
+#if HAS_FLIGHT
+                       /* Go to idle mode if USB is connected
+                        */
+                       ao_flight_force_idle = 1;
+#endif
                        ao_usb_set_address(ao_usb_address);
+               }
                if (ao_usb_ep0_state == AO_USB_EP0_DATA_IN)
                        ao_usb_ep0_flush();
        }