summaryrefslogtreecommitdiff
path: root/firmware/target/hosted
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r--firmware/target/hosted/agptek/debug-agptek.c7
-rw-r--r--firmware/target/hosted/alsa-controls.c10
-rw-r--r--firmware/target/hosted/xduoo/button-xduoo.c23
3 files changed, 19 insertions, 21 deletions
diff --git a/firmware/target/hosted/agptek/debug-agptek.c b/firmware/target/hosted/agptek/debug-agptek.c
index b4fcb4246b..7f794a7073 100644
--- a/firmware/target/hosted/agptek/debug-agptek.c
+++ b/firmware/target/hosted/agptek/debug-agptek.c
@@ -41,6 +41,13 @@ bool dbg_hw_info(void)
41 line = 0; 41 line = 0;
42 42
43 lcd_putsf(0, line++, "pcm srate: %d", pcm_alsa_get_rate()); 43 lcd_putsf(0, line++, "pcm srate: %d", pcm_alsa_get_rate());
44#ifdef HAVE_HEADPHONE_DETECTION
45 lcd_putsf(0, line++, "hp: %d", headphones_inserted());
46#endif
47#ifdef HAVE_LINEOUT_DETECTION
48 lcd_putsf(0, line++, "lo: %d", lineout_inserted());
49#endif
50
44 btn = button_read_device(); 51 btn = button_read_device();
45 52
46 lcd_update(); 53 lcd_update();
diff --git a/firmware/target/hosted/alsa-controls.c b/firmware/target/hosted/alsa-controls.c
index 19de7aea44..f4914aa216 100644
--- a/firmware/target/hosted/alsa-controls.c
+++ b/firmware/target/hosted/alsa-controls.c
@@ -1,10 +1,10 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2016 Amaury Pouly 9 * Copyright (C) 2016 Amaury Pouly
10 * 10 *
diff --git a/firmware/target/hosted/xduoo/button-xduoo.c b/firmware/target/hosted/xduoo/button-xduoo.c
index 9fd1392b89..03bb7bbfc9 100644
--- a/firmware/target/hosted/xduoo/button-xduoo.c
+++ b/firmware/target/hosted/xduoo/button-xduoo.c
@@ -166,25 +166,16 @@ int button_read_device(void)
166 166
167bool headphones_inserted(void) 167bool headphones_inserted(void)
168{ 168{
169 int status = 0; 169 int ps = xduoo_get_outputs();
170 const char * const sysfs_lo_switch = "/sys/class/switch/lineout/state";
171 const char * const sysfs_hs_switch = "/sys/class/switch/headset/state";
172#ifdef XDUOO_X20
173 const char * const sysfs_bal_switch = "/sys/class/switch/balance/state";
174#endif
175
176 sysfs_get_int(sysfs_lo_switch, &status);
177 if (status) return true;
178 170
179 sysfs_get_int(sysfs_hs_switch, &status); 171 return (ps == 2 || ps == 3);
180 if (status) return true; 172}
181 173
182#ifdef XDUOO_X20 174bool lineout_inserted(void)
183 sysfs_get_int(sysfs_bal_switch, &status); 175{
184 if (status) return true; 176 int ps = xduoo_get_outputs();
185#endif
186 177
187 return false; 178 return (ps == 1);
188} 179}
189 180
190void button_close_device(void) 181void button_close_device(void)