fix: additional fixups for UNVR/UNVRPro

* Fixup fan control so it works on UNVR
* Add LED integration work for UNVR
* Rename our mtd-ro kernel module dir
* Fixup shortnames in ubnteeprom
This commit is contained in:
Chris Blake 2024-06-18 19:13:31 -05:00
parent 5962f1ea30
commit 58ce1fb99f
10 changed files with 35 additions and 32 deletions

View file

@ -3,7 +3,7 @@ import os
import re
import time
from ubnthelpers import get_ubnt_shortname
from functools import lru_cache
SMARTCTL_PATH = "/usr/sbin/smartctl"
@ -36,6 +36,12 @@ THERMAL_SYS_PATHS = {
},
}
@lru_cache(None)
def get_ubnt_shortname() -> str:
return os.popen("ubnteeprom -systeminfo -key shortname").read().rstrip("\n")
def __get_board_temps():
# Are we supported?
if get_ubnt_shortname() not in THERMAL_SYS_PATHS:

View file

@ -16,7 +16,8 @@ case "$(ubnteeprom -systeminfo -key shortname)" in
exec ulcmd
;;
"UNVR4")
# TODO: LED setup (2=white, 1=blue) against /sys/class/leds/ulogo_ctrl
# 2=white, 1=blue, 0=off, needs a value set with :x for ms
echo 1:500 > /sys/class/leds/ulogo_ctrl/pattern
# Start our "daemon" loop so systemd stays happy
while true; do
sleep 3600

View file

@ -1,11 +0,0 @@
#!/usr/bin/python3
import os
from functools import lru_cache
"""
A handful of Ubiquiti Unifi device specific functions
"""
@lru_cache(None)
def get_ubnt_shortname() -> str:
return os.popen("ubnteeprom -systeminfo -key shortname").read().rstrip("\n")

View file

@ -36,3 +36,8 @@ elif [ -f "/sys/class/hwmon/hwmon0/pwm1" ]; then
echo 0 > "${pwm}"
done
fi
# If UNVR, turn off LED
if [ -f "/sys/class/leds/ulogo_ctrl/pattern" ]; then
echo 0:500 > /sys/class/leds/ulogo_ctrl/pattern
fi