mirror of
https://github.com/femtofox/femtofox.git
synced 2026-11-25 01:16:33 -05:00
Expand button functionality
Short press now toggles wifi. LED will flash 3 times to show the command was received. - wifi will toggle within 30 seconds. 2 second press reboots. LED will turn on to show the command was received.
This commit is contained in:
parent
b9715b8585
commit
d01e497294
3 changed files with 11 additions and 13 deletions
|
|
@ -1,11 +1,11 @@
|
|||
[Unit]
|
||||
Description=Button Reboot Service
|
||||
Description=Button Service
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/buttonservice.sh
|
||||
ExecStart=/usr/local/bin/button.sh
|
||||
Restart=always
|
||||
User=femto
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
fi
|
||||
else
|
||||
echo "$duration second button press detected. Rebooting."
|
||||
echo 1 > /sys/class/gpio/gpio34/value;
|
||||
sudo reboot
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
logger "$(date): Listening for button press on $DEVICE..."
|
||||
|
||||
evtest --grab /dev/input/event0 | while read line; do
|
||||
if echo $line | grep -q "EV_KEY.*value 1"; then
|
||||
logger "Button pressed, triggering reboot..."
|
||||
sudo reboot
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue