diff --git a/pwnagotchi/defaults.yml b/pwnagotchi/defaults.yml index 688b416..c047e18 100644 --- a/pwnagotchi/defaults.yml +++ b/pwnagotchi/defaults.yml @@ -106,8 +106,8 @@ main: enabled: false #The following is a list of the GPIO number for your button, and the command you want to run when it is pressed gpios: - - 20: 'sudo touch /root/.pwnagotchi-auto && sudo systemctl restart pwnagotchi' - - 21: 'shutdown -h now' + 20: 'touch /root/.pwnagotchi-auto && systemctl restart pwnagotchi' + 21: 'shutdown -h now' # monitor interface to use iface: mon0 # command to run to bring the mon interface up in case it's not up already diff --git a/pwnagotchi/plugins/default/gpio_buttons.py b/pwnagotchi/plugins/default/gpio_buttons.py index 7d9adb8..96a353f 100644 --- a/pwnagotchi/plugins/default/gpio_buttons.py +++ b/pwnagotchi/plugins/default/gpio_buttons.py @@ -31,9 +31,7 @@ class GPIOButtons(plugins.Plugin): # set gpio numbering GPIO.setmode(GPIO.BCM) - for i in gpios: - gpio = list(i)[0] - command = i[gpio] + for gpio, command in gpios.items(): self.ports[gpio] = command GPIO.setup(gpio, GPIO.IN, GPIO.PUD_UP) GPIO.add_event_detect(gpio, GPIO.FALLING, callback=self.runCommand, bouncetime=250)