This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l2-compliance: fix frequency tests
Author:  Hans Verkuil <[email protected]>
Date:    Fri Jan 13 10:44:22 2012 +0100

1) If you set a frequency that is out of range then the spec says that the
   driver must map it to the closest valid frequency.

2) Assume that radio devices are either tuners or modulators but not both.

Signed-off-by: Hans Verkuil <[email protected]>
(cherry picked from commit b506b671ab56fceaff87970c2622e54184f5fc89)

 utils/v4l2-compliance/v4l2-test-input-output.cpp |   42 ++++++++++++---------
 1 files changed, 24 insertions(+), 18 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=bd666ddebcbaf03814c9f930e4d511861c6844f4

diff --git a/utils/v4l2-compliance/v4l2-test-input-output.cpp 
b/utils/v4l2-compliance/v4l2-test-input-output.cpp
index ce8ede3..e2cffc4 100644
--- a/utils/v4l2-compliance/v4l2-test-input-output.cpp
+++ b/utils/v4l2-compliance/v4l2-test-input-output.cpp
@@ -207,19 +207,22 @@ int testTunerFreq(struct node *node)
                        return fail("could not set rangehigh frequency\n");
                freq.frequency = tuner.rangelow - 1;
                ret = doioctl(node, VIDIOC_S_FREQUENCY, &freq);
-               if (ret != EINVAL)
-                       return fail("set rangelow-1 frequency did not return 
EINVAL\n");
+               if (ret)
+                       return fail("could not set rangelow-1 frequency\n");
+               ret = doioctl(node, VIDIOC_G_FREQUENCY, &freq);
+               if (ret || freq.frequency != tuner.rangelow)
+                       return fail("frequency rangelow-1 wasn't mapped to 
rangelow\n");
                freq.frequency = tuner.rangehigh + 1;
                ret = doioctl(node, VIDIOC_S_FREQUENCY, &freq);
-               if (ret != EINVAL)
-                       return fail("set rangehigh+1 frequency did not return 
EINVAL\n");
+               if (ret)
+                       return fail("could not set rangehigh+1 frequency\n");
+               ret = doioctl(node, VIDIOC_G_FREQUENCY, &freq);
+               if (ret || freq.frequency != tuner.rangehigh)
+                       return fail("frequency rangehigh+1 wasn't mapped to 
rangehigh\n");
        }
 
-       /* There is an ambiguity in the API and G/S_FREQUENCY: you cannot 
specify
-          correctly whether to the ioctl is for a tuner or a modulator. This 
should
-          be corrected, but until then the tests below have to be skipped if 
there
-          is a modulator of index t. */
-       if (node->modulators > t)
+       /* If this is a modulator device, then skip the remaining tests */
+       if (node->caps & V4L2_CAP_MODULATOR)
                return 0;
 
        freq.tuner = t;
@@ -542,19 +545,22 @@ int testModulatorFreq(struct node *node)
                        return fail("could not set rangehigh frequency\n");
                freq.frequency = modulator.rangelow - 1;
                ret = doioctl(node, VIDIOC_S_FREQUENCY, &freq);
-               if (ret != EINVAL)
-                       return fail("set rangelow-1 frequency did not return 
EINVAL\n");
+               if (ret)
+                       return fail("could not set rangelow-1 frequency\n");
+               ret = doioctl(node, VIDIOC_G_FREQUENCY, &freq);
+               if (ret || freq.frequency != modulator.rangelow)
+                       return fail("frequency rangelow-1 wasn't mapped to 
rangelow\n");
                freq.frequency = modulator.rangehigh + 1;
                ret = doioctl(node, VIDIOC_S_FREQUENCY, &freq);
-               if (ret != EINVAL)
-                       return fail("set rangehigh+1 frequency did not return 
EINVAL\n");
+               if (ret)
+                       return fail("could not set rangehigh+1 frequency\n");
+               ret = doioctl(node, VIDIOC_G_FREQUENCY, &freq);
+               if (ret || freq.frequency != modulator.rangehigh)
+                       return fail("frequency rangehigh+1 wasn't mapped to 
rangehigh\n");
        }
 
-       /* There is an ambiguity in the API and G/S_FREQUENCY: you cannot 
specify
-          correctly whether to the ioctl is for a tuner or a modulator. This 
should
-          be corrected, but until then the tests below have to be skipped if 
there
-          is a tuner of index m. */
-       if (node->tuners > m)
+       /* If this is a tuner device, then skip the remaining tests */
+       if (node->caps & V4L2_CAP_TUNER)
                return 0;
 
        freq.tuner = m;

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to