Sansa Connect: Prevent unresponsive interface

AVR interrupt signal can remain active if the state has changed during
state read. In such case, there won't be intterupt and the interface
would appear unresponsive until AVR thread received event (e.g. USB
connection/disconnect). Solve the issue by not waiting for event if AVR
interrupt signal is active prior to event wait.

Change-Id: I86e388c7cd6da76e3abe7bf7114940f331e4c308
This commit is contained in:
Tomasz Moń 2021-07-07 12:52:05 +02:00
parent e9ae1e9a8b
commit 99bf506407
1 changed files with 13 additions and 1 deletions

View File

@ -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)
{