#!/usr/bin/env bash # One-click camera fix: starts Claude Code in this folder with a prompt that # diagnoses and fixes the built-in Intel IPU6 camera using CAMERA-GUIDE.md. # Claude Code asks before it runs commands or edits files, and hands anything # that needs root back to you. # # ./fix-camera.sh from a terminal, or double-click it in a file manager set -euo pipefail SELF=$(readlink -f "$0") cd "$(dirname "$SELF")" PROMPT='The built-in camera on this Fedora laptop does not work properly. Use CAMERA-GUIDE.md in this folder to diagnose and fix it: 1. Run the checks in "Does this apply to you" and tell me what you find before changing anything. 2. Open the camera with a short PipeWire test capture and read the WirePlumber log. If libcamera picks the NVIDIA EGL driver and logs "debayerGPU failed", apply Fix 1 and confirm that frames arrive. 3. Check the rotation PipeWire reports. If the picture is upside down and this kernel'"'"'s ipu-bridge does not list my model, prepare Fix 2 from the files in this folder. Adapt install.sh and ipu-bridge/ipu-bridge.c if this is not a Dell XPS 16 DA16250. Build it, then give me the sudo command to run; do not install anything as root yourself. 4. Tell me which browser setting I need and which camera app to use. At the end, list every change you made and how to undo each one.' spawned=false [ "${1:-}" = --spawned ] && spawned=true pause() { if $spawned; then read -rp "Press Enter to close this window. " _ || true; fi; } die() { echo "fix-camera: $*" >&2; pause; exit 1; } # Double-clicked in a file manager: no terminal, so reopen in one. if ! [ -t 0 ] || ! [ -t 1 ]; then $spawned && exit 1 # the terminal we opened has no tty either; don't loop if command -v xdg-terminal-exec >/dev/null; then exec xdg-terminal-exec "$SELF" --spawned elif command -v konsole >/dev/null; then exec konsole -e "$SELF" --spawned elif command -v ptyxis >/dev/null; then exec ptyxis -- "$SELF" --spawned elif command -v gnome-terminal >/dev/null; then exec gnome-terminal -- "$SELF" --spawned elif command -v xfce4-terminal >/dev/null; then exec xfce4-terminal -x "$SELF" --spawned elif command -v xterm >/dev/null; then exec xterm -e "$SELF" --spawned fi command -v notify-send >/dev/null && notify-send "fix-camera" "No terminal app found. Run $SELF from a terminal." exit 1 fi [ -f CAMERA-GUIDE.md ] || die "CAMERA-GUIDE.md is missing; keep this script in the same folder as the guide" command -v claude >/dev/null || die "Claude Code is not installed. Install it with: curl -fsSL https://claude.ai/install.sh | bash then open a new terminal and run this script again." cat <