diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-11-28 08:03:23 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-11-28 08:03:23 -0200 |
commit | 05222402b72fa35a14adb35db4e51e55d3b72f2f (patch) | |
tree | ce5a78e12fb23de330787a3d4d440433af1f6f78 /v4l2-apps/test | |
parent | 87fc384f35e1ee563498df696b57b908a215a499 (diff) | |
parent | 080a587ad1c509488047ab48c14f424b3e3c2cd9 (diff) | |
download | mediapointer-dvb-s2-05222402b72fa35a14adb35db4e51e55d3b72f2f.tar.gz mediapointer-dvb-s2-05222402b72fa35a14adb35db4e51e55d3b72f2f.tar.bz2 |
merge: http://linuxtv.org/hg/~mkrufky/lgdt330x
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l2-apps/test')
-rw-r--r-- | v4l2-apps/test/Makefile | 8 | ||||
-rw-r--r-- | v4l2-apps/test/driver-test.c | 80 | ||||
-rw-r--r-- | v4l2-apps/test/ioctl-test.c | 19 |
3 files changed, 101 insertions, 6 deletions
diff --git a/v4l2-apps/test/Makefile b/v4l2-apps/test/Makefile index b6a83b2b3..6c1edf6a5 100644 --- a/v4l2-apps/test/Makefile +++ b/v4l2-apps/test/Makefile @@ -6,7 +6,8 @@ binaries = ioctl-test \ sliced-vbi-test \ sliced-vbi-detect \ vbi-test \ - v4lgrab + v4lgrab \ + driver-test .PHONY: all clean install @@ -17,4 +18,9 @@ clean:: install: +../lib/libv4l2.a: ../lib/v4l2_driver.c ../lib/frequencies.c + make -C ../lib libv4l2.a + +driver-test: driver-test.o ../lib/libv4l2.a + include ../Make.rules diff --git a/v4l2-apps/test/driver-test.c b/v4l2-apps/test/driver-test.c new file mode 100644 index 000000000..809ee170c --- /dev/null +++ b/v4l2-apps/test/driver-test.c @@ -0,0 +1,80 @@ +/* + driver-test.c - This program tests V4L2 kernel drivers + + Copyright (C) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + */ + +#include "../lib/v4l2_driver.h" +#include <stdio.h> + +int main(void) +{ + struct v4l2_driver drv; + struct drv_list *cur; + + if (v4l2_open ("/dev/video0", 1,&drv)<0) { + perror("open"); + return -1; + } + if (v4l2_enum_stds (&drv)<0) { + perror("enum_stds"); + } + + /* Tries all video standards */ + for (cur=drv.stds;cur!=NULL;cur=cur->next) { + v4l2_std_id id=((struct v4l2_standard *)cur->curr)->id; + if (cur->curr) + if (v4l2_setget_std (&drv, V4L2_SET_GET, &id)) + perror("set_std"); + } + + if (v4l2_enum_input (&drv)<0) { + perror("enum_input"); + } + + /* Tries all video inputs */ + for (cur=drv.inputs;cur!=NULL;cur=cur->next) { + struct v4l2_input input; + input.index=((struct v4l2_input* )cur->curr)->index; + if (cur->curr) + if (v4l2_setget_input (&drv, V4L2_SET_GET, &input)) + perror("set_input"); + } + + if (v4l2_enum_fmt (&drv,V4L2_BUF_TYPE_VIDEO_CAPTURE)<0) { + perror("enum_fmt_cap"); + } + + /* Tries all formats */ + for (cur=drv.fmt_caps;cur!=NULL;cur=cur->next) { + struct v4l2_format fmt; + uint32_t pixelformat=((struct v4l2_fmtdesc *)cur->curr)->pixelformat; + if (cur->curr) { + if (v4l2_gettryset_fmt_cap (&drv,V4L2_SET,&fmt, 640, 480, + pixelformat,V4L2_FIELD_ANY)) + perror("set_input"); + } + } + + if (v4l2_get_parm (&drv)<0) { + perror("get_parm"); + } + + v4l2_mmap_bufs(&drv, 2); + + if (v4l2_close (&drv)<0) { + perror("close"); + return -1; + } + return 0; +} diff --git a/v4l2-apps/test/ioctl-test.c b/v4l2-apps/test/ioctl-test.c index 6d78ad0f8..f483338fb 100644 --- a/v4l2-apps/test/ioctl-test.c +++ b/v4l2-apps/test/ioctl-test.c @@ -51,8 +51,9 @@ typedef u_int32_t u32; /* All possible parameters used on v4l ioctls */ union v4l_parms { int i; - unsigned long l; - u32 u_32; + unsigned long u64; + u32 u32; + v4l2_std_id id; #ifdef CONFIG_VIDEO_V4L1_COMPAT /* V4L1 structs */ @@ -148,10 +149,12 @@ int ioctls[] = { VIDIOC_ENUMAUDOUT,/* struct v4l2_audioout */ VIDIOC_ENUM_FMT,/* struct v4l2_fmtdesc */ VIDIOC_ENUMINPUT,/* struct v4l2_input */ + VIDIOC_G_INPUT,/* int */ + VIDIOC_S_INPUT,/* int */ VIDIOC_ENUMOUTPUT,/* struct v4l2_output */ VIDIOC_ENUMSTD,/* struct v4l2_standard */ -// VIDIOC_G_AUDIO_OLD,/* struct v4l2_audio */ -// VIDIOC_G_AUDOUT_OLD,/* struct v4l2_audioout */ + VIDIOC_G_STD, /*v4l2_std_id */ + VIDIOC_S_STD, /*v4l2_std_id */ VIDIOC_G_CROP,/* struct v4l2_crop */ VIDIOC_G_CTRL,/* struct v4l2_control */ VIDIOC_G_FMT,/* struct v4l2_format */ @@ -159,7 +162,6 @@ int ioctls[] = { VIDIOC_G_MODULATOR,/* struct v4l2_modulator */ VIDIOC_G_PARM,/* struct v4l2_streamparm */ VIDIOC_G_TUNER,/* struct v4l2_tuner */ -// VIDIOC_OVERLAY_OLD,/* int */ VIDIOC_QBUF,/* struct v4l2_buffer */ VIDIOC_QUERYBUF,/* struct v4l2_buffer */ VIDIOC_QUERYCTRL,/* struct v4l2_queryctrl */ @@ -172,6 +174,12 @@ int ioctls[] = { VIDIOC_S_PARM,/* struct v4l2_streamparm */ VIDIOC_TRY_FMT,/* struct v4l2_format */ +#if 0 + VIDIOC_G_AUDIO_OLD,/* struct v4l2_audio */ + VIDIOC_G_AUDOUT_OLD,/* struct v4l2_audioout */ + VIDIOC_OVERLAY_OLD,/* int */ +#endif + #ifdef INTERNAL /* V4L2 internal ioctls */ AUDC_SET_RADIO,/* no args */ @@ -201,6 +209,7 @@ int ioctls[] = { #define S_IOCTLS sizeof(ioctls)/sizeof(ioctls[0]) /********************************************************************/ + int main (void) { int fd=0, ret=0; |