X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Flpc%2Fao_usb_lpc.c;h=aac0df04a8956f5b485dfcc9940ac4814fe571ef;hp=0f8817207aecdadf7745e74eb1d1f348b9e91496;hb=35b120c4154df0351c3a802f86dda224a7643068;hpb=ac089d4fb930b7dbc4161259fd9bddba94395ebc diff --git a/src/lpc/ao_usb_lpc.c b/src/lpc/ao_usb_lpc.c index 0f881720..aac0df04 100644 --- a/src/lpc/ao_usb_lpc.c +++ b/src/lpc/ao_usb_lpc.c @@ -81,7 +81,7 @@ static uint8_t ao_usb_tx_count; static uint8_t ao_usb_rx_buffer[AO_USB_OUT_SIZE]; static uint8_t ao_usb_rx_count, ao_usb_rx_pos; -static struct lpc_usb_endpoint lpc_usb_endpoint __attribute((aligned(256))); +extern struct lpc_usb_endpoint lpc_usb_endpoint; /* Marks when we don't need to send an IN packet. * This happens only when the last IN packet is not full, @@ -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(); }