Hi,

I send attached the v4l-test 0.5 for LTP.

Changes:
Test cases added for VIDIOC_QUERYSTD, VIDIOC_G_FREQUENCY and VIDIOC_G_TUNER.

Signed-off-by: Márton Németh <[email protected]>

Regards,

        Márton Németh
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/doc/index.html ltp/testcases/kernel/device-drivers/v4l/user_space/doc/index.html
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/doc/index.html	2009-01-05 08:25:21.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/doc/index.html	2009-01-31 12:17:52.000000000 +0100
@@ -1,10 +1,11 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd";>
 <html>
 <head>
   <meta content="text/html;charset=ISO-8859-2" http-equiv="Content-Type">
   <title>v4l-test: Test environment for Video For Linux Two API</title>
 </head>
 <body>
+<p>
 <a href="#what">What is this?</a> |
 <a href="#build">How to build?</a> |
 <a href="#run">How to run?</a> |
@@ -13,358 +14,454 @@
 <a href="#status">Status</a> |
 <a href="#others">Similar projects</a> |
 <a href="#feedback">Feedback</a><br>
+</p>
 <hr style="width: 100%; height: 2px;">
+
 <h1>v4l-test: Test environment for Video For Linux Two API</h1>
+<p>
 Download <a href="http://sourceforge.net/project/showfiles.php?group_id=247983";>v4l-test</a>
 or visit <a href="http://sourceforge.net/projects/v4l-test/";>v4l-test project page</a> at
-<a href="http://sourceforge.net";>sourceforge.net</a> .<br>
-<a name="what"></a>
-<h2>What is this?</h2>
+<a href="http://sourceforge.net";>sourceforge.net</a> .
+</p>
+
+<h2><a name="what">What is this?</a></h2>
+<p>
 v4l-test is a test test environment for V4L2 drivers. The V4L2 drivers
 are running under Linux in kernel space. This test environment is
 running in userspace and tries what normal video application would do.
 It also tries some things which are supposed to test the error handling
-mechanisms of a V4L2 driver. These are the "invalid test cases".<br>
-<a name="build"></a>
-<h2>How to build?</h2>
+mechanisms of a V4L2 driver. These are the "invalid test cases".
+</p>
+
+<h2><a name="build">How to build?</a></h2>
+<p>
 To build the test environment you will need a C compiler, "make" and
 the CUnit development files installed. Just type "make" and the test
-environment is ready.<br>
-<a name="run"></a>
-<h2>How to run?</h2>
+environment is ready.
+</p>
+
+<h2><a name="run">How to run?</a></h2>
+<p>
 You need to have a video device (i.e. webcam, tuner card, etc.)
 connected to your system and available under /dev/video0. If you don't
 have any hardware device available, you can still test the "Virtual
 Video Driver". To compile this you need to compile your kernel with
-CONFIG_VIDEO_VIVI=m under:<br>
+CONFIG_VIDEO_VIVI=m under:
+</p>
 <pre>  -&gt; Device Drivers<br>    -&gt; Multimedia devices<br>      -&gt; Video For Linux<br>        -&gt; Video capture adapters<br>         -&gt; Virtual Video Driver<br></pre>
-At this point you can execute v4l-test.<br>
-<a name="v4l2"></a>
-<h2>Video for Linux Two Specification</h2>
+<p>
+At this point you can execute v4l-test.
+</p>
+
+<h2><a name="v4l2">Video for Linux Two Specification</a></h2>
+<p>
 The <a href="spec/index.html">V4L2 API specification</a>
 revision 0.24 is the base for this test environment. The most recent
 version can be found at
-<a href="http://v4l2spec.bytesex.org/spec/";>http://v4l2spec.bytesex.org/spec/</a><br>
-<a name="code_coverage"></a>
-<h2>Code Coverage</h2>
+<a href="http://v4l2spec.bytesex.org/spec/";>http://v4l2spec.bytesex.org/spec/</a> .
+</p>
+
+<h2><a name="code_coverage">Code Coverage</a></h2>
+<p>
 The code coverage shows which lines of the code were executed and how
 many times. The measurement results gives you a feedback about the
 quality of the test cases. You can measure the code coverage of a
-kernel module with the <a
- href="http://ltp.sourceforge.net/coverage/gcov.php";>gocv</a> and <a
- href="http://ltp.sourceforge.net/coverage/lcov.php";>lcov</a> softwares.<br>
-<a name="status"></a>
-<h2>Current status</h2>
+kernel module with the
+<a href="http://ltp.sourceforge.net/coverage/gcov.php";>gocv</a> and
+<a href="http://ltp.sourceforge.net/coverage/lcov.php";>lcov</a> softwares.
+</p>
+
+<h2><a name="status">Current status</a></h2>
+<p>
 Currently all test are running and evaluated automatically. This might
 change in future if we want to test for example plugging and unplugging
 a USB video device or ask the user if a received picture make sense or
-not.<br>
-<br>
+not.
+</p>
+<p>
 The following table gives an overview about the current state of
-implemented<br>
-test cases.<br>
-<br>
+implemented test cases.</p>
+
 <table border="1" cellpadding="2"
  cellspacing="0">
   <thead>
     <tr>
-      <td><b>V4L API element</b></td><td><b>Covered?</b></td>
+      <td><b>V4L API element</b></td>
+      <td><b>Covered?</b></td>
+      <td><b>Note</b></td>
     </tr>
   </thead>
   <tbody>
     <tr>
       <td>V4L2 <a href="spec/r7626.htm">close()</a></td>
       <td>yes</td>
+      <td>All</td>
     </tr>
     <tr>
       <td>V4L2 <a href="spec/r7667.htm">ioctl()</a></td>
       <td>yes</td>
+      <td>All</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r7771.htm">VIDIOC_CROPCAP</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r7900.htm">VIDIOC_DBG_G_REGISTER</a></td>
       <td>no</td>
+      <td><a href="spec/x16453.htm">Exp.</a></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r7900.htm">VIDIOC_DBG_S_REGISTER</a></td>
       <td>no</td>
+      <td><a href="spec/x16453.htm">Exp.</a></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r8087.htm">VIDIOC_ENCODER_CMD</a></td>
       <td>no</td>
+      <td><a href="spec/x16453.htm">Exp.</a></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r8087.htm">VIDIOC_TRY_ENCODER_CMD</a></td>
       <td>no</td>
+      <td><a href="spec/x16453.htm">Exp.</a></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r8242.htm">VIDIOC_ENUMAUDIO</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r8304.htm">VIDIOC_ENUMAUDOUT</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r8367.htm">VIDIOC_ENUM_FMT</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r8494.htm">VIDIOC_ENUM_FRAMESIZES</a></td>
       <td>no</td>
