Sometimes the best projects are the ones that are dead simple and just work.
Here’s a little build I put together:
The Raspberry Pi boots straight into two things:
Audio loop
mpv --loop /home/video/video/audio.wav &
Video loop (dual-pan, left/right)
pan=0.7
left="--video-pan-x=-$pan"
right="--video-pan-x=$pan"
loop="--loop-playlist"
dir="/home/video/video"
file="$dir/movie.mov"
mpv --ao=null $loop --\{ $right $file --\} --\{ $left $file --\} &
No desktop, no fluff. Just mpv doing its thing.
Before the badge can act as a shutdown button, it needs to be programmed so one of its keys actually sends the letter “S” over USB and glows to make it obvious.
⚠️ Important: Make sure you connect the badge with a proper USB-C data cable, not a charge-only cable. Otherwise, the serial connection and keystrokes will never show up.
screen, picocom, or minicom. Example:screen /dev/ttyUSB0 115200
S keystroke.S.Now the badge is not just decorative—it’s a shutdown button with built-in backlight feedback.
With the badge programmed, pressing the glowing red button triggers a clean shutdown thanks to this script:
#!/usr/bin/env bash
# shutdown_on_S.sh
DEV="${1:-/dev/input/event0}"
LOG="/home/video/shutdown_on_S.log"
# wait for device
while [ ! -e "$DEV" ]; do sleep 1; done
(evtest --grab "$DEV" 2>&1 || evtest "$DEV" 2>&1) | awk '
/EV_KEY/ && (/KEY_S/ || /\(S\)/) && /value 1/ {
system("sudo systemctl poweroff || sudo shutdown -h now");
exit 0
}'
And in crontab:
@reboot /home/video/shutdown_on_S.sh /dev/input/by-id/usb-MK_Factor_DEF_CON_29_Badge_12345-if02-event-kbd
@reboot /home/video/video.sh
This is one of those projects that makes you smile:
S → clean shutdown.Simple. Hackerish. Effective.