changed leds

This commit is contained in:
Miguel Fuertes committed 2025-09-19 14:26:55 +02:00
1 parent b7ab2af633
commit 236536e87d
6 files changed
+38 -46

No files matched your search

+5 -4
View File
@@ -30,11 +30,12 @@ define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/uci_defaults $(1)/etc/uci-defaults/99-default-config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/smart-leds-daemon.init $(1)/etc/init.d/smart-leds-daemon
$(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211
$(INSTALL_BIN) ./files/wifi-led.hotplug $(1)/etc/hotplug.d/ieee80211/99-wifi-led
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_BIN) ./files/modem-led.hotplug $(1)/etc/hotplug.d/iface/99-modem-led
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./files/smart-leds-daemon.sh $(1)/usr/bin/smart-leds-daemon
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
@@ -0,0 +1,13 @@
#!/bin/sh
# /etc/hotplug.d/iface/99-modem-led
case "$ACTION:$INTERFACE" in
ifup:modem)
echo 1 > /sys/class/leds/green:wlan/brightness
logger -t smart-leds "Modem UP - Green LED ON"
;;
ifdown:modem)
echo 0 > /sys/class/leds/green:wlan/brightness
logger -t smart-leds "Modem DOWN - Green LED OFF"
;;
esac
@@ -1,20 +0,0 @@
#!/bin/sh /etc/rc.common
# /etc/init.d/smart-leds
START=98
STOP=02
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command /usr/bin/smart-leds-daemon
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
stop_service() {
echo 0 > /sys/class/leds/blue:wan/brightness
echo 0 > /sys/class/leds/green:wlan/brightness
}
@@ -1,20 +0,0 @@
#!/bin/sh
# /usr/bin/smart-leds-daemon
while true; do
# WiFi LED
if ip link show phy0-ap0 2>/dev/null | grep -q "UP"; then
echo 1 > /sys/class/leds/blue:wan/brightness
else
echo 0 > /sys/class/leds/blue:wan/brightness
fi
# 4G LED
if ip addr show wwan0 2>/dev/null | grep -q "inet "; then
echo 1 > /sys/class/leds/green:wlan/brightness
else
echo 0 > /sys/class/leds/green:wlan/brightness
fi
sleep 10
done
@@ -0,0 +1,18 @@
#!/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
fi
;;
remove)
logger -t smart-leds "WiFi device removed, disabling blue LED"
echo 0 > /sys/class/leds/blue:wan/brightness
;;
esac
+2 -2
View File
@@ -20,8 +20,8 @@ Modern version of OpenWrt working on UZ801v3:
- Wireguard Installed
- GRE Protocol Installed
- `init.d` script to manage leds, only on/off if iface, no blinking:
- Led init script: [packages/uz801-tweaks/files/smart_leds](packages/uz801-tweaks/files/smart_leds)
- Activity trigger installed but not in use, _**deactivate init script and add led configs from luci or uci if needed.**_
- Wifi Led: [packages/uz801-tweaks/files/wifi-led.hotplug](packages/uz801-tweaks/files/wifi-led.hotplug)
- Modem Led: [packages/uz801-tweaks/files/modem-led.hotplug](packages/uz801-tweaks/files/modem-led.hotplug)
### How to build OpenWrt
Docker is required!