+      <td><a href="spec/x16453.htm">Exp.</a></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r8724.htm">VIDIOC_ENUM_FRAMEINTERVALS</a></td>
       <td>no</td>
+      <td><a href="spec/x16453.htm">Exp.</a></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r8936.htm">VIDIOC_ENUMINPUT</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r9149.htm">VIDIOC_ENUMOUTPUT</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r9288.htm">VIDIOC_ENUMSTD</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r9539.htm">VIDIOC_G_AUDIO</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r9539.htm">VIDIOC_S_AUDIO</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r9688.htm">VIDIOC_G_AUDOUT</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r9688.htm">VIDIOC_S_AUDOUT</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r9804.htm">VIDIOC_G_CHIP_IDENT</a></td>
       <td>no</td>
+      <td><a href="spec/x16453.htm">Exp.</a></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r9994.htm">VIDIOC_G_CROP</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r9994.htm">VIDIOC_S_CROP</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10104.htm">VIDIOC_G_CTRL</a></td>
       <td>yes, only private and user controls; only user controls with V4L2_CTRL_FLAG_NEXT_CTRL</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10104.htm">VIDIOC_S_CTRL</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10211.htm">VIDIOC_G_ENC_INDEX</a></td>
       <td>no</td>
+      <td><a href="spec/x16453.htm">Exp.</a></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10386.htm">VIDIOC_G_EXT_CTRLS</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10386.htm">VIDIOC_S_EXT_CTRLS</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10386.htm">VIDIOC_TRY_EXT_CTRLS</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10595.htm">VIDIOC_G_FBUF</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10595.htm">VIDIOC_S_FBUF</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10944.htm">VIDIOC_G_FMT</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10944.htm">VIDIOC_S_FMT</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r10944.htm">VIDIOC_TRY_FMT</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11094.htm">VIDIOC_G_FREQUENCY</a></td>
-      <td>no</td>
+      <td>yes</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11094.htm">VIDIOC_S_FREQUENCY</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11217.htm">VIDIOC_G_INPUT</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11217.htm">VIDIOC_S_INPUT</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11285.htm">VIDIOC_G_JPEGCOMP</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11285.htm">VIDIOC_S_JPEGCOMP</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11430.htm">VIDIOC_G_MODULATOR</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11430.htm">VIDIOC_S_MODULATOR</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11612.htm">VIDIOC_G_OUTPUT</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11612.htm">VIDIOC_S_OUTPUT</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11680.htm">VIDIOC_G_PARM</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11680.htm">VIDIOC_S_PARM</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11946.htm">VIDIOC_G_PRIORITY</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r11946.htm">VIDIOC_S_PRIORITY</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r12051.htm">VIDIOC_G_SLICED_VBI_CAP</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r12265.htm">VIDIOC_G_STD</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r12265.htm">VIDIOC_S_STD</a></td>
       <td>yes, only when STREAM_OFF</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r12342.htm">VIDIOC_G_TUNER</a></td>
-      <td>no</td>
+      <td>yes</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r12342.htm">VIDIOC_S_TUNER</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r12784.htm">VIDIOC_LOG_STATUS</a></td>
       <td>yes</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r12816.htm">VIDIOC_OVERLAY</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r12878.htm">VIDIOC_QBUF</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r12878.htm">VIDIOC_DQBUF</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r13022.htm">VIDIOC_QUERYBUF</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r13105.htm">VIDIOC_QUERYCAP</a></td>
-      <td>no</td>
+      <td>yes, only when STREAM_OFF</td>
+      <td>All</td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r13317.htm">VIDIOC_QUERYCTRL</a></td>
       <td>yes, only private and user controls;
           only user controls with V4L2_CTRL_FLAG_NEXT_CTRL</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r13317.htm">VIDIOC_QUERYMENU</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r13641.htm">VIDIOC_QUERYSTD</a></td>
-      <td>no</td>
+      <td>yes</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r13696.htm">VIDIOC_REQBUFS</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r13817.htm">VIDIOC_STREAMON</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>ioctl <a href="spec/r13817.htm">VIDIOC_STREAMOFF</a></td>
       <td>no</td>
+      <td><br></td>
     </tr>
     <tr>
       <td>V4L2 <a href="spec/r13889.htm">mmap()</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>V4L2 <a href="spec/r14037.htm">munmap()</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>V4L2 <a href="spec/r14090.htm">open()</a></td>
       <td>yes, partly</td>
+      <td>All</td>
     </tr>
     <tr>
       <td>V4L2 <a href="spec/r14169.htm">poll()</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>V4L2 <a href="spec/r14264.htm">read()</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>V4L2 <a href="spec/r14390.htm">select()</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
     <tr>
       <td>V4L2 <a href="spec/r14496.htm">write()</a></td>
       <td>no</td>
+      <td>Opt.</td>
     </tr>
   </tbody>
 </table>
 
+<p>
+All: all drivers should support<br>
+Opt.: optional<br>
+Exp.: experimental, may change in future
+</p>
 
-<a name="others"></a>
-<h2>Similar projects</h2>
+<h2><a name="others">Similar projects</a></h2>
+<p>
 There migth be similar projects which also tries to test the V4L2 API.
-So far I could find the following:<br>
+So far I could find the following:
+</p>
 <ul>
   <li><a href="http://www.linuxowl.com/v4ltest.html";>v4ltest</a><br>
   </li>
@@ -376,22 +473,22 @@ So far I could find the following:<br>
       (LTP), under directory testcases/kernel/device-drivers/v4l/user_space
   </li>
 </ul>
-Please let me know if this list misses other V4L or V4L2 test project.<br>
-<a name="feedback"></a>
-<h2 >Feedbacks</h2>
-Any feedbacks, comments, ideas, etc. are welcome at the author's<br>
-email address.<br>
+<p>
+Please let me know if this list misses other V4L or V4L2 test project.
+</p>
+
+<h2><a name="feedback">Feedbacks</a></h2>
+<p>Any feedbacks, comments, ideas, etc. are welcome at the author's email address.</p>
 <hr style="width: 100%; height: 2px;">
-Last changed:
-Sun Jan  4 13:06:07 CET 2009
-<br>
-<p>
-    <a href="http://validator.w3.org/check?uri=referer";><img
-        src="http://www.w3.org/Icons/valid-html401";
-        alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>
-    <a href="http://sourceforge.net";><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=247983&amp;type=4"; width="125" height="37" border="0" alt="SourceForge.net Logo"></a>
-  </p>
+<p>Last changed:
+Sat Jan 31 11:49:12 2009
+</p>
+<p>
+  <a href="http://validator.w3.org/check?uri=referer";><img
+     src="http://www.w3.org/Icons/valid-html401";
+     alt="Valid HTML 4.01 Strict" height="31" width="88"></a>
+  <a href="http://sourceforge.net";><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=247983&amp;type=4"; width="125" height="37" alt="SourceForge.net Logo"></a>
+</p>
 
 </body>
 </html>
