From: Kees Cook <kees@ubuntu.com>
To: linux-hotplug@vger.kernel.org
Subject: work-around for video4linux sysfs
Date: Tue, 31 Jul 2007 19:51:37 +0000 [thread overview]
Message-ID: <20070731195136.GW9881@outflux.net> (raw)
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
next reply other threads:[~2007-07-31 19:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-31 19:51 Kees Cook [this message]
2007-08-01 20:52 ` work-around for video4linux sysfs 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070731195136.GW9881@outflux.net \
--to=kees@ubuntu.com \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).