On Wed, 14 Jan 2009 21:01:47 -0600 (CST) Mike Isely <isely@xxxxxxxxx> wrote: > On Thu, 15 Jan 2009, Mauro Carvalho Chehab wrote: > > > On Wed, 14 Jan 2009 10:44:38 -0600 (CST) > > Mike Isely <isely@xxxxxxxxx> wrote: > > [...] > > > > > > And I'd appreciate some suggestions from anyone about a means via the > > > V4L interface to make available a device-specific identifier, like a > > > serial number. Yes I know such a thing is not always available with all > > > devices, but it is available for Hauppauge devices in general and users > > > want to have access to that information for purposes of mapping behavior > > > in userspace. > > > > Sorry, but I didn't understand the need. What do you want to map in userspace? > > Except for debugging purposes, or when the user has more than one device > > connected, I can't see any other usage for such identifier. > > > > For debug, you can just print the serial number. For device unique > > identification, there are the sysfs stuff, used by udev. > > > > Am I missing something? > > > > Rather than paraphrase it all here, I invite you to look at the > discussion thread on the pvrusb2 list where the topic came up: > > http://www.isely.net/pipermail/pvrusb2/2009-January/002091.html > > After looking over that discussion, let's talk about it. I think I know > where you are heading with this, but I have other questions (if I'm > right about where you're heading) and I'd like you to see that thread > first. OK. Well, the usage he wants is something that is better fitted by using sysfs info. There, you should have all information to uniquely identify a device: driver, bus location (on PCI this can be relevant), MAC (for dvb devices), etc. IMO, the proper way is to add the serial number at sysfs, and let the bus_info point to the proper bus location. Having the bus location, an userspace app can seek the sysfs and look for the udev info. For example, on an em28xx analog device I have here, bus_info returns "1-3". Ok, this is a very bad way to specify the bus. IMO, we should use usb_make_path() to generate the canonical name for USB buses. Anyway, by getting this information, and looking at sysfs, we'll see lots of very useful information [1]. By parsing the info, we know that: the v4l driver is em28xx; the audio driver is snd-usb-audio (card1); the event interface is input10; this device uses two i2c modules: saa7115 and tuner; the device has no dvb interface. It should be easy to extend it to provide more info, like the serial number. This will also help udev to create a permanent name for the known devices, as it does with internet interfaces. Cheers, Mauro [1] This is the info generated by em28xx driver: /sys/bus/usb/devices/1-3 |-- 1-3:1.0 | |-- bAlternateSetting | |-- bInterfaceClass | |-- bInterfaceNumber | |-- bInterfaceProtocol | |-- bInterfaceSubClass | |-- bNumEndpoints | |-- driver -> ../../../../../../bus/usb/drivers/em28xx | |-- ep_81 -> usb_endpoint/usbdev1.2_ep81 | |-- ep_82 -> usb_endpoint/usbdev1.2_ep82 | |-- ep_84 -> usb_endpoint/usbdev1.2_ep84 | |-- modalias | |-- power | | `-- wakeup | |-- subsystem -> ../../../../../../bus/usb | |-- uevent | `-- usb_endpoint | |-- usbdev1.2_ep81 | | |-- bEndpointAddress | | |-- bInterval | | |-- bLength | | |-- bmAttributes | | |-- dev | | |-- device -> ../../../1-3:1.0 | | |-- direction | | |-- interval | | |-- power | | | `-- wakeup | | |-- subsystem -> ../../../../../../../../class/usb_endpoint | | |-- type | | |-- uevent | | `-- wMaxPacketSize | |-- usbdev1.2_ep82 | | |-- bEndpointAddress | | |-- bInterval | | |-- bLength | | |-- bmAttributes | | |-- dev | | |-- device -> ../../../1-3:1.0 | | |-- direction | | |-- interval | | |-- power | | | `-- wakeup | | |-- subsystem -> ../../../../../../../../class/usb_endpoint | | |-- type | | |-- uevent | | `-- wMaxPacketSize | `-- usbdev1.2_ep84 | |-- bEndpointAddress | |-- bInterval | |-- bLength | |-- bmAttributes | |-- dev | |-- device -> ../../../1-3:1.0 | |-- direction | |-- interval | |-- power | | `-- wakeup | |-- subsystem -> ../../../../../../../../class/usb_endpoint | |-- type | |-- uevent | `-- wMaxPacketSize |-- 1-3:1.1 | |-- bAlternateSetting | |-- bInterfaceClass | |-- bInterfaceNumber | |-- bInterfaceProtocol | |-- bInterfaceSubClass | |-- bNumEndpoints | |-- driver -> ../../../../../../bus/usb/drivers/snd-usb-audio | |-- modalias | |-- power | | `-- wakeup | |-- sound | | `-- card1 | | |-- audio1 | | | |-- dev | | | |-- device -> ../../card1 | | | |-- power | | | | `-- wakeup | | | |-- subsystem -> ../../../../../../../../../class/sound | | | `-- uevent | | |-- controlC1 | | | |-- dev | | | |-- device -> ../../card1 | | | |-- power | | | | `-- wakeup | | | |-- subsystem -> ../../../../../../../../../class/sound | | | `-- uevent | | |-- device -> ../../../1-3:1.1 | | |-- dsp1 | | | |-- dev | | | |-- device -> ../../card1 | | | |-- power | | | | `-- wakeup | | | |-- subsystem -> ../../../../../../../../../class/sound | | | `-- uevent | | |-- mixer1 | | | |-- dev | | | |-- device -> ../../card1 | | | |-- power | | | | `-- wakeup | | | |-- subsystem -> ../../../../../../../../../class/sound | | | `-- uevent | | |-- pcmC1D0c | | | |-- dev | | | |-- device -> ../../card1 | | | |-- pcm_class | | | |-- power | | | | `-- wakeup | | | |-- subsystem -> ../../../../../../../../../class/sound | | | `-- uevent | | |-- power | | | `-- wakeup | | |-- subsystem -> ../../../../../../../../class/sound | | `-- uevent | |-- subsystem -> ../../../../../../bus/usb | `-- uevent |-- 1-3:1.2 | |-- bAlternateSetting | |-- bInterfaceClass | |-- bInterfaceNumber | |-- bInterfaceProtocol | |-- bInterfaceSubClass | |-- bNumEndpoints | |-- driver -> ../../../../../../bus/usb/drivers/snd-usb-audio | |-- ep_83 -> usb_endpoint/usbdev1.2_ep83 | |-- modalias | |-- power | | `-- wakeup | |-- subsystem -> ../../../../../../bus/usb | |-- uevent | `-- usb_endpoint | `-- usbdev1.2_ep83 | |-- bEndpointAddress | |-- bInterval | |-- bLength | |-- bmAttributes | |-- dev | |-- device -> ../../../1-3:1.2 | |-- direction | |-- interval | |-- power | | `-- wakeup | |-- subsystem -> ../../../../../../../../class/usb_endpoint | |-- type | |-- uevent | `-- wMaxPacketSize |-- authorized |-- bConfigurationValue |-- bDeviceClass |-- bDeviceProtocol |-- bDeviceSubClass |-- bMaxPacketSize0 |-- bMaxPower |-- bNumConfigurations |-- bNumInterfaces |-- bcdDevice |-- bmAttributes |-- busnum |-- configuration |-- descriptors |-- dev |-- devnum |-- driver -> ../../../../../bus/usb/drivers/usb |-- ep_00 -> usb_endpoint/usbdev1.2_ep00 |-- i2c-adapter | `-- i2c-1 | |-- 1-0025 | | |-- driver -> ../../../../../../../../bus/i2c/drivers/saa7115' | | |-- modalias | | |-- name | | |-- power | | | `-- wakeup | | |-- subsystem -> ../../../../../../../../bus/i2c | | `-- uevent | |-- 1-0063 | | |-- driver -> ../../../../../../../../bus/i2c/drivers/tuner' | | |-- modalias | | |-- name | | |-- power | | | `-- wakeup | | |-- subsystem -> ../../../../../../../../bus/i2c | | `-- uevent | |-- device -> ../../../1-3 | |-- name | |-- power | | `-- wakeup | |-- subsystem -> ../../../../../../../class/i2c-adapter | `-- uevent |-- idProduct |-- idVendor |-- input | `-- input10 | |-- capabilities | | |-- abs | | |-- ev | | |-- ff | | |-- key | | |-- led | | |-- msc | | |-- rel | | |-- snd | | `-- sw | |-- device -> ../../../1-3 | |-- event10 | | |-- dev | | |-- device -> ../../input10 | | |-- power | | | `-- wakeup | | |-- subsystem -> ../../../../../../../../class/input | | `-- uevent | |-- id | | |-- bustype | | |-- product | | |-- vendor | | `-- version | |-- modalias | |-- name | |-- phys | |-- power | | `-- wakeup | |-- subsystem -> ../../../../../../../class/input | |-- uevent | `-- uniq |-- maxchild |-- power | |-- active_duration | |-- autosuspend | |-- connected_duration | |-- level | |-- persist | `-- wakeup |-- product |-- quirks |-- speed |-- subsystem -> ../../../../../bus/usb |-- uevent |-- urbnum |-- usb_endpoint | `-- usbdev1.2_ep00 | |-- bEndpointAddress | |-- bInterval | |-- bLength | |-- bmAttributes | |-- dev | |-- device -> ../../../1-3 | |-- direction | |-- interval | |-- power | | `-- wakeup | |-- subsystem -> ../../../../../../../class/usb_endpoint | |-- type | |-- uevent | `-- wMaxPacketSize |-- version `-- video4linux |-- vbi0 | |-- dev | |-- device -> ../../../1-3 | |-- index | |-- name | |-- power | | `-- wakeup | |-- subsystem -> ../../../../../../../class/video4linux | `-- uevent `-- video0 |-- dev |-- device -> ../../../1-3 |-- index |-- name |-- power | `-- wakeup |-- subsystem -> ../../../../../../../class/video4linux `-- uevent 101 directories, 174 files 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