-
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/Makefile ltp/testcases/kernel/device-drivers/v4l/user_space/Makefile
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/Makefile	2009-01-05 08:25:21.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/Makefile	2009-01-31 08:58:17.000000000 +0100
@@ -1,6 +1,10 @@
 #
 # v4l-test: Test environment for Video For Linux Two API
 #
+# 31 Jan 2009  0.5  test_VIDIOC_TUNER.c added,
+#                   test_VIDIOC_FREQUENCY.c added,
+#                   test_VIDIOC_QUERYSTD.c added,
+#                   v4l2_validator.c added
 #  1 Jan 2009  0.4  test_VIDIOC_ENUMOUTPUT.c added,
 #                   test_VIDIOC_QUERYCTRL.c added
 # 23 Dec 2008  0.3  test_VIDIOC_LOG_STATUS.c added
@@ -18,6 +22,7 @@ LDFLAGS = -lcunit
 # TODO: handle dependencies
 
 OBJS = dev_video.o \
+       v4l2_validator.o \
        test_VIDIOC_QUERYCAP.o \
        test_VIDIOC_ENUMAUDIO.o \
        test_VIDIOC_ENUMAUDOUT.o \
@@ -28,8 +33,11 @@ OBJS = dev_video.o \
        test_VIDIOC_LOG_STATUS.o \
        test_VIDIOC_CROPCAP.o \
        test_VIDIOC_QUERYCTRL.o \
+       test_VIDIOC_QUERYSTD.o \
        test_VIDIOC_STD.o \
        test_VIDIOC_INPUT.o \
+       test_VIDIOC_TUNER.o \
+       test_VIDIOC_FREQUENCY.o \
        test_invalid_ioctl.o \
        v4l2_test.o
 
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/README ltp/testcases/kernel/device-drivers/v4l/user_space/README
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/README	2009-01-27 15:33:58.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/README	2009-01-31 11:53:35.000000000 +0100
@@ -4,6 +4,8 @@
 Release History
 ---------------
 
+31 Jan 2009  0.5  Test cases added for VIDIOC_QUERYSTD, VIDIOC_G_FREQUENCY
+                  and VIDIOC_G_TUNER
 24 Jan 2009  0.4  Test cases for MAX_EM28XX_INPUT, MAX_EM28XX_TVNORMS removed;
                   some typos fixed
  4 Jan 2008  0.3  Test cases for VIDIOC_ENUMOUTPUT, VIDIOC_ENUMAUDOUT,
@@ -67,83 +69,8 @@ Currently all test are running and evalu
 change in future if we want to test for example plugging and unplugging
 a USB video device or ask the user if a received picture make sense or not.
 
