aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-01-19 04:23:26 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-01-21 18:08:03 -0500
commit42639f6de69433cd531c79390fd8eccf311ed44e (patch)
tree4d9189e1c961f4f8b08730b7f421172ccac441af
parent6cf11ee6300f38b7cfc43af9b7be2afaa5e05869 (diff)
[media] pvrusb2: fix missing device_caps in querycap
The VIDIOC_QUERYCAP function should set device_caps, but this was missing. In addition, it set the version field as well, but that should be done by the core, not by the driver. If a driver doesn't set device_caps the v4l2 core will issue a WARN_ON, so it's important that this is set correctly. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-v4l2.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
index 1b158f1167ed..536210b39428 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
@@ -89,16 +89,6 @@ static int vbi_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1};
89module_param_array(vbi_nr, int, NULL, 0444); 89module_param_array(vbi_nr, int, NULL, 0444);
90MODULE_PARM_DESC(vbi_nr, "Offset for device's vbi dev minor"); 90MODULE_PARM_DESC(vbi_nr, "Offset for device's vbi dev minor");
91 91
92static struct v4l2_capability pvr_capability ={
93 .driver = "pvrusb2",
94 .card = "Hauppauge WinTV pvr-usb2",
95 .bus_info = "usb",
96 .version = LINUX_VERSION_CODE,
97 .capabilities = (V4L2_CAP_VIDEO_CAPTURE |
98 V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_RADIO |
99 V4L2_CAP_READWRITE),
100};
101
102static struct v4l2_fmtdesc pvr_fmtdesc [] = { 92static struct v4l2_fmtdesc pvr_fmtdesc [] = {
103 { 93 {
104 .index = 0, 94 .index = 0,
@@ -160,10 +150,22 @@ static int pvr2_querycap(struct file *file, void *priv, struct v4l2_capability *
160 struct pvr2_v4l2_fh *fh = file->private_data; 150 struct pvr2_v4l2_fh *fh = file->private_data;
161 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; 151 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
162 152
163 memcpy(cap, &pvr_capability, sizeof(struct v4l2_capability)); 153 strlcpy(cap->driver, "pvrusb2", sizeof(cap->driver));
164 strlcpy(cap->bus_info, pvr2_hdw_get_bus_info(hdw), 154 strlcpy(cap->bus_info, pvr2_hdw_get_bus_info(hdw),
165 sizeof(cap->bus_info)); 155 sizeof(cap->bus_info));
166 strlcpy(cap->card, pvr2_hdw_get_desc(hdw), sizeof(cap->card)); 156 strlcpy(cap->card, pvr2_hdw_get_desc(hdw), sizeof(cap->card));
157 cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER |
158 V4L2_CAP_AUDIO | V4L2_CAP_RADIO |
159 V4L2_CAP_READWRITE | V4L2_CAP_DEVICE_CAPS;
160 switch (fh->pdi->devbase.vfl_type) {
161 case VFL_TYPE_GRABBER:
162 cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_AUDIO;
163 break;
164 case VFL_TYPE_RADIO:
165 cap->device_caps = V4L2_CAP_RADIO;
166 break;
167 }
168 cap->device_caps |= V4L2_CAP_TUNER | V4L2_CAP_READWRITE;
167 return 0; 169 return 0;
168} 170}
169 171