Skip to content

Instantly share code, notes, and snippets.

View brian4342's full-sized avatar

Brian Peach brian4342

View GitHub Profile
#!/usr/bin/env bash
# Raspberry Pi Zero USB Webcam Gadget
# Creates a UVC USB gadget with YUYV + MJPEG modes and starts uvc-gadget.
# Tested with Raspberry Pi OS (Legacy / Bullseye). Should also work on Bookworm with /boot/firmware layout.
set -euo pipefail
# -------- Settings you may tweak --------
GADGET_NAME="pi-webcam"
VID="0x1d6b" # Linux Foundation (for testing). Vendors use their own IDs.
PID="0x0104" # Generic composite gadget PID (testing)