From: Alyssa Rosenzweig Date: Mon, 25 Jun 2018 19:23:09 +0000 (-0400) Subject: GPIO export dance X-Git-Url: https://vcs.fsf.org/?p=libremanage.git;a=commitdiff_plain;h=282c96f8e59384e7d5bcfc8011d4b49275d27bab GPIO export dance --- diff --git a/config.json b/config.json index ea700ae..9f3e0bd 100644 --- a/config.json +++ b/config.json @@ -7,7 +7,7 @@ "baud": 115200 }, "power": { - "pin": 1, + "pin": 60, "invert": true } } diff --git a/libremanage.py b/libremanage.py index e0f23a0..49c5658 100644 --- a/libremanage.py +++ b/libremanage.py @@ -68,7 +68,11 @@ def set_server_power(state, server): state = 1 - state print(conf["pin"]) - open_ssh(server, "echo " + str(state) + " > /dev/shm/power") + + # Export pin, write value, unexport + open_ssh(server, "echo " + str(conf["pin"]) + " > /sys/class/gpio/export") + open_ssh(server, "cat /sys/class/gpio/gpio" + str(conf["pin"]) + "/value") + open_ssh(server, "echo " + str(conf["pin"]) + " > /sys/class/gpio/unexport") COMMANDS = { # Power managemment