1
0
Fork 0
forked from len0rd/rockbox

IAP: Reset IAP state upon headphone or dock unplug

Provides a semi-automatic way of recovering from desynchronization

Change-Id: I527b0bacc22ef38c1e7213653e522ea1b0ac155d
This commit is contained in:
Solomon Peachy 2025-08-06 14:26:34 -04:00
parent 80eca90481
commit 472a6a69c6
5 changed files with 93 additions and 15 deletions

View file

@ -51,6 +51,10 @@
#include "gui/skin_engine/skin_engine.h"
#endif
#if defined(IPOD_ACCESSORY_PROTOCOL)
#include "iap.h"
#endif
/* Conditions under which we want the entire driver */
#if !defined(BOOTLOADER) || \
(defined(HAVE_USBSTACK) && defined(HAVE_BOOTLOADER_USB_MODE)) || \
@ -521,6 +525,10 @@ static void NORETURN_ATTR usb_thread(void)
if(usb_state == USB_POWERED || usb_state == USB_INSERTED)
usb_stack_enable(false);
#ifdef IPOD_ACCESSORY_PROTOCOL
iap_reset_state(0);
#endif
/* Only disable the USB slave mode if we really have enabled
it. Some expected acks may not have been received. */
if(usb_state == USB_INSERTED)