summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/audio_path.c13
-rw-r--r--apps/misc.c33
-rw-r--r--apps/root_menu.c15
-rw-r--r--apps/settings.h2
4 files changed, 51 insertions, 12 deletions
diff --git a/apps/audio_path.c b/apps/audio_path.c
index bb73052a95..f908017bc3 100644
--- a/apps/audio_path.c
+++ b/apps/audio_path.c
@@ -169,10 +169,19 @@ int audio_get_spdif_sample_rate(void)
169#ifdef HAVE_SPEAKER 169#ifdef HAVE_SPEAKER
170void audio_enable_speaker(int mode) 170void audio_enable_speaker(int mode)
171{ 171{
172#ifdef HAVE_HEADPHONE_DETECTION 172#if defined(HAVE_HEADPHONE_DETECTION) || defined(HAVE_LINEOUT_DETECTION)
173 /* if needed, query jack state */ 173 /* if needed, query jack state */
174 if(mode == 2) 174 if(mode == 2)
175 mode = !headphones_inserted(); 175 {
176#ifdef HAVE_HEADPHONE_DETECTION
177 if (headphones_inserted())
178 mode = 0;
179#endif
180#ifdef HAVE_LINEOUT_DETECTION
181 if (lineout_inserted())
182 mode = 0;
183#endif
184 }
176#endif 185#endif
177 /* treat any nonzero value as enable */ 186 /* treat any nonzero value as enable */
178 audiohw_enable_speaker(mode); 187 audiohw_enable_speaker(mode);
diff --git a/apps/misc.c b/apps/misc.c
index 2d60ecca49..d255eaf766 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -498,7 +498,7 @@ void car_adapter_mode_init(void)
498#ifdef HAVE_HEADPHONE_DETECTION 498#ifdef HAVE_HEADPHONE_DETECTION
499static void hp_unplug_change(bool inserted) 499static void hp_unplug_change(bool inserted)
500{ 500{
501 static bool headphone_caused_pause = false; 501 static bool headphone_caused_pause = true;
502 502
503 if (global_settings.unplug_mode) 503 if (global_settings.unplug_mode)
504 { 504 {
@@ -526,7 +526,7 @@ static void hp_unplug_change(bool inserted)
526 audio_enable_speaker(global_settings.speaker_mode); 526 audio_enable_speaker(global_settings.speaker_mode);
527#endif 527#endif
528} 528}
529#endif 529#endif /*HAVE_HEADPHONE_DETECTION*/
530 530
531#ifdef HAVE_LINEOUT_DETECTION 531#ifdef HAVE_LINEOUT_DETECTION
532static void lo_unplug_change(bool inserted) 532static void lo_unplug_change(bool inserted)
@@ -534,11 +534,32 @@ static void lo_unplug_change(bool inserted)
534#ifdef HAVE_LINEOUT_POWEROFF 534#ifdef HAVE_LINEOUT_POWEROFF
535 lineout_set(inserted); 535 lineout_set(inserted);
536#else 536#else
537 (void)inserted; 537 audiohw_set_lineout_volume(0,0); /*hp vol re-set by this function as well*/
538 audiohw_set_lineout_volume(0,0); 538 static bool lineout_caused_pause = true;
539#endif 539
540 if (global_settings.unplug_mode)
541 {
542 int audio_stat = audio_status();
543 if (inserted)
544 {
545 backlight_on();
546 if ((audio_stat & AUDIO_STATUS_PLAY) &&
547 lineout_caused_pause &&
548 global_settings.unplug_mode > 1 )
549 unpause_action(true, true);
550 lineout_caused_pause = false;
551 } else {
552 if ((audio_stat & AUDIO_STATUS_PLAY) &&
553 !(audio_stat & AUDIO_STATUS_PAUSE))
554 {
555 lineout_caused_pause = true;
556 pause_action(false, false);
557 }
558 }
559 }
560#endif /*HAVE_LINEOUT_POWEROFF*/
540} 561}
541#endif 562#endif /*HAVE_LINEOUT_DETECTION*/
542 563
543long default_event_handler_ex(long event, void (*callback)(void *), void *parameter) 564long default_event_handler_ex(long event, void (*callback)(void *), void *parameter)
544{ 565{
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 2a8662a170..77a092018a 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -767,11 +767,20 @@ void root_menu(void)
767 } 767 }
768#endif /* HAVE_RTC_ALARM */ 768#endif /* HAVE_RTC_ALARM */
769 769
770#if defined(HAVE_HEADPHONE_DETECTION) || defined(HAVE_LINEOUT_DETECTION)
771 if (next_screen == GO_TO_WPS && global_settings.unplug_autoresume)
772 {
773 next_screen = GO_TO_ROOT;
770#ifdef HAVE_HEADPHONE_DETECTION 774#ifdef HAVE_HEADPHONE_DETECTION
771 if (next_screen == GO_TO_WPS && 775 if (headphones_inserted())
772 (global_settings.unplug_autoresume && !headphones_inserted() )) 776 next_screen = GO_TO_WPS;
773 next_screen = GO_TO_ROOT; 777#endif
778#ifdef HAVE_LINEOUT_DETECTION
779 if (lineout_inserted())
780 next_screen = GO_TO_WPS;
774#endif 781#endif
782 }
783#endif /*(HAVE_HEADPHONE_DETECTION) || (HAVE_LINEOUT_DETECTION)*/
775 784
776 while (true) 785 while (true)
777 { 786 {
diff --git a/apps/settings.h b/apps/settings.h
index 405a31d052..ec66553660 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -448,7 +448,7 @@ struct user_settings
448#endif 448#endif
449 449
450 int pause_rewind; /* time in s to rewind when pausing */ 450 int pause_rewind; /* time in s to rewind when pausing */
451#ifdef HAVE_HEADPHONE_DETECTION 451#if defined(HAVE_HEADPHONE_DETECTION) || defined(HAVE_LINEOUT_DETECTION)
452 int unplug_mode; /* pause on headphone unplug */ 452 int unplug_mode; /* pause on headphone unplug */
453 bool unplug_autoresume; /* disable auto-resume if no phones */ 453 bool unplug_autoresume; /* disable auto-resume if no phones */
454#endif 454#endif