working with buttons

This commit is contained in:
Miguel Fuertes committed 2025-10-21 21:10:08 +02:00
1 parent 4c162d3576
commit 83660359fa
3 files changed
+3 -5

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ endef
define Package/ledcontrol/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/ledcontrol.sh $(1)/usr/sbin/
$(INSTALL_BIN) ./files/ledcontrol.sh $(1)/usr/sbin/ledcontrol
$(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211
$(INSTALL_DATA) ./files/99-wifi-led $(1)/etc/hotplug.d/ieee80211/
@@ -4,11 +4,9 @@
[ "$BUTTON" = "power" ] || exit 0
[ "$ACTION" = "pressed" ] || exit 0
# Solo actuar si NO está cargando
charging=$(cat /sys/class/power_supply/pm8916-lbc-chgr/online 2>/dev/null || echo 0)
if [ "$charging" = "0" ]; then
# Enviar SIGUSR1 al daemon para mostrar batería
[ -f /var/run/battery-monitor.pid ] && {
kill -USR1 $(cat /var/run/battery-monitor.pid) 2>/dev/null
logger -t button-battery "SIGUSR1 sent to battery-monitor"
@@ -93,9 +93,9 @@ stop() {
rm -f /var/run/battery-monitor.pid
}
ledcontrol charging green off 2>/dev/null
ledcontrol charging red blink 2>/dev/null
ledcontrol charging green blink 2>/dev/null
logger -t shutdown-led "BAT LED blinking amber - shutdown"
logger -t shutdown-led "BAT LED blinking - shutdown"
return 0
}