From ff65170baaa59c7ee81cd65cfa4bfb847a44a7a2 Mon Sep 17 00:00:00 2001
From: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
Date: Sat, 6 May 2023 16:53:10 +0200
Subject: [PATCH] shipmode: Fix the bq25890 sysfs path for recent kernels

Since Linux 6.3 bq25890 supports having multiple instances and
therefore the name in sysfs has changed. Adjust the script
to use the new name.
---
 default/shipmode/l5-poweroff-shipmode | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/default/shipmode/l5-poweroff-shipmode b/default/shipmode/l5-poweroff-shipmode
index a7a849a..a1df624 100755
--- a/default/shipmode/l5-poweroff-shipmode
+++ b/default/shipmode/l5-poweroff-shipmode
@@ -15,7 +15,7 @@ fi
 # when turned off. Disconnecting the charger later would of course
 # result in the "old" behaviour of slowly discharging while powered off
 # because ship mode is not set:
-charging=$(cat /sys/class/power_supply/bq25890-charger/online)
+charging=$(cat /sys/class/power_supply/bq25890-charger-0/online)
 if [ "$charging" -eq "1" ]; then
 	echo 'Charger connected. Not setting ship mode.'
 	exit 0
@@ -24,6 +24,6 @@ fi
 # Only continue setting ship mode when running on battery.
 # Connecting a charger will turn on the phone. The battery will
 # not have been discharged in the meantime though:
-echo 0 > /sys/class/power_supply/bq25890-charger/online
+echo 0 > /sys/class/power_supply/bq25890-charger-0/online
 # shut off the battery with 10-15 second delay
 i2cset -f -y 3 0x6a 0x09 0x6e
-- 
GitLab