v4l2-compliance: various fixes.
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 26 May 2012 07:46:45 +0000 (09:46 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Sat, 26 May 2012 07:46:45 +0000 (09:46 +0200)
- set node.caps to vcap.device_caps if possible
- G/S_CTRL didn't test properly for the corner case where there are no
  controls at all.
- fix an overly strict test: 'LANG1 capability, but NTSC-M standard'. If the
  tuner supports PAL as well, then this is perfectly legal.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-compliance/v4l2-compliance.cpp
utils/v4l2-compliance/v4l2-test-controls.cpp
utils/v4l2-compliance/v4l2-test-input-output.cpp

index 3d5ffaf..4869520 100644 (file)
@@ -475,7 +475,10 @@ int main(int argc, char **argv)
        }
 
        doioctl(&node, VIDIOC_QUERYCAP, &vcap);
-       node.caps = vcap.capabilities;
+       if (vcap.capabilities & V4L2_CAP_DEVICE_CAPS)
+               node.caps = vcap.device_caps;
+       else
+               node.caps = vcap.capabilities;
        if (node.caps & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
                         V4L2_CAP_SLICED_VBI_CAPTURE | V4L2_CAP_RDS_CAPTURE |
                         V4L2_CAP_RADIO | V4L2_CAP_TUNER))
index 50b7764..8656fa8 100644 (file)
@@ -438,13 +438,15 @@ int testSimpleControls(struct node *node)
        }
        ctrl.id = 0;
        ret = doioctl(node, VIDIOC_G_CTRL, &ctrl);
-       if (ret != EINVAL)
+       if (ret != EINVAL && ret != ENOTTY)
                return fail("g_ctrl accepted invalid control ID\n");
        ctrl.id = 0;
        ctrl.value = 0;
        ret = doioctl(node, VIDIOC_S_CTRL, &ctrl);
-       if (ret != EINVAL)
+       if (ret != EINVAL && ret != ENOTTY)
                return fail("s_ctrl accepted invalid control ID\n");
+       if (ret == ENOTTY && node->controls.empty())
+               return ENOTTY;
        return 0;
 }
 
@@ -715,6 +717,8 @@ int testControlEvents(struct node *node)
                if (ret)
                        return fail("unsubscribe event for control '%s' failed\n", iter->name);
        }
+       if (node->controls.empty())
+               return ENOTTY;
        return 0;
 }
 
index a719022..ba7c429 100644 (file)
@@ -58,8 +58,6 @@ static int checkTuner(struct node *node, const struct v4l2_tuner &tuner,
                return fail("did not expect to see V4L2_TUNER_CAP_LOW set for a tv tuner\n");
        if (!tv && !(tuner.capability & V4L2_TUNER_CAP_LOW))
                return fail("V4L2_TUNER_CAP_LOW was not set for a radio tuner\n");
-       if (tv && std == V4L2_STD_NTSC_M && (tuner.capability & V4L2_TUNER_CAP_LANG1))
-               return fail("LANG1 capability, but NTSC-M standard\n");
        if (tuner.rangelow >= tuner.rangehigh)
                return fail("rangelow >= rangehigh\n");
        if (tuner.rangelow == 0 || tuner.rangehigh == 0xffffffff)