Files
root-virtualcam/post-fs-data.sh
T
jory 0e399ce02f Fix stallDurations metadata buffer, add web=true, rebuild provider
- Increase camera metadata buffer from 2048 to 4096 bytes to prevent
  silent truncation of stallDurations (required by Android 16)
- Add web=true to module.prop for KernelSU WebUI detection
- Rebuilt virtual_camera_provider with buffer fix
- Updated WebUI JS with improved status display
- Bump version to 3.1
2026-05-14 20:23:36 +02:00

53 lines
2.1 KiB
Bash
Executable File

#!/system/bin/sh
MODDIR=${0%/*}
exec >> "$MODDIR/boot.log" 2>&1
echo "[$(date)] post-fs-data starting"
# Stop the stock Google camera HAL so it doesn't re-register its cameras.
# This is an APEX-managed service that auto-restarts, so we need to keep it down.
setprop ctl.stop vendor.camera-provider-2-7-google 2>/dev/null || true
kill -9 $(pgrep -f camera-provider-2-7-google) 2>/dev/null || true
# Reload v4l2loopback (rmmod first to clear stale params like exclusive_caps)
rmmod v4l2loopback 2>/dev/null || true
sleep 1
insmod "$MODDIR/v4l2loopback.ko" devices=2 video_nr=0,1 card_label="VirtualCam" 2>/dev/null || true
# Copy provider binary and AIDL libs
PROVIDER_DST="/data/local/tmp/virtual_camera_provider"
LIB_DST="/data/local/tmp/virtualcam_libs"
cp "$MODDIR/vendor/bin/virtual_camera_provider" "$PROVIDER_DST" 2>/dev/null || true
chmod 755 "$PROVIDER_DST" 2>/dev/null || true
mkdir -p "$LIB_DST" 2>/dev/null || true
cp "$MODDIR/vendor/lib64"/*.so "$LIB_DST/" 2>/dev/null || true
# Start our provider
if [ -x "$PROVIDER_DST" ]; then
nohup env LD_LIBRARY_PATH="$LIB_DST" "$PROVIDER_DST" \
-d /dev/video0 -w 1920 -h 1080 -i virtual \
</dev/null >/dev/null 2>&1 &
echo "[$(date)] provider started"
fi
# Fork a background watchdog to keep the stock HAL dead
(
while sleep 30; do
# Re-kill stock HAL if it came back
if pgrep -f camera-provider-2-7-google >/dev/null 2>&1; then
setprop ctl.stop vendor.camera-provider-2-7-google 2>/dev/null || true
kill -9 $(pgrep -f camera-provider-2-7-google) 2>/dev/null || true
echo "[$(date)] re-killed stock HAL"
fi
# Restart our provider if it died
if ! pgrep -f virtual_camera_provider >/dev/null 2>&1; then
if [ -x "$PROVIDER_DST" ]; then
nohup env LD_LIBRARY_PATH="$LIB_DST" "$PROVIDER_DST" \
-d /dev/video0 -w 1920 -h 1080 -i virtual \
</dev/null >/dev/null 2>&1 &
echo "[$(date)] provider restarted"
fi
fi
done
) &
echo "[$(date)] post-fs-data done"