[Linux-uvc-devel] backporting to the 2.6.8 kernel
Linux UVC driver and tools
Brought to you by:
pinchartl
|
From: Matthias H. <heu...@jh...> - 2006-03-13 23:41:20
|
Hi everybody!
I am trying to port the driver to the 2.6.8 kernel. This would be interesting
e. g. for people running Debian stable.
With the attached patch I can cleanly compile and insert the module.
Furthermore, the green light on the Quickcam 5000 Pro comes on as soon as I
start uvcview. Unfortunately all I can see is a solid green image.
I have to admit that my experience in C is only slightly better than my
knowledge of the kernel internals which is almost zero. Maybe somebody will
be able to give me a few hints as to where the problem might be.
Thanks,
Matthias
Index: uvcvideo.c
===================================================================
--- uvcvideo.c (revision 23)
+++ uvcvideo.c (working copy)
@@ -49,6 +49,11 @@
#define DRIVER_VERSION "0.1.0"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 0)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,8)
+ typedef __u16 __le16;
+ typedef __u32 __le32;
+#endif
+
#define UVC_CTRL_TIMEOUT 300
@@ -1995,7 +2000,11 @@
up(&video->queue.lock);
atomic_inc(&video->count);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
kref_put(&video->dev->kref, uvc_delete);
+#else
+ kref_put(&video->dev->kref);
+#endif
return 0;
}
@@ -2261,9 +2270,15 @@
page = vmalloc_to_page((void*)addr);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
SetPageReserved(page);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
if ((ret = remap_pfn_range(vma, start, page_to_pfn(page),
PAGE_SIZE, vma->vm_page_prot)) < 0)
#else
+ if ((ret = remap_page_range(vma, start, (vma->vm_pgoff <<
+ PAGE_SHIFT), PAGE_SIZE,
+ vma->vm_page_prot)) < 0)
+#endif
+#else
if ((ret = vm_insert_page(vma, start, page)) < 0)
#endif
goto done;
@@ -3267,7 +3282,11 @@
INIT_LIST_HEAD(&dev->terminals);
INIT_LIST_HEAD(&dev->units);
INIT_LIST_HEAD(&dev->streaming);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
kref_init(&dev->kref);
+#else
+ kref_init(&dev->kref, uvc_delete);
+#endif
dev->udev = usb_get_dev(udev);
dev->intf = intf;
@@ -3278,12 +3297,16 @@
uvc_trace(UVC_TRACE_PROBE, "Unable to parse UVC descriptors.\n");
goto error;
}
-
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
uvc_printk(KERN_INFO, "Found UVC %u.%02u device %s (%04x:%04x)\n",
dev->uvc_version >> 8, dev->uvc_version & 0xff,
udev->product ? udev->product : "<unnamed>",
udev->descriptor.idVendor, udev->descriptor.idProduct);
-
+#else
+ uvc_printk(KERN_INFO, "Found UVC %u.%02u device (%04x:%04x)\n",
+ dev->uvc_version >> 8, dev->uvc_version & 0xff,
+ udev->descriptor.idVendor, udev->descriptor.idProduct);
+#endif
/* Register the video devices */
uvc_register_video(dev);
@@ -3301,7 +3324,11 @@
return 0;
error:
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
kref_put(&dev->kref, uvc_delete);
+#else
+ kref_put(&dev->kref);
+#endif
return -ENODEV;
}
@@ -3330,7 +3357,11 @@
down(&dev_sem);
dev->state |= UVC_DEV_DISCONNECTED;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
kref_put(&dev->kref, uvc_delete);
+#else
+ kref_put(&dev->kref);
+#endif
up(&dev_sem);
}
|