raspberrypi: brownout detector uses now the /sys/class/leds interface

This commit is contained in:
Calin Crisan 2016-06-05 11:34:56 +03:00
parent 2c387df2ea
commit e75bd408d9

View File

@ -1,16 +1,12 @@
#!/bin/bash
gpio=35
check_interval=30
export=/sys/class/gpio/export
readv=/sys/class/gpio/gpio$gpio/value
readv=/sys/class/leds/led1/brightness
test -e "$readv" || exit 0
test -n "$os_version" || source /etc/init.d/base
configure() {
echo $gpio > $export
}
watch() {
while true; do
if [ "$(cat $readv)" == "0" ]; then
@ -23,9 +19,8 @@ watch() {
case "$1" in
start)
msg_begin "Starting brownout detector"
configure
test $? == 0 && msg_done || msg_fail
watch &
test $? == 0 && msg_done || msg_fail
;;
stop)