This commit is contained in:
Brad Stein 2025-06-06 20:25:26 -05:00
parent 4926b8d169
commit dff41b63f3

View File

@ -1,9 +1,14 @@
#!/usr/bin/env bash
# Proven Pi-5 configfs gadget: HID keyboard+mouse + stereo UAC2
# Still need Web Cam Support
set -euo pipefail
echo "uboot_overlay_addr0=/boot/overlays/dwc2.dtbo" >> /boot/firmware/config.txt
modprobe dwc2
modprobe libcomposite || { echo "libcomposite not in kernel; abort" >&2; exit 1; }
mountpoint -q /sys/kernel/config || mount -t configfs configfs /sys/kernel/config
# mountpoint -q /sys/kernel/config || mount -t configfs configfs /sys/kernel/config
mountpoint -q /sys/kernel/config || mount -t configfs none /sys/kernel/config
G=/sys/kernel/config/usb_gadget/navka
if [[ -d $G ]]; then
@ -19,9 +24,9 @@ echo 0x0104 >"$G/idProduct" # Multifunction Composite Gadget
echo 0x0200 >"$G/bcdUSB"
mkdir -p "$G/strings/0x409"
echo "0001" >"$G/strings/0x409/serialnumber"
echo "Navka" >"$G/strings/0x409/manufacturer"
echo "Navka Composite" >"$G/strings/0x409/product"
echo "$(cat /proc/sys/kernel/random/uuid)" >"$G/strings/0x409/serialnumber"
echo "Navka" >"$G/strings/0x409/manufacturer"
echo "Navka Composite" >"$G/strings/0x409/product"
# HID (boot keyboard)
mkdir -p "$G/functions/hid.usb0"
@ -44,7 +49,11 @@ mkdir -p "$G/configs/c.1/strings/0x409"
echo "Config 1" >"$G/configs/c.1/strings/0x409/configuration"
echo 500 >"$G/configs/c.1/MaxPower"
mkdir -p "$G/configs/c.1" "$G/configs/c.1/strings/0x409"
echo "Keyboard" >"$G/configs/c.1/strings/0x409/configuration"
ln -s "$G/functions/hid.usb0" "$G/configs/c.1/"
ln -s "$G/functions/uac2.usb0" "$G/configs/c.1/"
echo "$(ls /sys/class/udc | head -n1)" >"$G/UDC"
echo '[navka-core] gadget ready'