From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Date: Tue, 31 Jul 2007 19:51:37 +0000 Subject: work-around for video4linux sysfs Message-Id: <20070731195136.GW9881@outflux.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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