From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Date: Wed, 01 Aug 2007 23:14:18 +0000 Subject: Re: work-around for video4linux sysfs Message-Id: <20070801231418.GD9617@outflux.net> List-Id: References: <20070731195136.GW9881@outflux.net> In-Reply-To: <20070731195136.GW9881@outflux.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Wed, Aug 01, 2007 at 03:39:24PM -0700, Greg KH wrote: > USB serial numbers are up in the USB device, which you should be able to > get by just walking up the device chain in sysfs. > > PCI devices on their own don't have a standard for serial numbers :( Right, and since there wasn't a common serial number, best I saw was the path_id stuff. :) > Ick, that sounds messy :( Very, yes. > Can you show me the sysfs representation for the v4l devices you have? Sure: /sys/class/video4linux/video0# tree . |-- dev |-- device -> ../../../devices/pci0000:00/0000:00:08.0/0000:01:06.0 |-- name |-- subsystem -> ../../../class/video4linux `-- uevent /sys/class/video4linux/video1# tree . |-- dev |-- device -> ../../../devices/pci0000:00/0000:00:08.0/0000:01:07.0 |-- name |-- subsystem -> ../../../class/video4linux `-- uevent # udevinfo -a -p $(udevinfo --query path -n /dev/video0) looking at device '/class/video4linux/video0': KERNEL="video0" SUBSYSTEM="video4linux" DRIVER="" ATTR{name}="cx88_0_ video _pcHDTV HD3000 HD" ATTR{dev}="81:0" looking at parent device '/devices/pci0000:00/0000:00:08.0/0000:01:06.0': KERNELS="0000:01:06.0" SUBSYSTEMS="pci" DRIVERS="cx8800" ATTRS{msi_bus}="" ATTRS{broken_parity_status}="0" ATTRS{enable}="1" ATTRS{modalias}="pci:v000014F1d00008800sv00007063sd00003000bc04sc00i00" ATTRS{local_cpus}="ff" ATTRS{irq}="20" ATTRS{class}="0x040000" ATTRS{subsystem_device}="0x3000" ATTRS{subsystem_vendor}="0x7063" ATTRS{device}="0x8800" ATTRS{vendor}="0x14f1" looking at parent device '/devices/pci0000:00/0000:00:08.0': KERNELS="0000:00:08.0" SUBSYSTEMS="pci" DRIVERS="" ATTRS{msi_bus}="1" ATTRS{broken_parity_status}="0" ATTRS{enable}="1" ATTRS{modalias}="pci:v000010DEd0000006Csv00000000sd00000000bc06sc04i00" ATTRS{local_cpus}="ff" ATTRS{irq}="0" ATTRS{class}="0x060400" ATTRS{subsystem_device}="0x0000" ATTRS{subsystem_vendor}="0x0000" ATTRS{device}="0x006c" ATTRS{vendor}="0x10de" looking at parent device '/devices/pci0000:00': KERNELS="pci0000:00" SUBSYSTEMS="" DRIVERS="" # udevinfo -a -p $(udevinfo --query path -n /dev/video1) Udevinfo starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/class/video4linux/video1': KERNEL="video1" SUBSYSTEM="video4linux" DRIVER="" ATTR{name}="ivtv0 encoder MPEG" ATTR{dev}="81:1" looking at parent device '/devices/pci0000:00/0000:00:08.0/0000:01:07.0': KERNELS="0000:01:07.0" SUBSYSTEMS="pci" DRIVERS="ivtv" ATTRS{msi_bus}="" ATTRS{broken_parity_status}="0" ATTRS{enable}="1" ATTRS{modalias}="pci:v00004444d00000016sv00000070sd00004009bc04sc00i00" ATTRS{local_cpus}="ff" ATTRS{irq}="21" ATTRS{class}="0x040000" ATTRS{subsystem_device}="0x4009" ATTRS{subsystem_vendor}="0x0070" ATTRS{device}="0x0016" ATTRS{vendor}="0x4444" looking at parent device '/devices/pci0000:00/0000:00:08.0': KERNELS="0000:00:08.0" SUBSYSTEMS="pci" DRIVERS="" ATTRS{msi_bus}="1" ATTRS{broken_parity_status}="0" ATTRS{enable}="1" ATTRS{modalias}="pci:v000010DEd0000006Csv00000000sd00000000bc06sc04i00" ATTRS{local_cpus}="ff" ATTRS{irq}="0" ATTRS{class}="0x060400" ATTRS{subsystem_device}="0x0000" ATTRS{subsystem_vendor}="0x0000" ATTRS{device}="0x006c" ATTRS{vendor}="0x10de" looking at parent device '/devices/pci0000:00': KERNELS="pci0000:00" SUBSYSTEMS="" DRIVERS="" Note that the ATTR{name} is the truncated non-standard description I was talking about in the earlier email. e.g. during boot init we see things like: [ 45.576276] ivtv0: Initialized Hauppauge WinTV PVR-250, card #0 ... [ 47.172046] CORE cx88[0]: subsystem: 7063:3000, board: pcHDTV HD3000 HDTV [card"] My wishlist would be to get the "board name" somewhere into the v4l drivers, but that requires more code diving than I have time for at the moment. :) -- Kees Cook @outflux.net ------------------------------------------------------------------------- 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