[PATCH] V4L: Fix bttv ioctls VIDIOC_ENUMINPUT, VIDIOCGTUNER, VIDIOC_QUERYCAP
authorMichael H. Schimek <mschimek@gmx.at>
Thu, 1 Dec 2005 08:51:40 +0000 (00:51 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 1 Dec 2005 23:48:58 +0000 (15:48 -0800)
Fixed bttv ioctls VIDIOC_ENUMINPUT, VIDIOCGTUNER, VIDIOC_QUERYCAP.

Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Michael H. Schimek <mschimek@gmx.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/media/video/bttv-driver.c

index 6fcc20d..3c58a2a 100644 (file)
@@ -1720,7 +1720,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
                memset(i,0,sizeof(*i));
                i->index    = n;
                i->type     = V4L2_INPUT_TYPE_CAMERA;
-               i->audioset = 1;
+               i->audioset = 0;
                if (i->index == bttv_tvcards[btv->c.type].tuner) {
                        sprintf(i->name, "Television");
                        i->type  = V4L2_INPUT_TYPE_TUNER;
@@ -1771,12 +1771,20 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
                memset(t,0,sizeof(*t));
                strcpy(t->name, "Television");
                t->type       = V4L2_TUNER_ANALOG_TV;
-               t->rangehigh  = 0xffffffffUL;
                t->capability = V4L2_TUNER_CAP_NORM;
                t->rxsubchans = V4L2_TUNER_SUB_MONO;
                if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC)
                        t->signal = 0xffff;
                {
+                       struct video_tuner tuner;
+
+                       memset(&tuner, 0, sizeof (tuner));
+                       tuner.rangehigh = 0xffffffffUL;
+                       bttv_call_i2c_clients(btv, VIDIOCGTUNER, &tuner);
+                       t->rangelow = tuner.rangelow;
+                       t->rangehigh = tuner.rangehigh;
+               }
+               {
                        /* Hmmm ... */
                        struct video_audio va;
                        memset(&va, 0, sizeof(struct video_audio));
@@ -2610,9 +2618,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
 
                if (0 == v4l2)
                        return -EINVAL;
-               strcpy(cap->driver,"bttv");
-               strlcpy(cap->card,btv->video_dev->name,sizeof(cap->card));
-               sprintf(cap->bus_info,"PCI:%s",pci_name(btv->c.pci));
+               memset(cap, 0, sizeof (*cap));
+               strlcpy(cap->driver, "bttv", sizeof (cap->driver));
+               strlcpy(cap->card, btv->video_dev->name, sizeof (cap->card));
+               snprintf(cap->bus_info, sizeof (cap->bus_info),
+                        "PCI:%s", pci_name(btv->c.pci));
                cap->version = BTTV_VERSION_CODE;
                cap->capabilities =
                        V4L2_CAP_VIDEO_CAPTURE |