hiby: r1: fix headphone detection

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Wed, 15 Jul 2026 09:07:42 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 0c29c97f1ae48a3869c7a3bd3abe3ea5d00d6d71
Author: Roman Artiukhin <[email protected]>
Date:   Wed Jul 15 15:41:24 2026 +0300

    hiby: r1: fix headphone detection
    
    Change-Id: I4fdf47fb3585754428f6be804e65993e965c3914

diff --git a/firmware/target/hosted/hiby/hibylinux_codec.c b/firmware/target/hosted/hiby/hibylinux_codec.c
index 0464dceaf2..ba338f5410 100644
--- a/firmware/target/hosted/hiby/hibylinux_codec.c
+++ b/firmware/target/hosted/hiby/hibylinux_codec.c
@@ -65,11 +65,11 @@ int hiby_has_valid_output(void) {
     const char * const sysfs_hs_switch = "/sys/class/switch/headset/state";
     const char * const sysfs_bal_switch = "/sys/class/switch/balance/state";
 
-    sysfs_get_int(sysfs_hs_switch, &status);
-    if (status) ps = 2; // headset
+    if (sysfs_get_int(sysfs_hs_switch, &status) && status)
+        ps = 2; // headset
 
-    sysfs_get_int(sysfs_bal_switch, &status);
-    if (status) ps = 3; // balanced output
+    if (sysfs_get_int(sysfs_bal_switch, &status) && status)
+        ps = 3; // balanced output
 
     return ps;
 }
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs