summaryrefslogtreecommitdiffstats
path: root/firmware/target/hosted/xduoo/button-xduoo.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/xduoo/button-xduoo.c')
-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)