mirror of
https://github.com/riptidewave93/UNVR-NAS.git
synced 2025-02-12 10:31:55 +00:00
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:
parent
5962f1ea30
commit
58ce1fb99f
10 changed files with 35 additions and 32 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
|
@ -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
|
||||
|
|
|
@ -55,7 +55,7 @@ mv ./modules-dir ${build_path}/kernel/kernel-modules
|
|||
|
||||
# Now that the kernel is done, build our out of tree modules! :)
|
||||
module_builddir=$(mktemp -d)
|
||||
cp ${root_path}/tools/mtd-lock/* "${module_builddir}"
|
||||
cp ${root_path}/tools/ubnt-mtd-lock/* "${module_builddir}"
|
||||
cd "${module_builddir}"
|
||||
make -C ${kernel_builddir}/${kernel_filename%.tar.gz} M=$PWD
|
||||
cp "${module_builddir}/ubnt-mtd-lock.ko" ${build_path}/kernel
|
||||
|
|
|
@ -70,8 +70,7 @@ else
|
|||
"${build_path}/rootfs/usr/bin/ubnt-systool" \
|
||||
"${build_path}/rootfs/usr/bin/ubnt-tools" \
|
||||
"${build_path}/rootfs/usr/bin/ustorage" \
|
||||
"${build_path}/rootfs/usr/lib/init/boot/ubnt-ulcmd.sh" \
|
||||
"${build_path}/rootfs/usr/lib/python3/dist-packages/ubnthelpers.py"
|
||||
"${build_path}/rootfs/usr/lib/init/boot/ubnt-ulcmd.sh"
|
||||
fi
|
||||
|
||||
# Copy over bluetooth firmware files
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# mtd-lock
|
||||
# ubnt-mtd-lock
|
||||
|
||||
A stupid basic kernel module to ensure we set /dev/mtd as RO (fully) in our firmware. This is done to prevent users/bad actors from wiping your bootloader/Unifi EEPROM, which are required for your device to function!
|
||||
A stupid basic kernel module to ensure we set /dev/mtd* as RO (fully) in our firmware. This is done to prevent users/bad actors from wiping your bootloader/Unifi EEPROM, which are required for your device to function!
|
||||
|
||||
## Building
|
||||
|
|
@ -15,27 +15,30 @@ import (
|
|||
|
||||
// Type for device map
|
||||
type UBNTSysMap struct {
|
||||
name, shortname, cpu, sysid string
|
||||
name, shortname, sysshortname, cpu, sysid string
|
||||
}
|
||||
|
||||
var UBNTDeviceMap = []UBNTSysMap{
|
||||
{
|
||||
name: "Unifi-NVR-PRO",
|
||||
shortname: "UNVRPRO",
|
||||
cpu: "AL324V2",
|
||||
sysid: "ea20",
|
||||
name: "UniFi Network Video Recorder Pro",
|
||||
shortname: "UNVRPRO",
|
||||
sysshortname: "UNVRPRO",
|
||||
cpu: "AL324V2",
|
||||
sysid: "ea20",
|
||||
},
|
||||
{
|
||||
name: "UniFi-NVR-4",
|
||||
shortname: "UNVR4",
|
||||
cpu: "AL324V2",
|
||||
sysid: "ea16", // USB drive (non emmc) variant
|
||||
name: "UniFi Network Video Recorder",
|
||||
shortname: "UNVR",
|
||||
sysshortname: "UNVR4",
|
||||
cpu: "AL324V2",
|
||||
sysid: "ea16", // USB drive (non emmc) variant
|
||||
},
|
||||
{
|
||||
name: "UniFi-NVR-4",
|
||||
shortname: "UNVR4",
|
||||
cpu: "AL324V2",
|
||||
sysid: "ea1a",
|
||||
name: "UniFi Network Video Recorder",
|
||||
shortname: "UNVR",
|
||||
sysshortname: "UNVR4",
|
||||
cpu: "AL324V2",
|
||||
sysid: "ea1a",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -411,7 +414,7 @@ func return_values(rtype string, file string, filter string) {
|
|||
} else if rtype == "system" {
|
||||
okeys = UBNT_SystemInfo_Vars
|
||||
ret_data = append(ret_data, UBNT_Return_Values{name: "cpu", value: ourboard.cpu})
|
||||
ret_data = append(ret_data, UBNT_Return_Values{name: "shortname", value: ourboard.shortname})
|
||||
ret_data = append(ret_data, UBNT_Return_Values{name: "shortname", value: ourboard.sysshortname})
|
||||
} else if rtype == "tools" {
|
||||
okeys = UBNT_Tools_vars
|
||||
ret_data = append(ret_data, UBNT_Return_Values{name: "board.name", value: ourboard.name})
|
||||
|
|
Loading…
Reference in a new issue