Skip to content

Instantly share code, notes, and snippets.

@themactep
Created July 11, 2024 16:47
Show Gist options
  • Save themactep/6311b18793679e976a44f92ef9fa7c41 to your computer and use it in GitHub Desktop.
Save themactep/6311b18793679e976a44f92ef9fa7c41 to your computer and use it in GitHub Desktop.
Detect changes in input GPIO.
#!/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