-The following table gives an overview about the current state of implemented
-test cases.
-
- V4L API element                  | Covered?
- ---------------------------------+---------------------------------------------
- V4L2 open()                      | yes, partly
- V4L2 close()                     | yes
- V4L2 ioctl()                     | yes
- ioctl VIDIOC_CROPCAP             | yes, only when STREAM_OFF
- ioctl VIDIOC_DBG_G_REGISTER      | no
- ioctl VIDIOC_DBG_S_REGISTER      | no
- ioctl VIDIOC_ENCODER_CMD         | no
- ioctl VIDIOC_TRY_ENCODER_CMD     | no
- ioctl VIDIOC_ENUMAUDIO           | yes, only when STREAM_OFF
- ioctl VIDIOC_ENUMAUDOUT          | yes, only when STREAM_OFF
- ioctl VIDIOC_ENUM_FMT            | yes, only when STREAM_OFF
- ioctl VIDIOC_ENUM_FRAMESIZES     | no
- ioctl VIDIOC_ENUM_FRAMEINTERVALS | no
- ioctl VIDIOC_ENUMINPUT           | yes, only when STREAM_OFF
- ioctl VIDIOC_ENUMOUTPUT          | yes, only when STREAM_OFF
- ioctl VIDIOC_ENUMSTD             | yes, only when STREAM_OFF
- ioctl VIDIOC_G_AUDIO             | no
- ioctl VIDIOC_S_AUDIO             | no
- ioctl VIDIOC_G_AUDOUT            | no
- ioctl VIDIOC_S_AUDOUT            | no
- ioctl VIDIOC_G_CHIP_IDENT        | no
- ioctl VIDIOC_G_CROP              | no
- ioctl VIDIOC_S_CROP              | no
- ioctl VIDIOC_G_CTRL              | no
- ioctl VIDIOC_S_CTRL              | no
- ioctl VIDIOC_G_ENC_INDEX         | no
- ioctl VIDIOC_G_EXT_CTRLS         | no
- ioctl VIDIOC_S_EXT_CTRLS         | no
- ioctl VIDIOC_TRY_EXT_CTRLS       | no
- ioctl VIDIOC_G_FBUF              | no
- ioctl VIDIOC_S_FBUF              | no
- ioctl VIDIOC_G_FMT               | no
- ioctl VIDIOC_S_FMT               | no
- ioctl VIDIOC_TRY_FMT             | no
- ioctl VIDIOC_G_FREQUENCY         | no
- ioctl VIDIOC_S_FREQUENCY         | no
- ioctl VIDIOC_G_INPUT             | yes, only when STREAM_OFF
- ioctl VIDIOC_S_INPUT             | yes, only when STREAM_OFF
- ioctl VIDIOC_G_JPEGCOMP          | no
- ioctl VIDIOC_S_JPEGCOMP          | no
- ioctl VIDIOC_G_MODULATOR         | no
- ioctl VIDIOC_S_MODULATOR         | no
- ioctl VIDIOC_G_OUTPUT            | no
- ioctl VIDIOC_S_OUTPUT            | no
- ioctl VIDIOC_G_PARM              | no
- ioctl VIDIOC_S_PARM              | no
- ioctl VIDIOC_G_PRIORITY          | no
- ioctl VIDIOC_S_PRIORITY          | no
- ioctl VIDIOC_G_SLICED_VBI_CAP    | no
- ioctl VIDIOC_G_STD               | yes, only when STREAM_OFF
- ioctl VIDIOC_S_STD               | yes, only when STREAM_OFF
- ioctl VIDIOC_G_TUNER             | no
- ioctl VIDIOC_S_TUNER             | no
- ioctl VIDIOC_LOG_STATUS          | yes
- ioctl VIDIOC_OVERLAY             | no
- ioctl VIDIOC_QBUF                | no
- ioctl VIDIOC_DQBUF               | no
- ioctl VIDIOC_QUERYBUF            | no
- ioctl VIDIOC_QUERYCAP            | no
- ioctl VIDIOC_QUERYCTRL           | yes, only private and user controls;
-                                  | only user controls with V4L2_CTRL_FLAG_NEXT_CTRL
- ioctl VIDIOC_QUERYMENU           | no
- ioctl VIDIOC_QUERYSTD            | no
- ioctl VIDIOC_REQBUFS             | no
- ioctl VIDIOC_STREAMON            | no
- ioctl VIDIOC_STREAMOFF           | no
- V4L2 mmap()                      | no
- V4L2 munmap()                    | no
- V4L2 poll()                      | no
- V4L2 read()                      | no
- V4L2 select()                    | no
- V4L2 write()                     | no
+See doc/index.html about how much of the specification is covered by the
+different test cases.
 
 Similar projects
 ----------------
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_FREQUENCY.c ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_FREQUENCY.c
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_FREQUENCY.c	1970-01-01 01:00:00.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_FREQUENCY.c	2009-01-31 09:54:46.000000000 +0100
@@ -0,0 +1,169 @@
+/*
+ * v4l-test: Test environment for Video For Linux Two API
+ *
+ * 31 Jan 2009  0.1  First release
+ *
+ * Written by Márton Németh <[email protected]>
+ * Released under GPL
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <string.h>
+
+#include <linux/videodev2.h>
+#include <linux/errno.h>
+
+#include <CUnit/CUnit.h>
+
+#include "v4l2_test.h"
+#include "dev_video.h"
+#include "video_limits.h"
+
+#include "test_VIDIOC_FREQUENCY.h"
+
+void test_VIDIOC_G_FREQUENCY() {
+	int ret;
+	__u32 tuner;
+	struct v4l2_frequency freq;
+
+	tuner = 0;
+
+	memset(&freq, 0xff, sizeof(freq));
+	freq.tuner = tuner;
+	ret = ioctl(get_video_fd(), VIDIOC_G_FREQUENCY, &freq);
+
+	dprintf("VIDIOC_G_FREQUENCY, ret=%i\n", ret);
+
+	if (ret == 0) {
+		CU_ASSERT_EQUAL(freq.tuner, tuner);
+
+		//CU_ASSERT(freq.type, ???);
+		//CU_ASSERT_EQUAL(freq.frequency, ???);
+
+		CU_ASSERT_EQUAL(freq.reserved[0], 0);
+		CU_ASSERT_EQUAL(freq.reserved[1], 0);
+		CU_ASSERT_EQUAL(freq.reserved[2], 0);
+		CU_ASSERT_EQUAL(freq.reserved[3], 0);
+		CU_ASSERT_EQUAL(freq.reserved[4], 0);
+		CU_ASSERT_EQUAL(freq.reserved[5], 0);
+		CU_ASSERT_EQUAL(freq.reserved[6], 0);
+		CU_ASSERT_EQUAL(freq.reserved[7], 0);
+
+		dprintf("\tfreq = { "
+			".tuner = %u, "
+			".type = 0x%X, "
+			".frequency = %u "
+			".reserved[]={ 0x%X, 0x%X, 0x%X, 0x%X, 0x%X, 0x%X, 0x%X, 0x%X } }\n",
+			freq.tuner,
+			freq.type,
+			freq.frequency,
+			freq.reserved[0],
+			freq.reserved[1],
+			freq.reserved[2],
+			freq.reserved[3],
+			freq.reserved[4],
+			freq.reserved[5],
+			freq.reserved[6],
+			freq.reserved[7]
+		);
+	} else {
+		dprintf("\t%s:%u: ret=%d (expected %d)\n", __FILE__, __LINE__, ret, -1);
+		dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+		CU_ASSERT_EQUAL(ret, -1);
+		CU_ASSERT_EQUAL(errno, EINVAL);
+	}
+
+}
+
+void test_VIDIOC_G_FREQUENCY_S32_MAX() {
+	int ret;
+	__u32 tuner;
+	struct v4l2_frequency freq;
+
+	tuner = (__u32)S32_MAX;
+
+	memset(&tuner, 0xff, sizeof(tuner));
+	freq.tuner = tuner;
+	ret = ioctl(get_video_fd(), VIDIOC_G_FREQUENCY, &freq);
+
+	dprintf("VIDIOC_G_FREQUENCY, ret=%i\n", ret);
+
+	dprintf("\t%s:%u: ret=%d (expected %d)\n", __FILE__, __LINE__, ret, -1);
+	dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+	CU_ASSERT_EQUAL(ret, -1);
+	CU_ASSERT_EQUAL(errno, EINVAL);
+}
+
+void test_VIDIOC_G_FREQUENCY_S32_MAX_1() {
+	int ret;
+	__u32 tuner;
+	struct v4l2_frequency freq;
+
+	tuner = (__u32)S32_MAX+1;
+
+	memset(&tuner, 0xff, sizeof(tuner));
+	freq.tuner = tuner;
+	ret = ioctl(get_video_fd(), VIDIOC_G_FREQUENCY, &freq);
+
+	dprintf("VIDIOC_G_FREQUENCY, ret=%i\n", ret);
+
+	dprintf("\t%s:%u: ret=%d (expected %d)\n", __FILE__, __LINE__, ret, -1);
+	dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+	CU_ASSERT_EQUAL(ret, -1);
+	CU_ASSERT_EQUAL(errno, EINVAL);
+}
+
+void test_VIDIOC_G_FREQUENCY_U32_MAX() {
+	int ret;
+	__u32 tuner;
+	struct v4l2_frequency freq;
+
+	tuner = U32_MAX;
+
+	memset(&tuner, 0xff, sizeof(tuner));
+	freq.tuner = tuner;
+	ret = ioctl(get_video_fd(), VIDIOC_G_FREQUENCY, &freq);
+
+	dprintf("VIDIOC_G_FREQUENCY, ret=%i\n", ret);
+
+	dprintf("\t%s:%u: ret=%d (expected %d)\n", __FILE__, __LINE__, ret, -1);
+	dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+	CU_ASSERT_EQUAL(ret, -1);
+	CU_ASSERT_EQUAL(errno, EINVAL);
+}
+
+void test_VIDIOC_G_FREQUENCY_NULL() {
+	int ret1;
+	int errno1;
+	int ret2;
+	struct v4l2_frequency freq;
+
+	memset(&freq, 0xff, sizeof(freq));
+	freq.tuner = 0;
+	ret1 = ioctl(get_video_fd(), VIDIOC_G_FREQUENCY, &freq);
+	errno1 = errno;
+
+	ret2 = ioctl(get_video_fd(), VIDIOC_G_FREQUENCY, NULL);
+
+	/* check if VIDIOC_G_FREQUENCY is supported at all or not */
+	if (ret1 == -1 && errno1 == EINVAL) {
+		/* VIDIOC_G_FREQUENCY not supported at all, the parameter should not be evaluated */
+		dprintf("\t%s:%u: ret2=%d (expected %d)\n", __FILE__, __LINE__, ret2, -1);
+		dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+		CU_ASSERT_EQUAL(ret2, -1);
+		CU_ASSERT_EQUAL(errno, EINVAL);
+
+	} else {
+		/* VIDIOC_G_FREQUENCY is supported, the parameter should be checked */
+		dprintf("\t%s:%u: ret2=%d (expected %d)\n", __FILE__, __LINE__, ret2, -1);
+		dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EFAULT);
+		CU_ASSERT_EQUAL(ret2, -1);
+		CU_ASSERT_EQUAL(errno, EFAULT);
+	}
+}
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_FREQUENCY.h ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_FREQUENCY.h
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_FREQUENCY.h	1970-01-01 01:00:00.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_FREQUENCY.h	2009-01-31 09:55:46.000000000 +0100
@@ -0,0 +1,14 @@
+/*
+ * v4l-test: Test environment for Video For Linux Two API
+ *
+ * 31 Jan 2009  0.1  First release
+ *
+ * Written by Márton Németh <[email protected]>
+ * Released under GPL
+ */
+
+void test_VIDIOC_G_FREQUENCY(void);
+void test_VIDIOC_G_FREQUENCY_S32_MAX(void);
+void test_VIDIOC_G_FREQUENCY_S32_MAX_1(void);
+void test_VIDIOC_G_FREQUENCY_U32_MAX(void);
+void test_VIDIOC_G_FREQUENCY_NULL(void);
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_QUERYSTD.c ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_QUERYSTD.c
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_QUERYSTD.c	1970-01-01 01:00:00.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_QUERYSTD.c	2009-01-31 07:12:05.000000000 +0100
@@ -0,0 +1,86 @@
+/*
+ * v4l-test: Test environment for Video For Linux Two API
+ *
+ * 30 Jan 2009  0.1  First release
+ *
+ * Written by Márton Németh <[email protected]>
+ * Released under GPL
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <string.h>
+
+#include <linux/videodev2.h>
+#include <linux/errno.h>
+
+#include <CUnit/CUnit.h>
+
+#include "v4l2_test.h"
+#include "dev_video.h"
+#include "video_limits.h"
+#include "v4l2_validator.h"
+
+#include "test_VIDIOC_QUERYSTD.h"
+
+void test_VIDIOC_QUERYSTD() {
+	int ret;
+	v4l2_std_id id;
+
+	memset(&id, 0, sizeof(id));
+
+	ret = ioctl(get_video_fd(), VIDIOC_QUERYSTD, &id);
+
+	dprintf("VIDIOC_QUERYSTD, ret=%i\n", ret);
+	dprintf("\tid=0x%llx\n", id);
+
+	if (ret == 0) {
+		CU_ASSERT(id != 0);
+		CU_ASSERT(valid_v4l2_std_id(id));
+
+	} else if (ret == -1) {
+		/* if this ioctl is not supported, then errno shall be EINVAL */
+		dprintf("\tret=%d (expected %d)\n", ret, -1);
+		dprintf("\terrno=%d (expected %d)\n", errno, EINVAL);
+		CU_ASSERT_EQUAL(errno, EINVAL);
+	}
+
+}
+
+void test_VIDIOC_QUERYSTD_NULL() {
+	int ret1;
+	int errno1;
+	int ret2;
+	v4l2_std_id id;
+
+	memset(&id, 0, sizeof(id));
+	ret1 = ioctl(get_video_fd(), VIDIOC_QUERYSTD, NULL);
+	errno1 = errno;
+	dprintf("\tChecking VIDIOC_QUERYSTD whether is supported: "
+		"%s (ret1=%d, errno1=%d)\n", (ret1 == -1 && errno1 == EINVAL) ? "no" : "yes", ret1, errno1);
+
+	ret2 = ioctl(get_video_fd(), VIDIOC_QUERYSTD, NULL);
+
+	/* check if VIDIOC_QUERYSTD is supported at all or not */
+	if (ret1 == -1 && errno1 == EINVAL) {
+		/* VIDIOC_QUERYSTD not supported at all, the parameter should not be evaluated */
+		dprintf("\t%s:%u: ret2=%d (expected %d)\n", __FILE__, __LINE__, ret2, -1);
+		dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+		CU_ASSERT_EQUAL(ret2, -1);
+		CU_ASSERT_EQUAL(errno, EINVAL);
+
+	} else {
+		/* VIDIOC_QUERYSTD is supported, the parameter should be checked */
+		dprintf("\t%s:%u: ret2=%d (expected %d)\n", __FILE__, __LINE__, ret2, -1);
+		dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EFAULT);
+		CU_ASSERT_EQUAL(ret2, -1);
+		CU_ASSERT_EQUAL(errno, EFAULT);
+	}
+}
+
+/* TODO: check for different input settings */
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_QUERYSTD.h ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_QUERYSTD.h
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_QUERYSTD.h	1970-01-01 01:00:00.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_QUERYSTD.h	2009-01-30 21:36:03.000000000 +0100
@@ -0,0 +1,11 @@
+/*
+ * v4l-test: Test environment for Video For Linux Two API
+ *
+ * 30 Jan 2009  0.1  First release
+ *
+ * Written by Márton Németh <[email protected]>
+ * Released under GPL
+ */
+
+void test_VIDIOC_QUERYSTD(void);
+void test_VIDIOC_QUERYSTD_NULL(void);
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_STD.c ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_STD.c
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_STD.c	2009-01-27 15:33:58.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_STD.c	2009-01-30 21:50:13.000000000 +0100
@@ -1,6 +1,7 @@
 /*
  * v4l-test: Test environment for Video For Linux Two API
  *
+ * 30 Jan 2009  0.5  valid_v4l2_std_id() moved to v4l2_validator.c
  * 18 Jan 2009  0.4  Typo corrected
  * 23 Dec 2008  0.3  Debug messages added
  * 22 Dec 2008  0.2  Test case with NULL parameter added
@@ -27,46 +28,10 @@
 #include "v4l2_test.h"
 #include "dev_video.h"
 #include "video_limits.h"
+#include "v4l2_validator.h"
 
 #include "test_VIDIOC_STD.h"
 
-int valid_v4l2_std_id(v4l2_std_id std_id) {
-	int valid = 0;
-
-	if ( (std_id & ~(V4L2_STD_PAL_B |
-			 V4L2_STD_PAL_B1 |
-			 V4L2_STD_PAL_G |
-			 V4L2_STD_PAL_H |
-			 V4L2_STD_PAL_I |
-			 V4L2_STD_PAL_D |
-			 V4L2_STD_PAL_D1 |
-			 V4L2_STD_PAL_K |
-			 V4L2_STD_PAL_M |
-			 V4L2_STD_PAL_N |
-			 V4L2_STD_PAL_Nc |
-			 V4L2_STD_PAL_60 |
-			 V4L2_STD_NTSC_M |
-			 V4L2_STD_NTSC_M_JP |
-			 V4L2_STD_NTSC_443 |
-			 V4L2_STD_NTSC_M_KR |
-			 V4L2_STD_SECAM_B |
-			 V4L2_STD_SECAM_D |
-			 V4L2_STD_SECAM_G |
-			 V4L2_STD_SECAM_H |
-			 V4L2_STD_SECAM_K |
-			 V4L2_STD_SECAM_K1 |
-			 V4L2_STD_SECAM_L |
-			 V4L2_STD_SECAM_LC |
-			 V4L2_STD_ATSC_8_VSB |
-			 V4L2_STD_ATSC_16_VSB))
-		== 0) {
-		valid = 1;
-	} else {
-		valid = 0;
-	}
-	return valid;
-}
-
 void test_VIDIOC_G_STD() {
 	int ret;
 	v4l2_std_id std_id;
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_TUNER.c ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_TUNER.c
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_TUNER.c	1970-01-01 01:00:00.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_TUNER.c	2009-01-31 09:46:46.000000000 +0100
@@ -0,0 +1,274 @@
+/*
+ * v4l-test: Test environment for Video For Linux Two API
+ *
+ * 31 Jan 2009  0.1  First release
+ *
+ * Written by Márton Németh <[email protected]>
+ * Released under GPL
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <string.h>
+
+#include <linux/videodev2.h>
+#include <linux/errno.h>
+
+#include <CUnit/CUnit.h>
+
+#include "v4l2_test.h"
+#include "dev_video.h"
+#include "video_limits.h"
+
+#include "test_VIDIOC_TUNER.h"
+
+int valid_tuner_type(enum v4l2_tuner_type type) {
+	int valid = 0;
+
+	switch (type) {
+		case V4L2_TUNER_RADIO:
+		case V4L2_TUNER_ANALOG_TV:
+			valid = 1;
+			break;
+		default:
+			valid = 0;
+	}
+
+	return valid;
+}
+
+int valid_tuner_capability(__u32 capability) {
+	int valid = 0;
+
+	if ( (capability & ~(V4L2_TUNER_CAP_LOW |
+			     V4L2_TUNER_CAP_NORM |
+			     V4L2_TUNER_CAP_STEREO |
+			     V4L2_TUNER_CAP_LANG1 |
+			     V4L2_TUNER_CAP_LANG2 |
+			     V4L2_TUNER_CAP_SAP))
+		== 0) {
+		valid = 1;
+	} else {
+		valid = 0;
+	}
+	return valid;
+}
+
+int valid_tuner_sub(__u32 tuner_sub) {
+	int valid = 0;
+
+	CU_ASSERT_EQUAL(V4L2_TUNER_SUB_SAP, V4L2_TUNER_SUB_LANG2);
+
+	if ( (tuner_sub & ~(V4L2_TUNER_SUB_MONO |
+			    V4L2_TUNER_SUB_STEREO |
+			    V4L2_TUNER_SUB_LANG1 |
+			    V4L2_TUNER_SUB_LANG2 |
+			    V4L2_TUNER_SUB_SAP))
+		== 0) {
+		valid = 1;
+	} else {
+		valid = 0;
+	}
+	return valid;
+}
+
+int valid_tuner_audmode(__u32 audmode) {
+	int valid = 0;
+
+	CU_ASSERT_EQUAL(V4L2_TUNER_MODE_SAP, V4L2_TUNER_MODE_LANG2);
+
+	switch (audmode) {
+		case V4L2_TUNER_MODE_MONO:
+		case V4L2_TUNER_MODE_STEREO:
+		case V4L2_TUNER_MODE_LANG1:
+		case V4L2_TUNER_MODE_LANG2:
+		case V4L2_TUNER_MODE_LANG1_LANG2:
+			valid = 1;
+			break;
+		default:
+			valid = 0;
+	}
+
+	return valid;
+}
+
+static int do_get_tuner(int f, __u32 index) {
+	int ret;
+	struct v4l2_tuner tuner;
+
+	memset(&tuner, 0xff, sizeof(tuner));
+	tuner.index = index;
+	ret = ioctl(f, VIDIOC_G_TUNER, &tuner);
+
+	dprintf("VIDIOC_G_TUNER, ret=%i\n", ret);
+
+	if (ret == 0) {
+		CU_ASSERT_EQUAL(ret, 0);
+
+		CU_ASSERT_EQUAL(tuner.index, index);
+
+		CU_ASSERT(0 < strlen( (char*)tuner.name ));
+
+		CU_ASSERT(valid_tuner_type(tuner.type));
+		CU_ASSERT(valid_tuner_capability(tuner.capability));
+
+		CU_ASSERT(tuner.rangelow <= tuner.rangehigh);
+		CU_ASSERT(valid_tuner_sub(tuner.rxsubchans));
+		CU_ASSERT(valid_tuner_audmode(tuner.audmode));
+
+		/* tuner.signal can have any value */
+		//CU_ASSERT_EQUAL(tuner.signal, ???);
+
+		/* tuner.afc can have any value */
+		//CU_ASSERT_EQUAL(tuner.afc, ???);
+
+		CU_ASSERT_EQUAL(tuner.reserved[0], 0);
+		CU_ASSERT_EQUAL(tuner.reserved[1], 0);
+		CU_ASSERT_EQUAL(tuner.reserved[2], 0);
+		CU_ASSERT_EQUAL(tuner.reserved[3], 0);
+
+		dprintf("\ttuner = { "
+			".index = %u, "
+			".name = \"%s\", "
+			".type = %i, "
+			".capability = %u, "
+			".rangelow = %u, "
+			".rangehigh = %u, "
+			".rxsubchans = %u, "
+			".audmode = %u, "
+			".signal = %u, "
+			".afc = %i, "
+			".reserved[]={ 0x%X, 0x%X, 0x%X, 0x%X } }\n",
+			tuner.index,
+			tuner.name,
+			tuner.type,
+			tuner.capability,
+			tuner.rangelow,
+			tuner.rangehigh,
+			tuner.rxsubchans,
+			tuner.audmode,
+			tuner.signal,
+			tuner.afc,
+			tuner.reserved[0],
+			tuner.reserved[1],
+			tuner.reserved[2],
+			tuner.reserved[3]
+		);
+
+	} else {
+		dprintf("\t%s:%u: ret=%d (expected %d)\n", __FILE__, __LINE__, ret, -1);
+		dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+		CU_ASSERT_EQUAL(ret, -1);
+		CU_ASSERT_EQUAL(errno, EINVAL);
+	}
+
+	return ret;
+}
+
+void test_VIDIOC_G_TUNER() {
+	int ret;
+	__u32 index;
+	int f;
+
+	f = get_video_fd();
+
+	index = 0;
+	do {
+		ret = do_get_tuner(f, index);
+		index++;
+	} while (ret == 0);
+
+}
+
+void test_VIDIOC_G_TUNER_S32_MAX() {
+	int ret;
+	__u32 index;
+	struct v4l2_tuner tuner;
+
+	index = (__u32)S32_MAX;
+
+	memset(&tuner, 0xff, sizeof(tuner));
+	tuner.index = index;
+	ret = ioctl(get_video_fd(), VIDIOC_G_TUNER, &tuner);
+
+	dprintf("VIDIOC_G_TUNER, ret=%i\n", ret);
+
+	dprintf("\t%s:%u: ret=%d (expected %d)\n", __FILE__, __LINE__, ret, -1);
+	dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+	CU_ASSERT_EQUAL(ret, -1);
+	CU_ASSERT_EQUAL(errno, EINVAL);
+}
+
+void test_VIDIOC_G_TUNER_S32_MAX_1() {
+	int ret;
+	__u32 index;
+	struct v4l2_tuner tuner;
+
+	index = (__u32)S32_MAX+1;
+
+	memset(&tuner, 0xff, sizeof(tuner));
+	tuner.index = index;
+	ret = ioctl(get_video_fd(), VIDIOC_G_TUNER, &tuner);
+
+	dprintf("VIDIOC_G_TUNER, ret=%i\n", ret);
+
+	dprintf("\t%s:%u: ret=%d (expected %d)\n", __FILE__, __LINE__, ret, -1);
+	dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+	CU_ASSERT_EQUAL(ret, -1);
+	CU_ASSERT_EQUAL(errno, EINVAL);
+}
+
+void test_VIDIOC_G_TUNER_U32_MAX() {
+	int ret;
+	__u32 index;
+	struct v4l2_tuner tuner;
+
+	index = U32_MAX;
+
+	memset(&tuner, 0xff, sizeof(tuner));
+	tuner.index = index;
+	ret = ioctl(get_video_fd(), VIDIOC_G_TUNER, &tuner);
+
+	dprintf("VIDIOC_G_TUNER, ret=%i\n", ret);
+
+	dprintf("\t%s:%u: ret=%d (expected %d)\n", __FILE__, __LINE__, ret, -1);
+	dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+	CU_ASSERT_EQUAL(ret, -1);
+	CU_ASSERT_EQUAL(errno, EINVAL);
+}
+
+void test_VIDIOC_G_TUNER_NULL() {
+	int ret1;
+	int errno1;
+	int ret2;
+	struct v4l2_tuner tuner;
+
+	memset(&tuner, 0xff, sizeof(tuner));
+	tuner.index = 0;
+	ret1 = ioctl(get_video_fd(), VIDIOC_G_TUNER, &tuner);
+	errno1 = errno;
+
+	ret2 = ioctl(get_video_fd(), VIDIOC_G_TUNER, NULL);
+
+	/* check if VIDIOC_G_TUNER is supported at all or not */
+	if (ret1 == -1 && errno1 == EINVAL) {
+		/* VIDIOC_G_TUNER not supported at all, the parameter should not be evaluated */
+		dprintf("\t%s:%u: ret2=%d (expected %d)\n", __FILE__, __LINE__, ret2, -1);
+		dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EINVAL);
+		CU_ASSERT_EQUAL(ret2, -1);
+		CU_ASSERT_EQUAL(errno, EINVAL);
+
+	} else {
+		/* VIDIOC_G_TUNER is supported, the parameter should be checked */
+		dprintf("\t%s:%u: ret2=%d (expected %d)\n", __FILE__, __LINE__, ret2, -1);
+		dprintf("\t%s:%u: errno=%d (expected %d)\n", __FILE__, __LINE__, errno, EFAULT);
+		CU_ASSERT_EQUAL(ret2, -1);
+		CU_ASSERT_EQUAL(errno, EFAULT);
+	}
+
+}
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_TUNER.h ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_TUNER.h
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_TUNER.h	1970-01-01 01:00:00.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/test_VIDIOC_TUNER.h	2009-01-31 08:35:05.000000000 +0100
@@ -0,0 +1,14 @@
+/*
+ * v4l-test: Test environment for Video For Linux Two API
+ *
+ * 31 Jan 2009  0.1  First release
+ *
+ * Written by Márton Németh <[email protected]>
+ * Released under GPL
+ */
+
+void test_VIDIOC_G_TUNER(void);
+void test_VIDIOC_G_TUNER_S32_MAX(void);
+void test_VIDIOC_G_TUNER_S32_MAX_1(void);
+void test_VIDIOC_G_TUNER_U32_MAX(void);
+void test_VIDIOC_G_TUNER_NULL(void);
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/v4l2_test.c ltp/testcases/kernel/device-drivers/v4l/user_space/v4l2_test.c
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/v4l2_test.c	2009-01-27 15:33:58.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/v4l2_test.c	2009-01-31 10:00:29.000000000 +0100
@@ -1,7 +1,8 @@
 /*
  * v4l-test: Test environment for Video For Linux Two API
  *
- * 18 Jan 2009  0.5  Testa cases for MAX_EM28XX_INPUT and MAX_EM28XX_TVNORMS
+ * 31 Jan 2009  0.6  Test cases for VIDIOC_G_TUNER added
+ * 18 Jan 2009  0.5  Test cases for MAX_EM28XX_INPUT and MAX_EM28XX_TVNORMS
  *                   removed
  *  1 Jan 2009  0.4  Test cases for VIDIOC_ENUMOUTPUT, VIDIOC_ENUMAUDOUT,
  *                   VIDIOC_QUERYCTRL added;
@@ -36,6 +37,7 @@
 #include "video_limits.h"
 
 #include "test_VIDIOC_QUERYCAP.h"
+#include "test_VIDIOC_QUERYSTD.h"
 #include "test_VIDIOC_QUERYCTRL.h"
 #include "test_VIDIOC_CROPCAP.h"
 
@@ -48,12 +50,16 @@
 
 #include "test_VIDIOC_STD.h"
 #include "test_VIDIOC_INPUT.h"
+#include "test_VIDIOC_TUNER.h"
+#include "test_VIDIOC_FREQUENCY.h"
+
 #include "test_VIDIOC_LOG_STATUS.h"
 #include "test_invalid_ioctl.h"
 
 
 static CU_TestInfo suite_querycap[] = {
   { "VIDIOC_QUERYCAP", test_VIDIOC_QUERYCAP },
+  { "VIDIOC_QUERYCAP with NULL parameter", test_VIDIOC_QUERYCAP_NULL },
 
   { "VIDIOC_CROPCAP", test_VIDIOC_CROPCAP },
   { "VIDIOC_CROPCAP with different inputs", test_VIDIOC_CROPCAP_enum_INPUT },
@@ -127,9 +133,30 @@ static CU_TestInfo suite_get_set_try[] =
   { "VIDIOC_G_INPUT with NULL parameter", test_VIDIOC_G_INPUT_NULL },
   { "VIDIOC_S_INPUT with NULL parameter", test_VIDIOC_S_INPUT_NULL },
 
+  { "VIDIOC_G_TUNER", test_VIDIOC_G_TUNER },
+  { "VIDIOC_G_TUNER, index=S32_MAX", test_VIDIOC_G_TUNER_S32_MAX },
+  { "VIDIOC_G_TUNER, index=S32_MAX+1", test_VIDIOC_G_TUNER_S32_MAX_1 },
+  { "VIDIOC_G_TUNER, index=U32_MAX", test_VIDIOC_G_TUNER_U32_MAX },
+  { "VIDIOC_G_TUNER with NULL parameter", test_VIDIOC_G_TUNER_NULL },
+
+  { "VIDIOC_G_FREQUENCY", test_VIDIOC_G_FREQUENCY },
+  { "VIDIOC_G_FREQUENCY, tuner=S32_MAX", test_VIDIOC_G_FREQUENCY_S32_MAX },
+  { "VIDIOC_G_FREQUENCY, tuner=S32_MAX+1", test_VIDIOC_G_FREQUENCY_S32_MAX_1 },
+  { "VIDIOC_G_FREQUENCY, tuner=U32_MAX", test_VIDIOC_G_FREQUENCY_U32_MAX },
+  { "VIDIOC_G_FREQUENCY with NULL parameter", test_VIDIOC_G_FREQUENCY_NULL },
+
+  CU_TEST_INFO_NULL,
+};
+
+static CU_TestInfo suite_querystd[] = {
+  { "VIDIOC_QUERYSTD", test_VIDIOC_QUERYSTD },
+
+  { "VIDIOC_QUERYSTD with NULL parameter", test_VIDIOC_QUERYSTD_NULL },
+
   CU_TEST_INFO_NULL,
 };
 
+
 static CU_TestInfo suite_invalid_ioctl[] = {
   { "invalid ioctl _IO(0, 0)", test_invalid_ioctl_1 },
   { "invalid ioctl _IO(0xFF, 0xFF)", test_invalid_ioctl_2 },
@@ -149,6 +176,7 @@ static CU_SuiteInfo suites[] = {
   { "VIDIOC_QUERYCAP", open_video, close_video, suite_querycap },
   { "VIDIOC_ENUM* ioctl calls", open_video, close_video, suite_enums },
   { "VIDIOC_G_*, VIDIOC_S_* and VIDIOC_TRY_* ioctl calls", open_video, close_video, suite_get_set_try },
+  { "VIDIOC_QUERYSTD", open_video, close_video, suite_querystd },
   { "debug ioctl calls", open_video, close_video, suite_debug_ioctl },
   { "invalid ioctl calls", open_video, close_video, suite_invalid_ioctl },
   CU_SUITE_INFO_NULL,
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/v4l2_validator.c ltp/testcases/kernel/device-drivers/v4l/user_space/v4l2_validator.c
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/v4l2_validator.c	1970-01-01 01:00:00.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/v4l2_validator.c	2009-01-30 21:49:11.000000000 +0100
@@ -0,0 +1,62 @@
+/*
+ * v4l-test: Test environment for Video For Linux Two API
+ *
+ * 30 Jan 2009  0.1  First release
+ *
+ * Written by Márton Németh <[email protected]>
+ * Released under GPL
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <string.h>
+
+#include <linux/videodev2.h>
+#include <linux/errno.h>
+
+#include "v4l2_test.h"
+#include "dev_video.h"
+#include "video_limits.h"
+#include "v4l2_validator.h"
+
+int valid_v4l2_std_id(v4l2_std_id std_id) {
+	int valid = 0;
+
+	if ( (std_id & ~(V4L2_STD_PAL_B |
+			 V4L2_STD_PAL_B1 |
+			 V4L2_STD_PAL_G |
+			 V4L2_STD_PAL_H |
+			 V4L2_STD_PAL_I |
+			 V4L2_STD_PAL_D |
+			 V4L2_STD_PAL_D1 |
+			 V4L2_STD_PAL_K |
+			 V4L2_STD_PAL_M |
+			 V4L2_STD_PAL_N |
+			 V4L2_STD_PAL_Nc |
+			 V4L2_STD_PAL_60 |
+			 V4L2_STD_NTSC_M |
+			 V4L2_STD_NTSC_M_JP |
+			 V4L2_STD_NTSC_443 |
+			 V4L2_STD_NTSC_M_KR |
+			 V4L2_STD_SECAM_B |
+			 V4L2_STD_SECAM_D |
+			 V4L2_STD_SECAM_G |
+			 V4L2_STD_SECAM_H |
+			 V4L2_STD_SECAM_K |
+			 V4L2_STD_SECAM_K1 |
+			 V4L2_STD_SECAM_L |
+			 V4L2_STD_SECAM_LC |
+			 V4L2_STD_ATSC_8_VSB |
+			 V4L2_STD_ATSC_16_VSB))
+		== 0) {
+		valid = 1;
+	} else {
+		valid = 0;
+	}
+	return valid;
+}
diff -uprN ltp.orig/testcases/kernel/device-drivers/v4l/user_space/v4l2_validator.h ltp/testcases/kernel/device-drivers/v4l/user_space/v4l2_validator.h
--- ltp.orig/testcases/kernel/device-drivers/v4l/user_space/v4l2_validator.h	1970-01-01 01:00:00.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/v4l/user_space/v4l2_validator.h	2009-01-30 21:46:25.000000000 +0100
@@ -0,0 +1,12 @@
+/*
+ * v4l-test: Test environment for Video For Linux Two API
+ *
+ * 30 Jan 2009  0.1  First release
+ *
+ * Written by Márton Németh <[email protected]>
+ * Released under GPL
+ */
+
+#include <linux/videodev2.h>
+
+int valid_v4l2_std_id(v4l2_std_id std_id);
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to