mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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:
parent
80eca90481
commit
472a6a69c6
5 changed files with 93 additions and 15 deletions
|
@ -45,6 +45,10 @@
|
|||
#include "lcd.h" /* lcd_active() prototype */
|
||||
#endif
|
||||
|
||||
#if defined(IPOD_ACCESSORY_PROTOCOL) && (defined(IPOD_COLOR) || defined(IPOD_4G) || defined(IPOD_MINI) || defined(IPOD_MINI2G))
|
||||
#include "iap.h"
|
||||
#endif
|
||||
|
||||
static long lastbtn; /* Last valid button status */
|
||||
static long last_read; /* Last button status, for debouncing/filtering */
|
||||
static bool flipped; /* buttons can be flipped to match the LCD flip */
|
||||
|
@ -102,6 +106,12 @@ static int hp_detect_callback(struct timeout *tmo)
|
|||
/* Try to post only transistions */
|
||||
const long id = tmo->data ? SYS_PHONE_PLUGGED : SYS_PHONE_UNPLUGGED;
|
||||
button_queue_post_remove_head(id, 0);
|
||||
|
||||
#if defined(IPOD_ACCESSORY_PROTOCOL) && (defined(IPOD_COLOR) || defined(IPOD_4G) || defined(IPOD_MINI) || defined(IPOD_MINI2G))
|
||||
if (id == SYS_PHONE_UNPLUGGED)
|
||||
iap_reset_state(1);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
/*misc.c:hp_unplug_change*/
|
||||
}
|
||||
|
@ -113,6 +123,7 @@ static int lo_detect_callback(struct timeout *tmo)
|
|||
/* Try to post only transistions */
|
||||
const long id = tmo->data ? SYS_LINEOUT_PLUGGED : SYS_LINEOUT_UNPLUGGED;
|
||||
button_queue_post_remove_head(id, 0);
|
||||
|
||||
return 0;
|
||||
/*misc.c:lo_unplug_change*/
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue