aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2010-06-05 06:47:36 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 13:44:56 -0400
commit4462864d723fcae990bde5621a19a8dce9231cfa (patch)
treedb1206e581c5706592c903220d6edfa4e2704c99 /drivers/media/video/gspca/gspca.c
parent618a864ee7b720aa3560796e0dfad0e674366e60 (diff)
V4L/DVB: gspca - main: Function gspca_dev_probe2 added
This function is used when the USB video interface is checked by the subdriver. Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r--drivers/media/video/gspca/gspca.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 678675bb3652..b7a5655cfd55 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -2253,31 +2253,18 @@ static struct video_device gspca_template = {
2253 * This function must be called by the sub-driver when it is 2253 * This function must be called by the sub-driver when it is
2254 * called for probing a new device. 2254 * called for probing a new device.
2255 */ 2255 */
2256int gspca_dev_probe(struct usb_interface *intf, 2256int gspca_dev_probe2(struct usb_interface *intf,
2257 const struct usb_device_id *id, 2257 const struct usb_device_id *id,
2258 const struct sd_desc *sd_desc, 2258 const struct sd_desc *sd_desc,
2259 int dev_size, 2259 int dev_size,
2260 struct module *module) 2260 struct module *module)
2261{ 2261{
2262 struct usb_interface_descriptor *interface;
2263 struct gspca_dev *gspca_dev; 2262 struct gspca_dev *gspca_dev;
2264 struct usb_device *dev = interface_to_usbdev(intf); 2263 struct usb_device *dev = interface_to_usbdev(intf);
2265 int ret; 2264 int ret;
2266 2265
2267 PDEBUG(D_PROBE, "probing %04x:%04x", id->idVendor, id->idProduct); 2266 PDEBUG(D_PROBE, "probing %04x:%04x", id->idVendor, id->idProduct);
2268 2267
2269 /* we don't handle multi-config cameras */
2270 if (dev->descriptor.bNumConfigurations != 1) {
2271 PDEBUG(D_ERR, "Too many config");
2272 return -ENODEV;
2273 }
2274
2275 /* the USB video interface must be the first one */
2276 interface = &intf->cur_altsetting->desc;
2277 if (dev->config->desc.bNumInterfaces != 1 &&
2278 interface->bInterfaceNumber != 0)
2279 return -ENODEV;
2280
2281 /* create the device */ 2268 /* create the device */
2282 if (dev_size < sizeof *gspca_dev) 2269 if (dev_size < sizeof *gspca_dev)
2283 dev_size = sizeof *gspca_dev; 2270 dev_size = sizeof *gspca_dev;
@@ -2293,7 +2280,7 @@ int gspca_dev_probe(struct usb_interface *intf,
2293 goto out; 2280 goto out;
2294 } 2281 }
2295 gspca_dev->dev = dev; 2282 gspca_dev->dev = dev;
2296 gspca_dev->iface = interface->bInterfaceNumber; 2283 gspca_dev->iface = intf->cur_altsetting->desc.bInterfaceNumber;
2297 gspca_dev->nbalt = intf->num_altsetting; 2284 gspca_dev->nbalt = intf->num_altsetting;
2298 gspca_dev->sd_desc = sd_desc; 2285 gspca_dev->sd_desc = sd_desc;
2299 gspca_dev->nbufread = 2; 2286 gspca_dev->nbufread = 2;
@@ -2345,6 +2332,35 @@ out:
2345 kfree(gspca_dev); 2332 kfree(gspca_dev);
2346 return ret; 2333 return ret;
2347} 2334}
2335EXPORT_SYMBOL(gspca_dev_probe2);
2336
2337/* same function as the previous one, but check the interface */
2338int gspca_dev_probe(struct usb_interface *intf,
2339 const struct usb_device_id *id,
2340 const struct sd_desc *sd_desc,
2341 int dev_size,
2342 struct module *module)
2343{
2344 struct usb_device *dev = interface_to_usbdev(intf);
2345
2346 /* we don't handle multi-config cameras */
2347 if (dev->descriptor.bNumConfigurations != 1) {
2348 PDEBUG(D_ERR, "%04x:%04x too many config",
2349 id->idVendor, id->idProduct);
2350 return -ENODEV;
2351 }
2352
2353 /* the USB video interface must be the first one */
2354 if (dev->config->desc.bNumInterfaces != 1
2355 && intf->cur_altsetting->desc.bInterfaceNumber != 0) {
2356 PDEBUG(D_ERR, "%04x:%04x bad interface %d",
2357 id->idVendor, id->idProduct,
2358 intf->cur_altsetting->desc.bInterfaceNumber);
2359 return -ENODEV;
2360 }
2361
2362 return gspca_dev_probe2(intf, id, sd_desc, dev_size, module);
2363}
2348EXPORT_SYMBOL(gspca_dev_probe); 2364EXPORT_SYMBOL(gspca_dev_probe);
2349 2365
2350/* 2366/*