fixed led

This commit is contained in:
Miguel Fuertes committed 2025-09-19 17:08:06 +02:00
1 parent 8ec6ffabb4
commit 50d71d79b2
1 file changed
+13 -8
+13 -8
View File
@@ -1,18 +1,23 @@
#!/bin/sh
# /etc/hotplug.d/ieee80211/99-wifi-led
logger -t smart-leds-wifi "IEEE80211 Event: ACTION=$ACTION DEVICENAME=$DEVICENAME"
case "$ACTION" in
add)
sleep 3
if ip link show phy0-ap0 2>/dev/null | grep -q "UP"; then
logger -t smart-leds "WiFi device added and UP, enabling blue LED"
echo 1 > /sys/class/leds/blue:wan/brightness
if [ "$DEVICENAME" = "phy0" ]; then
sleep 5
if ip link show phy0-ap0 2>/dev/null >/dev/null; then
echo 1 > /sys/class/leds/blue:wan/brightness
logger -t wifi-led "phy0-ap0 exists, blue LED ON"
else
echo 0 > /sys/class/leds/blue:wan/brightness
logger -t wifi-led "phy0-ap0 missing, blue LED OFF"
fi
fi
;;
remove)
logger -t smart-leds "WiFi device removed, disabling blue LED"
echo 0 > /sys/class/leds/blue:wan/brightness
if [ "$DEVICENAME" = "phy0" ]; then
echo 0 > /sys/class/leds/blue:wan/brightness
logger -t wifi-led "phy0 removed, blue LED OFF"
fi
;;
esac