summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/xduoo
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-01 14:06:48 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-01 15:41:30 -0400
commitb030bf5885dc5e018dd38eacbb294f1321f2b400 (patch)
tree4d9f06c7928fa44d225477b5551c69c29617a98a /firmware/target/hosted/xduoo
parent6d47dc9a8860a17a9e630b8662f33df63011bad9 (diff)
downloadrockbox-b030bf5885dc5e018dd38eacbb294f1321f2b400.tar.gz
rockbox-b030bf5885dc5e018dd38eacbb294f1321f2b400.tar.bz2
rockbox-b030bf5885dc5e018dd38eacbb294f1321f2b400.zip
xduoox3ii/x20: Proper lineout detection and volume mangling.
hotplugging hp and lineout works, without blowing out eardrums. Change-Id: I2df5c7a618bb2d1d77d416548d45dff9cfc619db
Diffstat (limited to 'firmware/target/hosted/xduoo')
-rw-r--r--firmware/target/hosted/xduoo/button-xduoo.c23
1 files changed, 7 insertions, 16 deletions
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)
bool headphones_inserted(void)
{
- int status = 0;
- const char * const sysfs_lo_switch = "/sys/class/switch/lineout/state";
- const char * const sysfs_hs_switch = "/sys/class/switch/headset/state";
-#ifdef XDUOO_X20
- const char * const sysfs_bal_switch = "/sys/class/switch/balance/state";
-#endif
-
- sysfs_get_int(sysfs_lo_switch, &status);
- if (status) return true;
+ int ps = xduoo_get_outputs();
- sysfs_get_int(sysfs_hs_switch, &status);
- if (status) return true;
+ return (ps == 2 || ps == 3);
+}
-#ifdef XDUOO_X20
- sysfs_get_int(sysfs_bal_switch, &status);
- if (status) return true;
-#endif
+bool lineout_inserted(void)
+{
+ int ps = xduoo_get_outputs();
- return false;
+ return (ps == 1);
}
void button_close_device(void)