public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] V4L: add "function" sysfs attribute to v4l devices
@ 2008-04-17  1:23 Kees Cook
  2008-04-17 22:08 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2008-04-17  1:23 UTC (permalink / raw)
  To: video4linux-list; +Cc: Kay Sievers

Hello!

Two patches follow, related to discussions[1][2] on the hotplug mailing
list, in an attempt to solve enumeration problems when multiple v4l
devices are present in a system and the resulting init order was not
guaranteed to be the same from boot-to-boot (video0 isn't always the
same device).  The goal is to create things like this with udev:
    pci-0000:01:06.0-video-mpeg-cap -> ../../video0
    pci-0000:01:07.0-video-yuv-cap -> ../../video1
    pci-0000:01:06.0-video-yuv-cap -> ../../video24

First patch is the sysfs infrastructure to support exporting a
"function" string.  This value is related to the existing "type" field,
but is singular in use and not designed for internal driver use, as
"type" seems to be.

Second patch is a first stab at providing "function" entries for
hardware I have access to.

Thanks,

-Kees

[1] http://marc.info/?t=118591155400012&r=1&w=2
[2] some recent discussion on the new hotplug list, but I can't find an
    archive link since it moved to vger...

-- 
Kees Cook                                            @outflux.net

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

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

* Re: [PATCH 0/2] V4L: add "function" sysfs attribute to v4l devices
  2008-04-17  1:23 [PATCH 0/2] V4L: add "function" sysfs attribute to v4l devices Kees Cook
@ 2008-04-17 22:08 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2008-04-17 22:08 UTC (permalink / raw)
  To: video4linux-list

On Wed, Apr 16, 2008 at 06:23:46PM -0700, Kees Cook wrote:
> [2] some recent discussion on the new hotplug list, but I can't find an
>     archive link since it moved to vger...

Since I can't link to it, I'll just include the udev patches here too.
:)

---
Update of path_id and example symlink-creation update for udev to take
advantage of the new "function" string exported from video4linux
devices.

Signed-off-by: Kees Cook <kees@outflux.net>
---
 debian/rules.d/60-symlinks.rules |    9 +++++++++
 extras/path_id/path_id           |   14 ++++++++++++++
 2 files changed, 23 insertions(+)

--- udev-113/debian/rules.d/60-symlinks.rules~	2008-04-16 17:02:58.000000000 -0700
+++ udev-113/debian/rules.d/60-symlinks.rules	2008-04-16 17:04:32.000000000 -0700
@@ -14,3 +14,12 @@
 # Create /dev/pilot symlink for Palm Pilots
 KERNEL=="ttyUSB*", ATTRS{product}=="Palm Handheld*|Handspring *|palmOne Handheld", \
 					SYMLINK+="pilot"
+
+# Create video4linux PCI path symlinks
+ACTION!="add", GOTO="video4linux_path_end"
+SUBSYSTEM!="video4linux", GOTO="video4linux_path_end"
+
+IMPORT{program}="path_id %p"
+ENV{ID_PATH}=="?*", KERNEL=="video*", SYMLINK+="v4l/by-path/$env{ID_PATH}"
+
+LABEL="video4linux_path_end"
--- udev-113/extras/path_id/path_id~	2007-06-23 08:44:48.000000000 -0700
+++ udev-113/extras/path_id/path_id	2008-04-16 17:10:23.000000000 -0700
@@ -462,6 +462,10 @@
 	full_sysfs_device_path="`pwd -P`"
 	cd "$OPWD"
 
+	if [ "$TYPE" = "video4linux" ] ; then
+		d="video"
+	fi
+
 	D=$full_sysfs_device_path
 	while [ ! -z "$D" ] ; do
 		case "$D" in
@@ -566,6 +570,16 @@
 		handle_device
 		echo "ID_PATH=$d"
 		;;
+	video4linux)
+		handle_device
+		if [ "$d" ]; then
+			# Only report v4l devices that have a "function" defined
+			func=$(cat $SYSFS$DEVPATH/function 2>/dev/null ||true)
+			if [ "$func" ]; then
+				echo "ID_PATH=$d-$func"
+			fi
+		fi
+		;;
 	*)
 		RESULT=1
 		;;


-- 
Kees Cook                                            @outflux.net

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

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

end of thread, other threads:[~2008-04-17 22:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-17  1:23 [PATCH 0/2] V4L: add "function" sysfs attribute to v4l devices Kees Cook
2008-04-17 22:08 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox