diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service index 4f91a0c..c285e3d 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/lib/systemd/system/button.service @@ -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 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/button.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/button.sh new file mode 100644 index 0000000..efb817b --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/button.sh @@ -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 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/buttonservice.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/buttonservice.sh deleted file mode 100755 index d0d5d81..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/buttonservice.sh +++ /dev/null @@ -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