summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-05-27 15:57:36 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-06-19 15:26:01 +0300
commit11a97d28892351c16769d34bfa4dafeeb36038e0 (patch)
treef35e6d8b8f53b85e3a1ae872689c8bc0bdd866cd /scripts
parente0b6971cb5e15529396b0c4795058dec2329f97e (diff)
vsp-lib: Support controls as device features
Enhance the feature checking code to allow checking for the presence of a particular control on a particular entity. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vsp-lib.sh35
1 files changed, 31 insertions, 4 deletions
diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh
index 0e7fa5a..f6fd342 100755
--- a/scripts/vsp-lib.sh
+++ b/scripts/vsp-lib.sh
@@ -14,8 +14,26 @@ vsp1_device() {
vsp1_has_feature() {
feature=$1
+ entity_name=$(echo $feature | sed 's/\[.*//')
- $mediactl -d $mdev -p | grep -q -- "- entity.*$feature"
+ ($mediactl -d $mdev -p | grep -q -- "- entity.*$entity_name") || return
+
+ option=$(echo $feature | cut -d '[' -f 2 -s | cut -d ']' -f 1)
+
+ [ -z $option ] && return
+
+ key=$(echo $option | sed 's/:.*//')
+ value=$(echo $option | sed "s/.*:'\(.*\)'/\1/")
+
+ case $key in
+ control)
+ vsp1_has_control $entity_name "$value"
+ return
+ ;;
+ *)
+ return 1
+ ;;
+ esac
}
vsp1_count_rpfs() {
@@ -43,6 +61,13 @@ vsp1_entity_get_size() {
sed 's/.*\/\([0-9x]*\).*/\1/'
}
+vsp1_has_control() {
+ subdev=$(vsp1_entity_subdev $1)
+ control_name=$(echo $2 | tr '+' ' ')
+
+ $yavta --no-query -l $subdev | grep -q -- "$control_name"
+}
+
# -----------------------------------------------------------------------------
# Referance frame generation
#
@@ -472,9 +497,11 @@ test_init() {
best_features_count=0
for mdev in /dev/media* ; do
+ dev=$(vsp1_device $mdev)
+
match='true'
for feature in $features ; do
- $(vsp1_has_feature $feature) || {
+ $(vsp1_has_feature "$feature") || {
match='false';
break;
}
@@ -491,7 +518,7 @@ test_init() {
features_count=0
for feature in $optional_features ; do
- $(vsp1_has_feature $feature) && {
+ $(vsp1_has_feature "$feature") && {
features_count=$((features_count+1))
match='false';
break;
@@ -510,7 +537,7 @@ test_init() {
fi
mdev=$best_mdev
- dev=$(vsp1_device $best_mdev)
+ dev=$(vsp1_device $mdev)
echo "Using device $mdev ($dev)" | ./logger.sh config >> $logfile
vsp_runner=./vsp-runner.sh