Posted: Fri May 14, 2021 23:55 Post subject: Run script when gpio line changes (Archer c7 v2)
Hello,
The Archer c7 router has a switch in the back for turning radio on/off. I want to run a script when the switch is turned on or off. I have confirmed it is mapped to gpio 23.
Evidently it is not considered an "SES button", since creating a script with .sesbutton extension did not run.
So is there a different way to set up the execution of a script when a gpio line changes? I thought about repeatedly using "gpio poll 23" every second in a startup script but the command does not seem to return and requires ^C to exit so this didn't work.
Thanks for your help!
Yanko
Posted: Sun May 16, 2021 14:50 Post subject: Figured out a solution
I found a way to do it. Use the /proc/gpio system, instead of the gpio command. For example, use
cat /proc/gpio/23_in
to get current status and put this in a loop to periodically check the status of the button.