[bootlin/training-materials updates] master: Boot time labs: wait for /dev/video0 from the start (8b853308)
Michael Opdenacker
michael.opdenacker at bootlin.com
Fri Apr 29 15:04:50 CEST 2022
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/8b853308b53dfc630d8f86ef7ac151d9d67730bd
>---------------------------------------------------------------
commit 8b853308b53dfc630d8f86ef7ac151d9d67730bd
Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date: Fri Apr 15 18:29:01 2022 +0200
Boot time labs: wait for /dev/video0 from the start
With the new setup (kernel?), the video device is ready
after ffmpeg is started. So, let's wait for /dev/video0
from the start, before starting ffmpeg
Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>
>---------------------------------------------------------------
8b853308b53dfc630d8f86ef7ac151d9d67730bd
lab-data/boot-time/rootfs/data/S50playvideo | 8 +++++
.../boot-time-application.tex | 37 ++--------------------
2 files changed, 10 insertions(+), 35 deletions(-)
diff --git a/lab-data/boot-time/rootfs/data/S50playvideo b/lab-data/boot-time/rootfs/data/S50playvideo
index 2b165255..5fb96155 100755
--- a/lab-data/boot-time/rootfs/data/S50playvideo
+++ b/lab-data/boot-time/rootfs/data/S50playvideo
@@ -1,6 +1,14 @@
#!/bin/sh
case "$1" in
start|"")
+ if ! [ -e /dev/video0 ]
+ then
+ echo "Waiting for /dev/video0 to be ready..."
+ while ! [ -e /dev/video0 ]
+ do
+ usleep 1000
+ done
+ fi
ffmpeg -t 10 -f video4linux2 -video_size 544x288 -input_format mjpeg -i /dev/video0 -pix_fmt rgb565le -f fbdev /dev/fb0
;;
stop)
diff --git a/labs/boot-time-application/boot-time-application.tex b/labs/boot-time-application/boot-time-application.tex
index 1e4f8aee..c70d4394 100644
--- a/labs/boot-time-application/boot-time-application.tex
+++ b/labs/boot-time-application/boot-time-application.tex
@@ -228,41 +228,8 @@ make clean
make
\end{verbatim}
-Update your root filesystem and then reboot.
-
-According to our tests, there should be an issue now: the video player
-is started even before the camera is ready, as you can see in the system
-console.
-
-To address this issue for the time being, let's modify \code{/etc/init.d/S50playvideo}
-by adding a loop waiting for the \code{/dev/video0} device to appear.
-So, let's add the following lines to
-\code{board/beaglecam/rootfs-overlay/etc/init.d/S50playvideo},
-before the call to \code{echo "Starting ffmpeg"}:
-
-\begin{verbatim}
-if ! [ -e /dev/video0 ]
-then
- echo "Waiting for /dev/video0 to be ready..."
- while ! [ -e /dev/video0 ]
- do
- usleep 1000
- done
-fi
-\end{verbatim}
-
-Notes:
-\begin{itemize}
-\item It seems you can not run an empty \code{while} loop with BusyBox
- \code{sh}. That's why I had to put a real command (not a comment)
- inside the loop.
-\item When we optimize the kernel, we will try to address this camera
- readiness issue. If we can't fix it, at least we will display
- something on the screen to make the user wait.
-\end{itemize}
-
-Update and reboot your system through \code{grabserial}, copying the
-output to \code{~/logs/application.log}.
+Update your root filesystem and then reboot your system through \code{grabserial},
+copying the output to \code{~/logs/application.log}.
Fill the below table with updated figures:
\begin{tabular}{| l | l | r |}
More information about the training-materials-updates
mailing list