aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r--drivers/media/video/gspca/gspca.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 16e367cec760..3a051c925ff6 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -32,6 +32,7 @@
32#include <asm/page.h> 32#include <asm/page.h>
33#include <linux/uaccess.h> 33#include <linux/uaccess.h>
34#include <linux/jiffies.h> 34#include <linux/jiffies.h>
35#include <media/v4l2-ioctl.h>
35 36
36#include "gspca.h" 37#include "gspca.h"
37 38
@@ -42,8 +43,7 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
42MODULE_DESCRIPTION("GSPCA USB Camera Driver"); 43MODULE_DESCRIPTION("GSPCA USB Camera Driver");
43MODULE_LICENSE("GPL"); 44MODULE_LICENSE("GPL");
44 45
45#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) 46#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 2, 0)
46static const char version[] = "2.1.7";
47 47
48static int video_nr = -1; 48static int video_nr = -1;
49 49
@@ -209,6 +209,8 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
209 &frame->v4l2_buf.timestamp); 209 &frame->v4l2_buf.timestamp);
210 frame->v4l2_buf.sequence = ++gspca_dev->sequence; 210 frame->v4l2_buf.sequence = ++gspca_dev->sequence;
211 } else if (gspca_dev->last_packet_type == DISCARD_PACKET) { 211 } else if (gspca_dev->last_packet_type == DISCARD_PACKET) {
212 if (packet_type == LAST_PACKET)
213 gspca_dev->last_packet_type = packet_type;
212 return frame; 214 return frame;
213 } 215 }
214 216
@@ -399,7 +401,7 @@ static struct usb_host_endpoint *alt_isoc(struct usb_host_interface *alt,
399 * This routine may be called many times when the bandwidth is too small 401 * This routine may be called many times when the bandwidth is too small
400 * (the bandwidth is checked on urb submit). 402 * (the bandwidth is checked on urb submit).
401 */ 403 */
402struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev) 404static struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev)
403{ 405{
404 struct usb_interface *intf; 406 struct usb_interface *intf;
405 struct usb_host_endpoint *ep; 407 struct usb_host_endpoint *ep;
@@ -832,7 +834,16 @@ static int vidioc_querycap(struct file *file, void *priv,
832 834
833 memset(cap, 0, sizeof *cap); 835 memset(cap, 0, sizeof *cap);
834 strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver); 836 strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver);
835 strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card); 837/* strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card); */
838 if (gspca_dev->dev->product != NULL) {
839 strncpy(cap->card, gspca_dev->dev->product,
840 sizeof cap->card);
841 } else {
842 snprintf(cap->card, sizeof cap->card,
843 "USB Camera (%04x:%04x)",
844 le16_to_cpu(gspca_dev->dev->descriptor.idVendor),
845 le16_to_cpu(gspca_dev->dev->descriptor.idProduct));
846 }
836 strncpy(cap->bus_info, gspca_dev->dev->bus->bus_name, 847 strncpy(cap->bus_info, gspca_dev->dev->bus->bus_name,
837 sizeof cap->bus_info); 848 sizeof cap->bus_info);
838 cap->version = DRIVER_VERSION_NUMBER; 849 cap->version = DRIVER_VERSION_NUMBER;
@@ -1649,12 +1660,7 @@ static struct file_operations dev_fops = {
1649 .poll = dev_poll, 1660 .poll = dev_poll,
1650}; 1661};
1651 1662
1652static struct video_device gspca_template = { 1663static const struct v4l2_ioctl_ops dev_ioctl_ops = {
1653 .name = "gspca main driver",
1654 .type = VID_TYPE_CAPTURE,
1655 .fops = &dev_fops,
1656 .release = dev_release, /* mandatory */
1657 .minor = -1,
1658 .vidioc_querycap = vidioc_querycap, 1664 .vidioc_querycap = vidioc_querycap,
1659 .vidioc_dqbuf = vidioc_dqbuf, 1665 .vidioc_dqbuf = vidioc_dqbuf,
1660 .vidioc_qbuf = vidioc_qbuf, 1666 .vidioc_qbuf = vidioc_qbuf,
@@ -1683,6 +1689,14 @@ static struct video_device gspca_template = {
1683#endif 1689#endif
1684}; 1690};
1685 1691
1692static struct video_device gspca_template = {
1693 .name = "gspca main driver",
1694 .fops = &dev_fops,
1695 .ioctl_ops = &dev_ioctl_ops,
1696 .release = dev_release, /* mandatory */
1697 .minor = -1,
1698};
1699
1686/* 1700/*
1687 * probe and create a new gspca device 1701 * probe and create a new gspca device
1688 * 1702 *
@@ -1740,10 +1754,11 @@ int gspca_dev_probe(struct usb_interface *intf,
1740 1754
1741 /* init video stuff */ 1755 /* init video stuff */
1742 memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template); 1756 memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template);
1743 gspca_dev->vdev.dev = &dev->dev; 1757 gspca_dev->vdev.parent = &dev->dev;
1744 memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops); 1758 memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops);
1745 gspca_dev->vdev.fops = &gspca_dev->fops; 1759 gspca_dev->vdev.fops = &gspca_dev->fops;
1746 gspca_dev->fops.owner = module; /* module protection */ 1760 gspca_dev->fops.owner = module; /* module protection */
1761 gspca_dev->present = 1;
1747 ret = video_register_device(&gspca_dev->vdev, 1762 ret = video_register_device(&gspca_dev->vdev,
1748 VFL_TYPE_GRABBER, 1763 VFL_TYPE_GRABBER,
1749 video_nr); 1764 video_nr);
@@ -1752,7 +1767,6 @@ int gspca_dev_probe(struct usb_interface *intf,
1752 goto out; 1767 goto out;
1753 } 1768 }
1754 1769
1755 gspca_dev->present = 1;
1756 usb_set_intfdata(intf, gspca_dev); 1770 usb_set_intfdata(intf, gspca_dev);
1757 PDEBUG(D_PROBE, "probe ok"); 1771 PDEBUG(D_PROBE, "probe ok");
1758 return 0; 1772 return 0;
@@ -1885,7 +1899,10 @@ EXPORT_SYMBOL(gspca_auto_gain_n_exposure);
1885/* -- module insert / remove -- */ 1899/* -- module insert / remove -- */
1886static int __init gspca_init(void) 1900static int __init gspca_init(void)
1887{ 1901{
1888 info("main v%s registered", version); 1902 info("main v%d.%d.%d registered",
1903 (DRIVER_VERSION_NUMBER >> 16) & 0xff,
1904 (DRIVER_VERSION_NUMBER >> 8) & 0xff,
1905 DRIVER_VERSION_NUMBER & 0xff);
1889 return 0; 1906 return 0;
1890} 1907}
1891static void __exit gspca_exit(void) 1908static void __exit gspca_exit(void)