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"
# ── 3. REQUIRED HEADER LINKS ──────────────────────────────────────
mkdir -p "$F/streaming/header/h"
header_h="$F/streaming/header/h" # convenience variables
fmt_dir="$F/streaming/uncompressed/u"
# ----------------------------------------------------------------------
# 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
# ----------------------------------------------------------------------
mkdir -p "$header_h"
# 3a Link format #1 into the header *first*
for _ in {1..50}; do # max 50×2ms = 100ms
[ -e "$F/streaming/header/h/bmInfo" ] && break
sleep 0.02
# wait until the kernel has rebuilt the directory and added its attribute
# files (bmInfo is always created by the driver)
for _ in {1..50}; do
[ -e "$header_h/bmInfo" ] && break
sleep 0.010 # max 0.5s total
done
ln -sf ../../uncompressed/u "$F/streaming/header/h/1"
echo 1 >"$F/streaming/header/h/bNumFormats"
echo 0 >"$F/streaming/header/h/bmInfo"
# ABSOLUTE symlink → no relative elements, name is “fmt” (not “1”)
ln -sf "$fmt_dir" "$header_h/fmt"
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 _ in {1..20}; do
[ -d "$F/streaming/class/$s" ] && break
sleep 0.005
done
ln -sf ../../header/h "$F/streaming/class/$s/h"
mkdir -p "$F/streaming/class/$s"
ln -sf "$header_h" "$F/streaming/class/$s/h"
done
# 3c CONTROLside header uses the same directory
mkdir -p "$F/control/header/h"
# controlinterface header share the very same directory
mkdir -p "$F/control/header"
ln -sf "$header_h" "$F/control/header/h"
for s in fs hs ss; do
for _ in {1..20}; do
[ -d "$F/control/class/$s" ] && break || sleep 0.005
done
ln -sf ../../header/h "$F/control/class/$s/h"
mkdir -p "$F/control/class/$s"
ln -sf "$header_h" "$F/control/class/$s/h"
done
# Friendly string for the camera entity
# friendly label
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 -----------------------------
mkdir -p "$G/configs/c.1/strings/0x409"