mirror of
https://github.com/riptidewave93/UNVR-NAS.git
synced 2025-02-12 10:31:55 +00:00
fix: update to 4.0.6 and improved unvr support
* We should hopefully have working fans for the UNVR4 now * Update to latest pre-release unifi firmware 4.0.6 * Improve hwmon logic in our scripts
This commit is contained in:
parent
76c17952a7
commit
5962f1ea30
5 changed files with 59 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
[Unit]
|
||||
Description=Fan Controller daemon for the UNVR Pro
|
||||
Description=Fan Controller daemon for the UNVR/UNVRPRO
|
||||
Requires=ubnt-init.service
|
||||
|
||||
[Service]
|
||||
|
|
|
@ -21,9 +21,21 @@ THERMAL_SYS_PATHS = {
|
|||
"/sys/class/hwmon/hwmon0/device/pwm3",
|
||||
],
|
||||
},
|
||||
"UNVR4": {
|
||||
"thermal": [
|
||||
"/sys/devices/virtual/thermal/thermal_zone0/temp",
|
||||
"/sys/class/hwmon/hwmon0/device/temp1_input",
|
||||
"/sys/class/hwmon/hwmon0/device/temp2_input",
|
||||
"/sys/class/hwmon/hwmon0/device/temp3_input",
|
||||
],
|
||||
"fan_pwms": [
|
||||
"/sys/class/hwmon/hwmon0/device/pwm1",
|
||||
"/sys/class/hwmon/hwmon0/device/pwm2",
|
||||
"/sys/class/hwmon/hwmon0/device/pwm3",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def __get_board_temps():
|
||||
# Are we supported?
|
||||
if get_ubnt_shortname() not in THERMAL_SYS_PATHS:
|
||||
|
@ -37,8 +49,16 @@ def __get_board_temps():
|
|||
with open(path, "r") as f:
|
||||
board_temps.append(int(f.readline().rstrip("\n")))
|
||||
except FileNotFoundError:
|
||||
print(f"Warning: Unable to open {path}; ignoring and continuing...")
|
||||
continue
|
||||
# If we are here, either it doesn't exist, OR, we need to change paths from
|
||||
# /sys/class/hwmon/hwmon0/device/temp*_input to /sys/class/hwmon/hwmon0/temp*_input
|
||||
# since there could be a different thermal sensor/controller being used on the board
|
||||
try:
|
||||
with open(path.replace('/device',''), "r") as f:
|
||||
board_temps.append(int(f.readline().rstrip("\n")))
|
||||
except FileNotFoundError:
|
||||
print(f"Warning: Unable to open {path}; ignoring and continuing...")
|
||||
continue
|
||||
|
||||
|
||||
# Did we get ANY temps?!?
|
||||
if len(board_temps) == 0:
|
||||
|
@ -100,10 +120,17 @@ def __set_fan_speed(speed: int):
|
|||
with open(fan, "w") as f:
|
||||
f.write(str(speed))
|
||||
except FileNotFoundError:
|
||||
print(
|
||||
f"Error: Unable to write to PWM at {fan}! Why can't we set fan speed!?"
|
||||
)
|
||||
raise
|
||||
# If we are here, either it doesn't exist, OR, we need to change paths from
|
||||
# /sys/class/hwmon/hwmon0/device/pwm* to /sys/class/hwmon/hwmon0/pwm* since
|
||||
# there could be a different thermal sensor/controller being used on the board
|
||||
try:
|
||||
with open(fan.replace('/device',''), "w") as f:
|
||||
f.write(str(speed))
|
||||
except FileNotFoundError:
|
||||
print(
|
||||
f"Error: Unable to write to PWM at {fan}! Why can't we set fan speed!?"
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def __write_out_temp(temp: int, path: str = "/tmp/.unvr_temp"):
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# turn off fans for shutdown
|
||||
if [ -d "/sys/class/hwmon/hwmon0/device" ]; then
|
||||
for pwm in `ls /sys/class/hwmon/hwmon0/device/pwm[0-6]`; do
|
||||
echo 0 > ${pwm}
|
||||
done
|
||||
fi
|
||||
|
||||
# Ensure all mounts in /srv from OMV are cleaned up
|
||||
for dir in `ls /srv | grep dev-disk`; do
|
||||
umount -q /srv/${dir};
|
||||
done
|
||||
|
||||
# Give it a sec...
|
||||
sleep 1
|
||||
|
||||
# Now for all disks, delete from bus
|
||||
for dsk in sd{a..z}; do
|
||||
if [ -d "/sys/block/${dsk}/device" ]; then
|
||||
|
@ -25,5 +21,18 @@ if [ -d "/sys/bus/platform/drivers/ui-hdd-pwrctl-v2" ]; then
|
|||
echo ${bay} > "$(realpath /sys/bus/platform/drivers/ui-hdd-pwrctl-v2/*hdd_pwrctl-v2)/hdd_force_poweroff"
|
||||
done
|
||||
fi
|
||||
|
||||
# Let the disks spool down a sec...
|
||||
sleep 2
|
||||
|
||||
# turn off fans for shutdown
|
||||
if [ -d "/sys/class/hwmon/hwmon0/device" ]; then
|
||||
for pwm in `ls /sys/class/hwmon/hwmon0/device/pwm[0-6]`; do
|
||||
echo 0 > "${pwm}"
|
||||
done
|
||||
elif [ -f "/sys/class/hwmon/hwmon0/pwm1" ]; then
|
||||
# Different hwmon devices may have this path instead
|
||||
for pwm in `ls /sys/class/hwmon/hwmon0/pwm[0-6]`; do
|
||||
echo 0 > "${pwm}"
|
||||
done
|
||||
fi
|
||||
|
|
|
@ -7,10 +7,10 @@ build_path="${root_path}/BuildEnv"
|
|||
docker_tag=unvr-nas:builder
|
||||
|
||||
# Expected UNVR Firmware(s) and hash(s)
|
||||
UNVR_firmware_filename="7f7c-UNVR-4.0.5-1d4b9c7d-926b-4ef4-88c6-23978c2455a8.bin"
|
||||
UNVR_firmware_md5="3bab9336619125e7fe6e4af7484a79dc"
|
||||
UNVRPRO_firmware_filename="b0a3-UNVRPRO-4.0.5-f221e29e-3405-4cb9-8d13-0f117d9cc3a1.bin"
|
||||
UNVRPRO_firmware_md5="f6aec555fa79c4e083168ec2aac4a71a"
|
||||
UNVR_firmware_filename="62f6-UNVR-4.0.6-19610d35-cd43-4844-ae5e-5420d6ff6279.bin"
|
||||
UNVR_firmware_md5="dc2e1693fe44aae8437f8ebcd8f0c6c1"
|
||||
UNVRPRO_firmware_filename="19bf-UNVRPRO-4.0.6-6dd303cb-cb6d-4904-a8ee-ef6e5353016d.bin"
|
||||
UNVRPRO_firmware_md5="84476cd12b90ab8c5344d4ff66211b1b"
|
||||
|
||||
# Render our board out
|
||||
fwfnvar="${BOARD}_firmware_filename"
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
Please place the UNVR/UNVR Pro firmware in this directory.
|
||||
|
||||
* UNVR:
|
||||
* Name: [7f7c-UNVR-4.0.5-1d4b9c7d-926b-4ef4-88c6-23978c2455a8.bin](https://community.ui.com/releases/UniFi-OS-Network-Video-Recorders-4-0-5/7c734ca2-72e2-4747-96a0-e3a376cf96aa)
|
||||
* MD5Sum: 3bab9336619125e7fe6e4af7484a79dc
|
||||
* Name: [62f6-UNVR-4.0.6-19610d35-cd43-4844-ae5e-5420d6ff6279.bin](https://community.ui.com/releases/UniFi-OS-Network-Video-Recorders-4-0-6/336c3537-cc1c-4049-891d-7d1bd205defd)
|
||||
* MD5Sum: dc2e1693fe44aae8437f8ebcd8f0c6c1
|
||||
|
||||
|
||||
* UNVR Pro:
|
||||
* Name: [b0a3-UNVRPRO-4.0.5-f221e29e-3405-4cb9-8d13-0f117d9cc3a1.bin](https://community.ui.com/releases/UniFi-OS-Network-Video-Recorders-4-0-5/7c734ca2-72e2-4747-96a0-e3a376cf96aa)
|
||||
* MD5Sum: f6aec555fa79c4e083168ec2aac4a71a
|
||||
* Name: [19bf-UNVRPRO-4.0.6-6dd303cb-cb6d-4904-a8ee-ef6e5353016d.bin](https://community.ui.com/releases/UniFi-OS-Network-Video-Recorders-4-0-6/336c3537-cc1c-4049-891d-7d1bd205defd)
|
||||
* MD5Sum: 84476cd12b90ab8c5344d4ff66211b1b
|
||||
|
|
Loading…
Reference in a new issue