summaryrefslogtreecommitdiffstats
path: root/apps/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c31
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,
value_abs /= scale;
unit_no++;
}
-
+
value = (value < 0) ? -value_abs : value_abs; /* preserve sign */
fraction = (fraction * 1000 / scale) / 10;
- if (value_abs >= 100 || fraction >= 100 || !unit_no)
+ if (value_abs >= 100 || fraction >= 100 || !unit_no)
tbuf[0] = '\0';
else if (value_abs >= 10)
snprintf(tbuf, sizeof(tbuf), "%01u", fraction / 10);
@@ -521,7 +521,7 @@ void car_adapter_mode_init(void)
#endif
#ifdef HAVE_HEADPHONE_DETECTION
-static void unplug_change(bool inserted)
+static void hp_unplug_change(bool inserted)
{
static bool headphone_caused_pause = false;
@@ -553,6 +553,18 @@ static void unplug_change(bool inserted)
}
#endif
+#ifdef HAVE_LINEOUT_DETECTION
+static void lo_unplug_change(bool inserted)
+{
+#ifdef HAVE_LINEOUT_POWEROFF
+ lineout_set(inserted);
+#else
+ (void)inserted;
+ audiohw_set_lineout_volume(0,0);
+#endif
+}
+#endif
+
long default_event_handler_ex(long event, void (*callback)(void *), void *parameter)
{
#if CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO)
@@ -632,13 +644,22 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
#endif
#ifdef HAVE_HEADPHONE_DETECTION
case SYS_PHONE_PLUGGED:
- unplug_change(true);
+ hp_unplug_change(true);
return SYS_PHONE_PLUGGED;
case SYS_PHONE_UNPLUGGED:
- unplug_change(false);
+ hp_unplug_change(false);
return SYS_PHONE_UNPLUGGED;
#endif
+#ifdef HAVE_LINEOUT_DETECTION
+ case SYS_LINEOUT_PLUGGED:
+ lo_unplug_change(true);
+ return SYS_LINEOUT_PLUGGED;
+
+ case SYS_LINEOUT_UNPLUGGED:
+ lo_unplug_change(false);
+ return SYS_LINEOUT_UNPLUGGED;
+#endif
#if CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO)
/* stop playback if we receive a call */
case SYS_CALL_INCOMING: