Skip to content

Commit

Permalink
refactor: cleanup button log before monitoring for presses
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed Jan 18, 2025
1 parent 457f5b1 commit 555e754
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ show_message() {
}

monitor_buttons() {
if [ -f "$BUTTON_LOG" ]; then
mv "$BUTTON_LOG" "$BUTTON_LOG.old"
fi
touch "$BUTTON_LOG"

chmod +x "$progdir/bin/evtest"
for dev in /dev/input/event*; do
[ -e "$dev" ] || continue
Expand Down Expand Up @@ -207,9 +212,6 @@ main_process() {
return 1
fi

if [ -f "$progdir/log/buttons.log" ]; then
mv "$progdir/log/buttons.log" "$progdir/log/buttons.log.old"
fi
show_message "Press B to exit"
monitor_buttons

Expand Down

0 comments on commit 555e754

Please sign in to comment.