aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-08-04 18:52:37 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 11:18:31 -0400
commit6c428b578b15a1dbf40832d3aeed43761940b81f (patch)
treeb0d8e964c8beb33a688daefe77cfcb90e27e4ee9 /drivers/media/video/em28xx/em28xx-video.c
parent00c1e2167e3163d2e193644b7d768f06d2a8c279 (diff)
V4L/DVB (12376): em28xx: fix V4L2 API compliance: don't expose audio inputs for devices without it
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>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 477b9b67eaeb..f3ee001f21ca 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1005,6 +1005,9 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
1005 struct em28xx_fh *fh = priv; 1005 struct em28xx_fh *fh = priv;
1006 struct em28xx *dev = fh->dev; 1006 struct em28xx *dev = fh->dev;
1007 1007
1008 if (!dev->audio_mode.has_audio)
1009 return -EINVAL;
1010
1008 switch (a->index) { 1011 switch (a->index) {
1009 case EM28XX_AMUX_VIDEO: 1012 case EM28XX_AMUX_VIDEO:
1010 strcpy(a->name, "Television"); 1013 strcpy(a->name, "Television");
@@ -1046,6 +1049,9 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a)
1046 struct em28xx *dev = fh->dev; 1049 struct em28xx *dev = fh->dev;
1047 1050
1048 1051
1052 if (!dev->audio_mode.has_audio)
1053 return -EINVAL;
1054
1049 if (a->index >= MAX_EM28XX_INPUT) 1055 if (a->index >= MAX_EM28XX_INPUT)
1050 return -EINVAL; 1056 return -EINVAL;
1051 if (0 == INPUT(a->index)->type) 1057 if (0 == INPUT(a->index)->type)
@@ -1464,9 +1470,11 @@ static int vidioc_querycap(struct file *file, void *priv,
1464 cap->capabilities = 1470 cap->capabilities =
1465 V4L2_CAP_SLICED_VBI_CAPTURE | 1471 V4L2_CAP_SLICED_VBI_CAPTURE |
1466 V4L2_CAP_VIDEO_CAPTURE | 1472 V4L2_CAP_VIDEO_CAPTURE |
1467 V4L2_CAP_AUDIO |
1468 V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; 1473 V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
1469 1474
1475 if (dev->audio_mode.has_audio)
1476 cap->capabilities |= V4L2_CAP_AUDIO;
1477
1470 if (dev->tuner_type != TUNER_ABSENT) 1478 if (dev->tuner_type != TUNER_ABSENT)
1471 cap->capabilities |= V4L2_CAP_TUNER; 1479 cap->capabilities |= V4L2_CAP_TUNER;
1472 1480