fixing daemon for cam

This commit is contained in:
Brad Stein 2025-07-04 15:11:39 -05:00
parent a2d07ef1e5
commit b6aae91a52

View File

@ -132,51 +132,40 @@ echo 333333 >"$F/streaming/uncompressed/u/f1/dwDefaultFrameInterval" # 30fp
echo 333333 >"$F/streaming/uncompressed/u/f1/dwFrameInterval" echo 333333 >"$F/streaming/uncompressed/u/f1/dwFrameInterval"
# ── 3. REQUIRED HEADER LINKS ────────────────────────────────────── # ── 3. REQUIRED HEADER LINKS ──────────────────────────────────────
mkdir -p "$F/streaming/header/h" header_h="$F/streaming/header/h" # convenience variables
fmt_dir="$F/streaming/uncompressed/u"
# ---------------------------------------------------------------------- mkdir -p "$header_h"
# DEBUG / DEFENSIVE show what exists and create again if needed
# ----------------------------------------------------------------------
if ! [ -d "$F/streaming/header/h" ]; then
echo "→ header/h vanished recreating" >&2
mkdir -p "$F/streaming/header/h"
fi
echo "→ AFTER mkdir : $(ls -ld $F/streaming/header/h)" >&2
echo "→ PARENT header : $(ls -ld $F/streaming/header)" >&2
echo "→ CONTENTS : $(ls $F/streaming/header)" >&2
# ----------------------------------------------------------------------
# 3a Link format #1 into the header *first* # wait until the kernel has rebuilt the directory and added its attribute
for _ in {1..50}; do # max 50×2ms = 100ms # files (bmInfo is always created by the driver)
[ -e "$F/streaming/header/h/bmInfo" ] && break for _ in {1..50}; do
sleep 0.02 [ -e "$header_h/bmInfo" ] && break
sleep 0.010 # max 0.5s total
done done
ln -sf ../../uncompressed/u "$F/streaming/header/h/1" # ABSOLUTE symlink → no relative elements, name is “fmt” (not “1”)
echo 1 >"$F/streaming/header/h/bNumFormats" ln -sf "$fmt_dir" "$header_h/fmt"
echo 0 >"$F/streaming/header/h/bmInfo" echo 1 >"$header_h/bNumFormats"
echo 0 >"$header_h/bmInfo"
# 3b Wait for the kernel to create the class/{fs,hs,ss} dirs (≤100ms) # perspeed class directories (absolute links)
for s in fs hs ss; do for s in fs hs ss; do
for _ in {1..20}; do mkdir -p "$F/streaming/class/$s"
[ -d "$F/streaming/class/$s" ] && break ln -sf "$header_h" "$F/streaming/class/$s/h"
sleep 0.005
done
ln -sf ../../header/h "$F/streaming/class/$s/h"
done done
# 3c CONTROLside header uses the same directory # controlinterface header share the very same directory
mkdir -p "$F/control/header/h" mkdir -p "$F/control/header"
ln -sf "$header_h" "$F/control/header/h"
for s in fs hs ss; do for s in fs hs ss; do
for _ in {1..20}; do mkdir -p "$F/control/class/$s"
[ -d "$F/control/class/$s" ] && break || sleep 0.005 ln -sf "$header_h" "$F/control/class/$s/h"
done
ln -sf ../../header/h "$F/control/class/$s/h"
done done
# Friendly string for the camera entity # friendly label
mkdir -p "$F/control/header/strings/0x409" mkdir -p "$F/control/header/strings/0x409"
echo "Lesavka UVC" >"$F/control/header/strings/0x409/label" echo "LesavkaUVC" >"$F/control/header/strings/0x409/label"
# ----------------------- configuration ----------------------------- # ----------------------- configuration -----------------------------
mkdir -p "$G/configs/c.1/strings/0x409" mkdir -p "$G/configs/c.1/strings/0x409"