Skip to content

Instantly share code, notes, and snippets.

@hemna
Last active September 14, 2026 19:22
Show Gist options
  • Select an option

  • Save hemna/4afc8b6bfae6fb3de05119fda84afb73 to your computer and use it in GitHub Desktop.

Select an option

Save hemna/4afc8b6bfae6fb3de05119fda84afb73 to your computer and use it in GitHub Desktop.
direwatch Pi 5 debugging commands
#!/bin/sh
# Clean direwatch Pi 5 diagnostic run.
set -u
echo '=== stop existing direwatch processes ==='
pids=$(pgrep -f '[d]irewatch-pi5.py' || true)
if [ -n "$pids" ]; then
echo "$pids"
kill $pids || true
sleep 2
fi
rm -f /tmp/direwatch-pi5.out /tmp/direwatch-pi5-diagnostics.txt
echo '=== start one direwatch process in background ==='
nohup ./direwatch-pi5.py -l /run/direwolf.log -d dsi \
> /tmp/direwatch-pi5.out 2>&1 &
pid=$!
echo "direwatch pid=$pid"
sleep 3
echo '=== collect bounded diagnostics ==='
{
echo '=== process check ==='
pgrep -af '[d]irewatch-pi5.py' || true
echo '=== direwatch output ==='
cat /tmp/direwatch-pi5.out
echo '=== pykms ==='
python3 -c 'import pykms; print(pykms.__file__); print([x for x in dir(pykms.PixelFormat) if "RGB" in x or "NV" in x])'
echo '=== DRM output, last 80 lines ==='
modetest -M vc4 -p 2>&1 | tail -n 80
echo '=== system ==='
uname -a
cat /proc/device-tree/model
} > /tmp/direwatch-pi5-diagnostics.txt 2>&1
echo '=== upload diagnostic file ==='
echo 'The returned paste URL is public; send it back for analysis.'
python3 -c 'import json; print(json.dumps({"language":"text", "code":open("/tmp/direwatch-pi5-diagnostics.txt").read()}))' \
| curl --fail --silent --show-error \
-H 'Content-Type: application/json' \
--data-binary @- \
'https://paste.openstack.org/json/?method=pastes.newPaste'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment