On Tue, Dec 02, 2008 at 00:04:37 +1100, Rob wrote:
> Hi All
>
> I was wondering if anyone knew of a way to load the uvcvideo driver so as to
> pick a different device other than /dev/video0 (say /dev/video1).
linux-uvc calls video_register_device() without a third argument (-1),
and thereby leaves it up to the system to determine the device node.
I am told that the correct way to do this nowadays is in your udev
configuration. However I haven't quickly found any instruction how to
do this. I'd be happy if someone follows up on this list.
On the other hand, I once wrote a patch to add your desired behavior to
linux-uvc, with the parameter "dev_req". You find it attached. Feel
free to build your module(s) with this patch if it's of any help to
you. :-) Note that the "/dev/video" references are of course
assumptions and possibly incorrect, only the device node (number) is
determined, not the actual device's filename.
Moritz
diff -ur linux-uvc-trunk-r205/uvc_driver.c
linux-uvc-trunk-r205-device_request/uvc_driver.c
--- linux-uvc-trunk-r205/uvc_driver.c 2008-04-27 23:10:01.000000000 +0200
+++ linux-uvc-trunk-r205-device_request/uvc_driver.c 2008-04-27
23:13:52.000000000 +0200
@@ -47,6 +47,7 @@
#endif
static unsigned int uvc_quirks_param;
+static unsigned int uvc_dev_req_param = -1;
unsigned int uvc_trace_param;
/* ------------------------------------------------------------------------
@@ -1464,11 +1465,16 @@
dev->video.vdev = vdev;
video_set_drvdata(vdev, &dev->video);
- if (video_register_device(vdev, VFL_TYPE_GRABBER, -1) < 0) {
+ if (uvc_dev_req_param != -1) {
+ uvc_printk(KERN_INFO, "Explicitly requesting device node %d
(/dev/video%d).\n", uvc_dev_req_param, uvc_dev_req_param);
+ }
+
+ if (video_register_device(vdev, VFL_TYPE_GRABBER, uvc_dev_req_param) <
0) {
dev->video.vdev = NULL;
video_device_release(vdev);
return -1;
}
+ uvc_printk(KERN_INFO, "Registered as device node %d (/dev/video%d).\n",
vdev->minor & 0x3F, vdev->minor & 0x3F);
return 0;
}
@@ -1914,6 +1920,7 @@
static void __exit uvc_cleanup(void)
{
usb_deregister(&uvc_driver.driver);
+ uvc_printk(KERN_INFO, "Deregistered driver.\n");
}
module_init(uvc_init);
@@ -1923,6 +1930,8 @@
MODULE_PARM_DESC(quirks, "Forced device quirks");
module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(trace, "Trace level bitmask");
+module_param_named(dev_req, uvc_dev_req_param, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(dev_req, "Request device node X (/dev/videoX) instead of
automatic");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel