linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <kees@outflux.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: work-around for video4linux sysfs
Date: Wed, 01 Aug 2007 23:14:18 +0000	[thread overview]
Message-ID: <20070801231418.GD9617@outflux.net> (raw)
In-Reply-To: <20070731195136.GW9881@outflux.net>

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

  parent reply	other threads:[~2007-08-01 23:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=20070801231418.GD9617@outflux.net \
    --to=kees@outflux.net \
    --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).