vsp-lib: Create a function to get subdev from entity name
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 27 May 2016 12:54:44 +0000 (15:54 +0300)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 19 Jun 2016 12:26:01 +0000 (15:26 +0300)
And use the function in the vsp-runner script instead of duplicating the
same code in multiple locations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
scripts/vsp-lib.sh
scripts/vsp-runner.sh

index d48108a..0e7fa5a 100755 (executable)
@@ -31,6 +31,10 @@ vsp1_count_bru_inputs() {
        echo $((num_pads-1))
 }
 
+vsp1_entity_subdev() {
+       $mediactl -d $mdev -e "$dev $1"
+}
+
 vsp1_entity_get_size() {
        entity=$1
        pad=$2
index 6aa72a2..d944e74 100755 (executable)
@@ -102,11 +102,10 @@ execute() {
        case $cmd in
        hgo)
                if [ "x$options" = xinfinite ] ; then
-                       $yavta -c -n 4 \
-                               `$mediactl -d $mdev -e "$dev hgo histo"`
+                       $yavta -c -n 4 $(vsp1_entity_subdev "hgo histo")
                else
                        $yavta -c10 -n 10 --file=histo-#.bin $options \
-                               `$mediactl -d $mdev -e "$dev hgo histo"`
+                               $(vsp1_entity_subdev "hgo histo")
                fi
                ;;
 
@@ -119,10 +118,10 @@ execute() {
 
                if [ "x$options" = xinfinite ] ; then
                        $yavta -c -n 4 -f $infmt -s $size --file=$file $options \
-                               `$mediactl -d $mdev -e "$dev $rpf input"`
+                               $(vsp1_entity_subdev "$rpf input")
                else
                        $yavta -c10 -n 4 -f $infmt -s $size --file=$file $options \
-                               `$mediactl -d $mdev -e "$dev $rpf input"`
+                               $(vsp1_entity_subdev "$rpf input")
                fi
 
                rm -f $file
@@ -134,10 +133,10 @@ execute() {
 
                if [ "x$options" = xinfinite ] ; then
                        $yavta -c -n 4 -f $outfmt -s $size \
-                               `$mediactl -d $mdev -e "$dev $wpf output"`
+                               $(vsp1_entity_subdev "$wpf output")
                else
                        $yavta -c10 -n 4 -f $outfmt -s $size --skip 7 -F $options \
-                               `$mediactl -d $mdev -e "$dev $wpf output"`
+                               $(vsp1_entity_subdev "$wpf output")
                fi
                ;;
        esac