Compare commits
No commits in common. "139a79c36b2362dd5bc730427399f0394d7c30a6" and "95c593c9eba08fb3eaa8f826317a295b7f497bc1" have entirely different histories.
139a79c36b
...
95c593c9eb
|
@ -42,10 +42,9 @@ in {
|
|||
${pkgs.bash}/bin/bash -c "/etc/nixos/scripts/SATA-hat.sh off"
|
||||
'';
|
||||
};
|
||||
before = [ "zfs-import.target" "zfs-import-vault.service" "umount.target" ];
|
||||
before = [ "zfs-import.target" "zfs-import-vault.service" ];
|
||||
requires = [ "systemd-udev-settle.service" ];
|
||||
after = [ "systemd-udev-settle.service" ];
|
||||
conflicts = [ "umount.target" ];
|
||||
};
|
||||
|
||||
# HACK: restart services dependent on ZFS afer mount
|
||||
|
|
|
@ -1,36 +1,32 @@
|
|||
#!/bin/sh
|
||||
|
||||
BASE_PATH=/sys/class
|
||||
GPIO_PATH="$BASE_PATH"/gpio
|
||||
PWM_PATH="$BASE_PATH"/pwm
|
||||
BASE_PATH=/sys/class/gpio
|
||||
|
||||
# GPIO pins
|
||||
SATA0=26
|
||||
SATA1=25
|
||||
# PWM pins
|
||||
CPU_FAN=12
|
||||
HDD_FAN=13
|
||||
|
||||
# Values
|
||||
LOW=0
|
||||
HIGH=1
|
||||
|
||||
export_pin() {
|
||||
if [ ! -e $GPIO_PATH/gpio"$1" ]; then
|
||||
echo "$1" >$GPIO_PATH/export
|
||||
if [ ! -e $BASE_PATH/gpio"$1" ]; then
|
||||
echo "$1" >$BASE_PATH/export
|
||||
fi
|
||||
}
|
||||
|
||||
unexport_pin() {
|
||||
if [ -e $GPIO_PATH/gpio"$1" ]; then
|
||||
echo "$1" >$GPIO_PATH/unexport
|
||||
if [ -e $BASE_PATH/gpio"$1" ]; then
|
||||
echo "$1" >$BASE_PATH/unexport
|
||||
fi
|
||||
}
|
||||
|
||||
set_mode() {
|
||||
export_pin "$1"
|
||||
echo "out" >$GPIO_PATH/gpio"$1"/direction
|
||||
echo "$2" >$GPIO_PATH/gpio"$1"/value
|
||||
echo "out" >$BASE_PATH/gpio"$1"/direction
|
||||
echo "$2" >$BASE_PATH/gpio"$1"/value
|
||||
if [ "$3" = "clean" ]; then
|
||||
unexport_pin "$1"
|
||||
fi
|
||||
|
@ -40,7 +36,7 @@ turn_on() {
|
|||
set_mode $SATA0 $HIGH
|
||||
sleep 1
|
||||
set_mode $SATA1 $HIGH
|
||||
set_mode $CPU_FAN $HIGH
|
||||
set_mode $CPU_FAN $LOW
|
||||
}
|
||||
|
||||
turn_off() {
|
||||
|
|
Loading…
Reference in New Issue