The following custom init script is executed by the kernel on i.mx8mm processor using yocto zeus.
The issue is after loading the necessary kernel modules and mounting the required file system. Camera detection by the uvcvideo is after 2-3 seconds then camera opens. I want to open camera immediately when this script runs. Any idea what's going on in this scenario?
Attached are the logs cameraopening.txt
#!/bin/sh
# Load the necessary kernel modules for the camera
modprobe videobuf2-v4l2
modprobe videodev
modprobe uvcvideo
# Mount the Linux kernel virtual filesystems
mount none -t proc /proc
# Ensure devtmpfs is mounted, it must be done manually with initramfs
# Setup PTY infrastructure
mkdir /dev/pts
mount none -t devpts /dev/pts
# Set any necessary environment variables
export DISPLAY=:0.0
mkdir -p /run/user/$(id -u)
XDG_RUNTIME_DIR=/run/user/$(id -u)
export XDG_RUNTIME_DIR
while true; do
echo "--------------------camera is starting------------------------------------"
./sbin/uvc_stream -o test.avi
v4l2-ctl --list-devices
# Get the exit status of the pipeline
status=$?
# If the pipeline exited with an error, log a message and wait a few seconds before restarting it
if [[ $status != 0 ]]; then
sleep 0.00001
fi
done
iMX8MMINI iMX8M