uvc-gadget.sh: add mjpeg master
authorPaul Elder <paul.elder@ideasonboard.com>
Wed, 1 May 2019 20:37:19 +0000 (16:37 -0400)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 2 May 2019 09:09:24 +0000 (12:09 +0300)
Add MJPEG configfs setup to uvc-gadget.sh. In order to get it to work, I
had to add another two parameters to create_frame() to specify the
format (uncompressed vs mjpeg) and to specify the format descriptor
name.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
scripts/uvc-gadget.sh

index daf85c2..8e4b6d5 100755 (executable)
@@ -87,13 +87,15 @@ delete_msd() {
 
 create_frame() {
        # Example usage:
-       # create_frame <function name> <width> <height>
+       # create_frame <function name> <width> <height> <format> <name>
 
        FUNCTION=$1
        WIDTH=$2
        HEIGHT=$3
+       FORMAT=$4
+       NAME=$5
 
-       wdir=functions/$FUNCTION/streaming/uncompressed/u/${HEIGHT}p
+       wdir=functions/$FUNCTION/streaming/$FORMAT/$NAME/${HEIGHT}p
 
        mkdir -p $wdir
        echo $WIDTH > $wdir/wWidth
@@ -116,13 +118,15 @@ create_uvc() {
        echo "  Creating UVC gadget functionality : $FUNCTION"
        mkdir functions/$FUNCTION
 
-       create_frame $FUNCTION 640 360
-       create_frame $FUNCTION 1280 720
-       create_frame $FUNCTION 320 180
+       create_frame $FUNCTION 640 360 uncompressed u
+       create_frame $FUNCTION 1280 720 uncompressed u
+       create_frame $FUNCTION 320 180 uncompressed u
+       create_frame $FUNCTION 1920 1080 mjpeg m
 
        mkdir functions/$FUNCTION/streaming/header/h
        cd functions/$FUNCTION/streaming/header/h
        ln -s ../../uncompressed/u
+       ln -s ../../mjpeg/m
        cd ../../class/fs
        ln -s ../../header/h
        cd ../../class/hs
@@ -156,6 +160,8 @@ delete_uvc() {
        rm functions/$FUNCTION/streaming/header/h/u
        rmdir functions/$FUNCTION/streaming/uncompressed/u/*/
        rmdir functions/$FUNCTION/streaming/uncompressed/u
+       rm -rf functions/$FUNCTION/streaming/mjpeg/m/*/
+       rm -rf functions/$FUNCTION/streaming/mjpeg/m
        rmdir functions/$FUNCTION/streaming/header/h
        rmdir functions/$FUNCTION/control/header/h
        rmdir functions/$FUNCTION