Hi Carsten, On Tue, 27 Jan 2009 14:56:26 +0100 Carsten Meier <cm@xxxxxxxxxx> wrote: > > Hi Thierry, > > > > It may be a good idea to add some code at the v4l2-apps dir for > > retrieving the sysfs place. Maybe we may add it at qv4l2 and at > > v4l2-ctl. > > > > Cheers, > > Mauro > > Hi, > > here is code which I've written for it. It is in C++ with Boost, but > adaption to C shouldn't be hard. It's not extensively tested and put > into the public domain. Thank you for your code. I've converted it to C, and improved it to work also with PCI and PCIe devices. I've made it available at: http://linuxtv.org/hg/v4l-dvb/rev/6e636c8969e8 (and two subsequent patches improving it a little bit) > Maybe it is of use for one or another. For now, it is a separate small application. This makes easy for scripts to use it. It will output both the "raw" data returned by VIDIOC_QUERYCAP and their sysfs path: For a USB device: device = /dev/video0 bus info = usb-0000:00:1d.7-1 sysfs path = /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1 For a PCI device: device = /dev/video0 bus info = PCI:0000:01:02.0 sysfs path = /sys/devices/pci0000:00/0000:00:1e.0/0000:01:02.0 It works even with devices with internal PCI bridges, like this one: device = /dev/video4 bus info = PCI:0000:02:0f.0 sysfs path = /sys/devices/pci0000:00/0000:00:1e.0/0000:01:01.0/0000:02:0f.0 device = /dev/video3 bus info = PCI:0000:02:0e.0 sysfs path = /sys/devices/pci0000:00/0000:00:1e.0/0000:01:01.0/0000:02:0e.0 device = /dev/video2 bus info = PCI:0000:02:0d.0 sysfs path = /sys/devices/pci0000:00/0000:00:1e.0/0000:01:01.0/0000:02:0d.0 device = /dev/video1 bus info = PCI:0000:02:0c.0 sysfs path = /sys/devices/pci0000:00/0000:00:1e.0/0000:01:01.0/0000:02:0c.0 I tested here with bttv (a board with 4 bttv chips), saa7134, uvcvideo and em28xx. It should work fine also with other devices. Cheers, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html