* [PATCH] gspca: add g_std/s_std methods
@ 2009-08-09 20:13 Olaf Titz
2009-08-11 17:42 ` Jean-Francois Moine
0 siblings, 1 reply; 3+ messages in thread
From: Olaf Titz @ 2009-08-09 20:13 UTC (permalink / raw)
To: moinejf; +Cc: linux-media
Some applications are unhappy about getting EINVAL errors for query/set
TV standard operations, especially (or only?) when working over the
v4l1compat.so bridge. This patch adds the appropriate methods to the
gspca driver (claim to support all TV modes, setting TV mode does nothing).
Signed-off-by: Olaf Titz <olaf@bigred.inka.de>
--- a/linux/drivers/media/video/gspca/gspca.c Sat Aug 08 03:28:41 2009
-0300
+++ b/linux/drivers/media/video/gspca/gspca.c Sun Aug 09 22:00:03 2009
+0200
@@ -1249,6 +1249,7 @@
if (input->index != 0)
return -EINVAL;
input->type = V4L2_INPUT_TYPE_CAMERA;
+ input->std = V4L2_STD_ALL;
input->status = gspca_dev->cam.input_flags;
strncpy(input->name, gspca_dev->sd_desc->name,
sizeof input->name);
@@ -1624,6 +1625,17 @@
return ret;
}
+static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
+{
+ *norm = V4L2_STD_UNKNOWN;
+ return 0;
+}
+
+static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
+{
+ return 0;
+}
+
/*
* wait for a video frame
*
@@ -1958,6 +1970,8 @@
.vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
.vidioc_streamon = vidioc_streamon,
.vidioc_queryctrl = vidioc_queryctrl,
+ .vidioc_g_std = vidioc_g_std,
+ .vidioc_s_std = vidioc_s_std,
.vidioc_g_ctrl = vidioc_g_ctrl,
.vidioc_s_ctrl = vidioc_s_ctrl,
.vidioc_g_audio = vidioc_g_audio,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gspca: add g_std/s_std methods
2009-08-09 20:13 [PATCH] gspca: add g_std/s_std methods Olaf Titz
@ 2009-08-11 17:42 ` Jean-Francois Moine
2009-08-11 18:41 ` Olaf Titz
0 siblings, 1 reply; 3+ messages in thread
From: Jean-Francois Moine @ 2009-08-11 17:42 UTC (permalink / raw)
To: Olaf Titz; +Cc: linux-media
On Sun, 09 Aug 2009 22:13:12 +0200
Olaf Titz <Olaf.Titz@inka.de> wrote:
> Some applications are unhappy about getting EINVAL errors for
> query/set TV standard operations, especially (or only?) when working
> over the v4l1compat.so bridge. This patch adds the appropriate
> methods to the gspca driver (claim to support all TV modes, setting
> TV mode does nothing).
The vidioc_s_std() has been removed last month by Németh Márton
according to the v4l2 API http://v4l2spec.bytesex.org/spec/x448.htm
--
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef | http://moinejf.free.fr/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gspca: add g_std/s_std methods
2009-08-11 17:42 ` Jean-Francois Moine
@ 2009-08-11 18:41 ` Olaf Titz
0 siblings, 0 replies; 3+ messages in thread
From: Olaf Titz @ 2009-08-11 18:41 UTC (permalink / raw)
To: Jean-Francois Moine; +Cc: linux-media
Jean-Francois Moine wrote:
> The vidioc_s_std() has been removed last month by Németh Márton
> according to the v4l2 API http://v4l2spec.bytesex.org/spec/x448.htm
Ah, I see. This is a recent change, which explains why it has not come
up earlier :-)
The standard clearly states that my change is incorrect, but then
v4l1-compat.c is wrong in how it implements v4l_compat_get_input_info()
and v4l1_compat_set_input(). These calls query rsp. set video input and
standard in one call, and there is no special provision for webcams in
http://v4l2spec.bytesex.org/spec/x309.htm, so these calls should not
fail. IOW, something like this would be in order instead (untested):
--- a/linux/drivers/media/video/v4l1-compat.c Sat Aug 08 03:28:41 2009
-0300
+++ b/linux/drivers/media/video/v4l1-compat.c Tue Aug 11 20:30:47 2009
+0200
@@ -540,7 +540,7 @@
{
long err;
struct v4l2_input input2;
- v4l2_std_id sid;
+ v4l2_std_id sid = V4L2_STD_UNKNOWN;
memset(&input2, 0, sizeof(input2));
input2.index = chan->channel;
@@ -566,19 +566,21 @@
break;
}
chan->norm = 0;
- err = drv(file, VIDIOC_G_STD, &sid);
- if (err < 0)
- dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %ld\n", err);
- if (err == 0) {
- if (sid & V4L2_STD_PAL)
- chan->norm = VIDEO_MODE_PAL;
- if (sid & V4L2_STD_NTSC)
- chan->norm = VIDEO_MODE_NTSC;
- if (sid & V4L2_STD_SECAM)
- chan->norm = VIDEO_MODE_SECAM;
- if (sid == V4L2_STD_ALL)
- chan->norm = VIDEO_MODE_AUTO;
- }
+ {
+ int err2 = drv(file, VIDIOC_G_STD, &sid);
+ if (err2 < 0)
+ dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %ld\n", err2);
+ if (err2 == 0) {
+ if (sid & V4L2_STD_PAL)
+ chan->norm = VIDEO_MODE_PAL;
+ if (sid & V4L2_STD_NTSC)
+ chan->norm = VIDEO_MODE_NTSC;
+ if (sid & V4L2_STD_SECAM)
+ chan->norm = VIDEO_MODE_SECAM;
+ if (sid == V4L2_STD_ALL)
+ chan->norm = VIDEO_MODE_AUTO;
+ }
+ }
done:
return err;
}
@@ -609,9 +611,9 @@
break;
}
if (0 != sid) {
- err = drv(file, VIDIOC_S_STD, &sid);
- if (err < 0)
- dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %ld\n", err);
+ int err2 = drv(file, VIDIOC_S_STD, &sid);
+ if (err2 < 0)
+ dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %ld\n", err2);
}
return err;
}
I'm not sure if v4l1_compat_get_tuner() needs this kind of change too.
We also should keep the input->std = V4L2_STD_ALL; because an
application may bomb with something like "Invalid standard PAL, valid
choices are:" (empty). This (and the EINVAL) breaks at least ekiga 2
with the v4l1 module (which is what Ubuntu has) run over
libv4l1compat.so. (Ekiga 3 with the v4l2 module does work.) It also
breaks xawtv, the canonical v4l test app...
Olaf
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-11 18:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-09 20:13 [PATCH] gspca: add g_std/s_std methods Olaf Titz
2009-08-11 17:42 ` Jean-Francois Moine
2009-08-11 18:41 ` Olaf Titz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox