diff options
Diffstat (limited to 'apps/misc.c')
-rw-r--r-- | apps/misc.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/apps/misc.c b/apps/misc.c index 90865859cf..2106d11164 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -157,11 +157,11 @@ char *output_dyn_value(char *buf, | |||
157 | value_abs /= scale; | 157 | value_abs /= scale; |
158 | unit_no++; | 158 | unit_no++; |
159 | } | 159 | } |
160 | 160 | ||
161 | value = (value < 0) ? -value_abs : value_abs; /* preserve sign */ | 161 | value = (value < 0) ? -value_abs : value_abs; /* preserve sign */ |
162 | fraction = (fraction * 1000 / scale) / 10; | 162 | fraction = (fraction * 1000 / scale) / 10; |
163 | 163 | ||
164 | if (value_abs >= 100 || fraction >= 100 || !unit_no) | 164 | if (value_abs >= 100 || fraction >= 100 || !unit_no) |
165 | tbuf[0] = '\0'; | 165 | tbuf[0] = '\0'; |
166 | else if (value_abs >= 10) | 166 | else if (value_abs >= 10) |
167 | snprintf(tbuf, sizeof(tbuf), "%01u", fraction / 10); | 167 | snprintf(tbuf, sizeof(tbuf), "%01u", fraction / 10); |
@@ -521,7 +521,7 @@ void car_adapter_mode_init(void) | |||
521 | #endif | 521 | #endif |
522 | 522 | ||
523 | #ifdef HAVE_HEADPHONE_DETECTION | 523 | #ifdef HAVE_HEADPHONE_DETECTION |
524 | static void unplug_change(bool inserted) | 524 | static void hp_unplug_change(bool inserted) |
525 | { | 525 | { |
526 | static bool headphone_caused_pause = false; | 526 | static bool headphone_caused_pause = false; |
527 | 527 | ||
@@ -553,6 +553,18 @@ static void unplug_change(bool inserted) | |||
553 | } | 553 | } |
554 | #endif | 554 | #endif |
555 | 555 | ||
556 | #ifdef HAVE_LINEOUT_DETECTION | ||
557 | static void lo_unplug_change(bool inserted) | ||
558 | { | ||
559 | #ifdef HAVE_LINEOUT_POWEROFF | ||
560 | lineout_set(inserted); | ||
561 | #else | ||
562 | (void)inserted; | ||
563 | audiohw_set_lineout_volume(0,0); | ||
564 | #endif | ||
565 | } | ||
566 | #endif | ||
567 | |||
556 | long default_event_handler_ex(long event, void (*callback)(void *), void *parameter) | 568 | long default_event_handler_ex(long event, void (*callback)(void *), void *parameter) |
557 | { | 569 | { |
558 | #if CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO) | 570 | #if CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO) |
@@ -632,13 +644,22 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame | |||
632 | #endif | 644 | #endif |
633 | #ifdef HAVE_HEADPHONE_DETECTION | 645 | #ifdef HAVE_HEADPHONE_DETECTION |
634 | case SYS_PHONE_PLUGGED: | 646 | case SYS_PHONE_PLUGGED: |
635 | unplug_change(true); | 647 | hp_unplug_change(true); |
636 | return SYS_PHONE_PLUGGED; | 648 | return SYS_PHONE_PLUGGED; |
637 | 649 | ||
638 | case SYS_PHONE_UNPLUGGED: | 650 | case SYS_PHONE_UNPLUGGED: |
639 | unplug_change(false); | 651 | hp_unplug_change(false); |
640 | return SYS_PHONE_UNPLUGGED; | 652 | return SYS_PHONE_UNPLUGGED; |
641 | #endif | 653 | #endif |
654 | #ifdef HAVE_LINEOUT_DETECTION | ||
655 | case SYS_LINEOUT_PLUGGED: | ||
656 | lo_unplug_change(true); | ||
657 | return SYS_LINEOUT_PLUGGED; | ||
658 | |||
659 | case SYS_LINEOUT_UNPLUGGED: | ||
660 | lo_unplug_change(false); | ||
661 | return SYS_LINEOUT_UNPLUGGED; | ||
662 | #endif | ||
642 | #if CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO) | 663 | #if CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO) |
643 | /* stop playback if we receive a call */ | 664 | /* stop playback if we receive a call */ |
644 | case SYS_CALL_INCOMING: | 665 | case SYS_CALL_INCOMING: |