diff options
author | brandon@ifup.org <brandon@ifup.org> | 2008-06-20 21:58:53 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:10:27 -0400 |
commit | 539a7555b31e65e66fb84c881d07d2bf18c974d0 (patch) | |
tree | 6986fc5c76388c2b07b15911eca0b52100d68f15 /include/media | |
parent | bbfc4c234e240b67ccd9cdca72d76267bad0dc96 (diff) |
V4L/DVB (8078): Introduce "index" attribute for persistent video4linux device nodes
A number of V4L drivers have a mod param to specify their preferred minors.
This is because it is often desirable for applications to have a static /dev
name for a particular device. However, using minors has several disadvantages:
1) the requested minor may already be taken
2) using a mod param is driver specific
3) it requires every driver to add a param
4) requires configuration by hand
This patch introduces an "index" attribute that when combined with udev rules
can create static device paths like this:
/dev/v4l/by-path/pci-0000\:00\:1d.2-usb-0\:1\:1.0-video0
/dev/v4l/by-path/pci-0000\:00\:1d.2-usb-0\:1\:1.0-video1
/dev/v4l/by-path/pci-0000\:00\:1d.2-usb-0\:1\:1.0-video2
$ ls -la /dev/v4l/by-path/pci-0000\:00\:1d.2-usb-0\:1\:1.0-video0
lrwxrwxrwx 1 root root 12 2008-04-28 00:02 /dev/v4l/by-path/pci-0000:00:1d.2-usb-0:1:1.0-video0 -> ../../video1
These paths are steady across reboots and should be resistant to rearranging
across Kernel versions.
video_register_device_index is available to drivers to request a
specific index number.
Signed-off-by: Brandon Philips <bphilips@suse.de>
Signed-off-by: Kees Cook <kees@outflux.net>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/v4l2-dev.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 40b0810a595a..9e6e4f18e948 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -96,6 +96,8 @@ struct video_device | |||
96 | int type; /* v4l1 */ | 96 | int type; /* v4l1 */ |
97 | int type2; /* v4l2 */ | 97 | int type2; /* v4l2 */ |
98 | int minor; | 98 | int minor; |
99 | /* attribute to diferentiate multiple indexs on one physical device */ | ||
100 | int index; | ||
99 | 101 | ||
100 | int debug; /* Activates debug level*/ | 102 | int debug; /* Activates debug level*/ |
101 | 103 | ||
@@ -347,6 +349,8 @@ void *priv; | |||
347 | 349 | ||
348 | /* Version 2 functions */ | 350 | /* Version 2 functions */ |
349 | extern int video_register_device(struct video_device *vfd, int type, int nr); | 351 | extern int video_register_device(struct video_device *vfd, int type, int nr); |
352 | int video_register_device_index(struct video_device *vfd, int type, int nr, | ||
353 | int index); | ||
350 | void video_unregister_device(struct video_device *); | 354 | void video_unregister_device(struct video_device *); |
351 | extern int video_ioctl2(struct inode *inode, struct file *file, | 355 | extern int video_ioctl2(struct inode *inode, struct file *file, |
352 | unsigned int cmd, unsigned long arg); | 356 | unsigned int cmd, unsigned long arg); |