linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* work-around for video4linux sysfs
@ 2007-07-31 19:51 Kees Cook
  2007-08-01 20:52 ` Greg KH
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: Kees Cook @ 2007-07-31 19:51 UTC (permalink / raw)
  To: linux-hotplug

Hi,

I proposed the change below while Kay and Scott were at GUADEC, and
it seems the response was generally negative, but without any better
suggestions.  I'd like to bring this up again, as I think this solution,
while being a bit of hack, should at least be forward-compatible if/when
v4l sysfs stuff is sorted out better.

These patches create a /dev/v4l/by-path tree so that devices can
be explicitly identified (I could find no other common-across-v4l
uniquely identifying information).  Explicit symlinks are needed since
initialization order between v4l sub-drivers isn't always in the same.
Things like MythTV get very upset when /dev/video0 and /dev/video1 swap
places, for example...

First are changes to extras/path_id/path_id to handle missing driver
links, followed by changes to the debian rule set, as an example of how
the changes to path_id could be used.

Suggestions, thoughts?

Thanks,

-Kees


--- udev-113~/extras/path_id/path_id	2007-07-18 11:07:15.000000000 -0700
+++ udev-113/extras/path_id/path_id	2007-07-18 11:08:05.000000000 -0700
@@ -551,6 +551,17 @@ handle_device () {
 			d="$d-${rewind}st${mode}"
 		fi
 	fi
+	# v4l sysfs tree doesn't include driver details
+	if [ "$TYPE" = "video4linux" ] ; then
+		if [ -e "$full_sysfs_device_path/driver" ]; then
+			cd "$full_sysfs_device_path"/driver
+			driver="`pwd -P`"
+			cd "$OPWD"
+			if [ -n "$driver" ]; then
+				d="${d}${driver##*/}"
+			fi
+		fi
+	fi
 }
 
 case "$TYPE" in
@@ -566,6 +577,10 @@ case "$TYPE" in
 		handle_device
 		echo "ID_PATH=$d"
 		;;
+	video4linux)
+		handle_device
+		echo "ID_PATH=$d"
+		;;
 	*)
 		RESULT=1
 		;;


diff -u udev-113/debian/rules.d/60-symlinks.rules udev-113/debian/rules.d/60-symlinks.rules
--- udev-113/debian/rules.d/60-symlinks.rules
+++ udev-113/debian/rules.d/60-symlinks.rules
@@ -16,0 +17,14 @@
+
+# Create video4linux PCI path symlinks
+ACTION!="add", GOTO="video4linux_path_end"
+SUBSYSTEM!="video4linux", GOTO="video4linux_path_end"
+
+IMPORT{program}="path_id %p"
+# This is limited to the first 10 video devices to avoid per-driver 
+# device duplication (like ivtv), since we have no way to distinguish
+# interfaces via sysfs in a driver-agnostic way yet.  If OPTIONS allowed
+# replacement, we could set link_priority to -%m to give preference to the
+# first v4l interface per physical device.
+ENV{ID_PATH}="?*", KERNEL="video[0-9]", SYMLINK+="v4l/by-path/$env{ID_PATH}"
+
+LABEL="video4linux_path_end"


-- 
Kees Cook

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2007-08-09 19:38 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 19:51 work-around for video4linux sysfs Kees Cook
2007-08-01 20:52 ` Greg KH
2007-08-01 21:31 ` Kees Cook
2007-08-01 21:58 ` Greg KH
2007-08-01 22:22 ` Kees Cook
2007-08-01 22:39 ` Greg KH
2007-08-01 23:14 ` Kees Cook
2007-08-01 23:28 ` Greg KH
2007-08-01 23:48 ` Kees Cook
2007-08-02  9:24 ` Kay Sievers
2007-08-02 14:05 ` Kees Cook
2007-08-02 22:30 ` Kay Sievers
2007-08-02 22:39 ` Linas Vepstas
2007-08-02 23:02 ` Kay Sievers
2007-08-07  0:39 ` Kees Cook
2007-08-07  9:24 ` Kay Sievers
2007-08-07 19:36 ` Kees Cook
2007-08-07 22:58 ` Kay Sievers
2007-08-07 23:18 ` Kees Cook
2007-08-08 10:48 ` Kay Sievers
2007-08-09 19:38 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).