Files
msm8916-openwrt/packages/configs-dongle/files/hotplugs/99-wifi-led
T
Miguel Fuertes 104145900b Add battery monitoring and LED control features
- Implemented a battery-monitor service to track battery capacity and charging status, controlling LEDs accordingly.
- Created a battery status page in LuCI to display voltage, status, health, and estimated capacity.
- Added hotplug scripts to trigger battery status updates on power button presses and modem interface changes.
- Developed LED control scripts for modem and WiFi status indicators.
- Configured UCI defaults to enable WiFi and set up a modem interface with appropriate settings.
- Introduced a utility script for LED control with various actions (on, off, blink).
- Added a power button script for double-click shutdown functionality.
2025-10-22 11:30:28 +02:00

30 lines
932 B
Bash

#!/bin/sh
# /etc/hotplug.d/ieee80211/99-wifi-led
# WiFi LED control based on phy0 status
case "$ACTION" in
add)
if [ "$DEVICENAME" = "phy0" ]; then
sleep 5
# Check interface status
ap_status=$(ip link show phy0-ap0 2>/dev/null | grep -c "state UP")
sta_status=$(ip link show phy0-sta0 2>/dev/null | grep -c "state UP")
if [ "$ap_status" -gt 0 ] || [ "$sta_status" -gt 0 ]; then
ledcontrol blue:wlan on
logger -t wifi-led "phy0 interface UP, blue LED ON"
else
ledcontrol blue:wlan off
logger -t wifi-led "No phy0 interface UP, blue LED OFF"
fi
fi
;;
remove)
if [ "$DEVICENAME" = "phy0" ]; then
ledcontrol blue:wlan off
logger -t wifi-led "phy0 removed, blue LED OFF"
fi
;;
esac