diff --git a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c index ed7dab1572..01acc6905e 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c @@ -818,7 +818,19 @@ void avr_thread(void) while (1) { - queue_wait(&avr_queue, &ev); + if (avr_state_changed()) + { + /* We have to read AVR state, simply check if there's any event + * pending but do not block. It is possible that AVR interrupt + * line is held active even though we read the state (change + * occured during read). + */ + queue_wait_w_tmo(&avr_queue, &ev, 0); + } + else + { + queue_wait(&avr_queue, &ev); + } if (ev.id == SYS_USB_CONNECTED) {