summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-08-04 19:52:37 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-08-04 19:52:37 -0300
commit33a9a00f41338f5ab7589a2611da979c87b884ce (patch)
tree665f8712c699a4cda9548288d0ebb630f0d35720
parent0a6ce90779f4a12f8e75009d19209a4ee48707d8 (diff)
downloadmediapointer-dvb-s2-33a9a00f41338f5ab7589a2611da979c87b884ce.tar.gz
mediapointer-dvb-s2-33a9a00f41338f5ab7589a2611da979c87b884ce.tar.bz2
em28xx: fix V4L2 API compliance: don't expose audio inputs for devices without it
From: Mauro Carvalho Chehab <mchehab@redhat.com> V4L2 API (chapter 1.5) states that: Drivers must implement all input ioctls when the device has one or more inputs, all output ioctls when the device has one or more outputs. When the device has any audio inputs or outputs the driver must set the V4L2_CAP_AUDIO flag in the struct v4l2_capability returned by the VIDIOC_QUERYCAP ioctl. So, devices without audio input should return -EINVAL. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-video.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c
index fcb99fb71..258cd38ce 100644
--- a/linux/drivers/media/video/em28xx/em28xx-video.c
+++ b/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -976,6 +976,9 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev;
+ if (!dev->audio_mode.has_audio)
+ return -EINVAL;
+
switch (a->index) {
case EM28XX_AMUX_VIDEO:
strcpy(a->name, "Television");
@@ -1022,6 +1025,9 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a)
return -EINVAL;
#else
+ if (!dev->audio_mode.has_audio)
+ return -EINVAL;
+
if (a->index >= MAX_EM28XX_INPUT)
return -EINVAL;
if (0 == INPUT(a->index)->type)
@@ -1444,9 +1450,11 @@ static int vidioc_querycap(struct file *file, void *priv,
#endif
V4L2_CAP_SLICED_VBI_CAPTURE |
V4L2_CAP_VIDEO_CAPTURE |
- V4L2_CAP_AUDIO |
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
+ if (dev->audio_mode.has_audio)
+ cap->capabilities |= V4L2_CAP_AUDIO;
+
if (dev->tuner_type != TUNER_ABSENT)
cap->capabilities |= V4L2_CAP_TUNER;