Created
July 11, 2024 16:47
-
-
Save themactep/6311b18793679e976a44f92ef9fa7c41 to your computer and use it in GitHub Desktop.
Detect changes in input GPIO.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# IPC button catcher | |
# Paul Philippov <[email protected]> | |
# 2024-07-01: Initial release | |
GPIO_MAX=95 | |
EXCLUDE="10 16 17 18 49 54 55 56 57 58" | |
for i in $(seq 0 $GPIO_MAX); do | |
echo $EXCLUDE | grep -e "\b$i\b" >/dev/null && continue | |
echo gpio input $i | |
done | |
gpio list > /tmp/old | |
while :; do | |
gpio list > /tmp/new | |
diff /tmp/old /tmp/new | |
sleep 1 | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment