diff mbox

[RFC,08/18] tlg2300: fix radio querycap

Message ID e745ec830817f4eab48445b0e205a7b568a0e2b0.1359627298.git.hans.verkuil@cisco.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hans Verkuil Jan. 31, 2013, 10:25 a.m. UTC
From: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/usb/tlg2300/pd-radio.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Huang Shijie Feb. 4, 2013, 4:36 a.m. UTC | #1
? 2013?01?31? 05:25, Hans Verkuil ??:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
>  drivers/media/usb/tlg2300/pd-radio.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/tlg2300/pd-radio.c b/drivers/media/usb/tlg2300/pd-radio.c
> index 854ffa0..80307d3 100644
> --- a/drivers/media/usb/tlg2300/pd-radio.c
> +++ b/drivers/media/usb/tlg2300/pd-radio.c
> @@ -147,7 +147,12 @@ static int vidioc_querycap(struct file *file, void *priv,
>  	strlcpy(v->driver, "tele-radio", sizeof(v->driver));
>  	strlcpy(v->card, "Telegent Poseidon", sizeof(v->card));
>  	usb_make_path(p->udev, v->bus_info, sizeof(v->bus_info));
> -	v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
> +	v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
> +	/* Report all capabilities of the USB device */
> +	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS |
> +			V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
why add these video/vbi capabilities?

> +			V4L2_CAP_AUDIO | V4L2_CAP_STREAMING 
> +			V4L2_CAP_READWRITE;
>  	return 0;
>  }
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans Verkuil Feb. 4, 2013, 8:38 a.m. UTC | #2
On Mon February 4 2013 05:36:56 Huang Shijie wrote:
> ? 2013?01?31? 05:25, Hans Verkuil ??:
> > From: Hans Verkuil <hans.verkuil@cisco.com>
> >
> > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> > ---
> >  drivers/media/usb/tlg2300/pd-radio.c |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/usb/tlg2300/pd-radio.c b/drivers/media/usb/tlg2300/pd-radio.c
> > index 854ffa0..80307d3 100644
> > --- a/drivers/media/usb/tlg2300/pd-radio.c
> > +++ b/drivers/media/usb/tlg2300/pd-radio.c
> > @@ -147,7 +147,12 @@ static int vidioc_querycap(struct file *file, void *priv,
> >  	strlcpy(v->driver, "tele-radio", sizeof(v->driver));
> >  	strlcpy(v->card, "Telegent Poseidon", sizeof(v->card));
> >  	usb_make_path(p->udev, v->bus_info, sizeof(v->bus_info));
> > -	v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
> > +	v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
> > +	/* Report all capabilities of the USB device */
> > +	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS |
> > +			V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
> why add these video/vbi capabilities?

The capabilities field contains the V4L2 capabilities of the whole device
(i.e. radio+video+vbi), the device_caps field contains the capabilities of
just that node.

In the past different drivers interpreted the capabilities field differently:
either with the capabilities of the whole device or the capabilities of just
that device node. This situation was clarified recently and the device_caps
field was added instead so both the caps for the full device and the current
device node are now available.

This wasn't there when the tlg2300 driver was developed, and the spec was
never clear enough regarding the meaning of the capabilities field.

So this is a later improvement to the V4L2 API.

Regards,

	Hans

> 
> > +			V4L2_CAP_AUDIO | V4L2_CAP_STREAMING 
> > +			V4L2_CAP_READWRITE;
> >  	return 0;
> >  }
> >  
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Huang Shijie Feb. 5, 2013, 4:07 a.m. UTC | #3
? 2013?02?04? 03:38, Hans Verkuil ??:
> On Mon February 4 2013 05:36:56 Huang Shijie wrote:
>> ? 2013?01?31? 05:25, Hans Verkuil ??:
>>> From: Hans Verkuil<hans.verkuil@cisco.com>
>>>
>>> Signed-off-by: Hans Verkuil<hans.verkuil@cisco.com>
>>> ---
>>>   drivers/media/usb/tlg2300/pd-radio.c |    7 ++++++-
>>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/usb/tlg2300/pd-radio.c b/drivers/media/usb/tlg2300/pd-radio.c
>>> index 854ffa0..80307d3 100644
>>> --- a/drivers/media/usb/tlg2300/pd-radio.c
>>> +++ b/drivers/media/usb/tlg2300/pd-radio.c
>>> @@ -147,7 +147,12 @@ static int vidioc_querycap(struct file *file, void *priv,
>>>   	strlcpy(v->driver, "tele-radio", sizeof(v->driver));
>>>   	strlcpy(v->card, "Telegent Poseidon", sizeof(v->card));
>>>   	usb_make_path(p->udev, v->bus_info, sizeof(v->bus_info));
>>> -	v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
>>> +	v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
>>> +	/* Report all capabilities of the USB device */
>>> +	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS |
>>> +			V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
>> why add these video/vbi capabilities?
> The capabilities field contains the V4L2 capabilities of the whole device
> (i.e. radio+video+vbi), the device_caps field contains the capabilities of
> just that node.
>
> In the past different drivers interpreted the capabilities field differently:
> either with the capabilities of the whole device or the capabilities of just
> that device node. This situation was clarified recently and the device_caps
> field was added instead so both the caps for the full device and the current
> device node are now available.
>
> This wasn't there when the tlg2300 driver was developed, and the spec was
> never clear enough regarding the meaning of the capabilities field.
>
> So this is a later improvement to the V4L2 API.


thanks for the explanation.

Acked-by: Huang Shijie <shijie8@gmail.com>


> Regards,
>
> 	Hans
>
>>> +			V4L2_CAP_AUDIO | V4L2_CAP_STREAMING
>>> +			V4L2_CAP_READWRITE;
>>>   	return 0;
>>>   }
>>>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/usb/tlg2300/pd-radio.c b/drivers/media/usb/tlg2300/pd-radio.c
index 854ffa0..80307d3 100644
--- a/drivers/media/usb/tlg2300/pd-radio.c
+++ b/drivers/media/usb/tlg2300/pd-radio.c
@@ -147,7 +147,12 @@  static int vidioc_querycap(struct file *file, void *priv,
 	strlcpy(v->driver, "tele-radio", sizeof(v->driver));
 	strlcpy(v->card, "Telegent Poseidon", sizeof(v->card));
 	usb_make_path(p->udev, v->bus_info, sizeof(v->bus_info));
-	v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
+	v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
+	/* Report all capabilities of the USB device */
+	v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS |
+			V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
+			V4L2_CAP_AUDIO | V4L2_CAP_STREAMING |
+			V4L2_CAP_READWRITE;
 	return 0;
 }