base-files: gpio switch: set output value with direction
[openwrt/staging/jogo.git] / package / base-files / files / etc / init.d / gpio_switch
index 5a62be94ccbe76d17e5f1c8e852b200cded3c4ee..b67950a992c59bd85ac5052de392986adc29a85a 100755 (executable)
@@ -22,10 +22,9 @@ load_gpio_switch()
                echo "$gpio_pin" >/sys/class/gpio/export
                # we need to wait a bit until the GPIO appears
                [ -d "$gpio_path" ] || sleep 1
-               echo out >"$gpio_path/direction"
        }
-       # write 0 or 1 to the "value" field
-       { [ "$value" = "0" ] && echo "0" || echo "1"; } >"$gpio_path/value"
+       # set the pin to output with high or low pin value
+       { [ "$value" = "0" ] && echo "high" || echo "low"; } >"$gpio_path/direction"
 }
 
 service_triggers()