* How to identify USB-video-devices @ 2009-01-15 14:41 Carsten Meier 2009-01-15 15:20 ` Markus Rechberger 0 siblings, 1 reply; 13+ messages in thread From: Carsten Meier @ 2009-01-15 14:41 UTC (permalink / raw) To: video4linux-list Hello list, we recently had a discussion on the pvrusb2-list on how to identify a video-device connected via USB from an userspace app. (Or more precisely on how to associate config-data with a particular device). This led to a patch which returned the device's serial-no. in v4l2_capability's bus_info field. This one has been rejected, but I really feel that this is the right way to go. Here's the thread: http://www.isely.net/pipermail/pvrusb2/2009-January/002091.html I think the meaning of the bus_info-field should be modified slightly for USB-devices to reflect its dynamic nature. At least a string that won't change on dis-/reconnect and standby/wake-up-cycles should be returned. If a device has a unique serial-no. it is a perfect candidate for this, if not, some USB-port-info should be returned that won't change if the device is connected to the same port through the same hub. What do you think? (BTW: I'm not a kernel-hacker, I'm writing this from the perspective of an app-developer) Regards, Carsten -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-15 14:41 How to identify USB-video-devices Carsten Meier @ 2009-01-15 15:20 ` Markus Rechberger 2009-01-15 15:33 ` Carsten Meier 0 siblings, 1 reply; 13+ messages in thread From: Markus Rechberger @ 2009-01-15 15:20 UTC (permalink / raw) To: Carsten Meier; +Cc: video4linux-list On Thu, Jan 15, 2009 at 3:41 PM, Carsten Meier <cm@trexity.de> wrote: > Hello list, > > we recently had a discussion on the pvrusb2-list on how to identify a > video-device connected via USB from an userspace app. (Or more precisely > on how to associate config-data with a particular device). This led to > a patch which returned the device's serial-no. in v4l2_capability's > bus_info field. This one has been rejected, but I really feel that this > is the right way to go. Here's the thread: > http://www.isely.net/pipermail/pvrusb2/2009-January/002091.html > > I think the meaning of the bus_info-field should be modified slightly > for USB-devices to reflect its dynamic nature. At least a string that > won't change on dis-/reconnect and standby/wake-up-cycles should be > returned. If a device has a unique serial-no. it is a perfect candidate > for this, if not, some USB-port-info should be returned that won't > change if the device is connected to the same port through the same hub. > > What do you think? > (BTW: I'm not a kernel-hacker, I'm writing this from the perspective of > an app-developer) > write a few shellscripts and parse sysfs, or attach your application to sysfs that it will be notified if a device gets added. dbus is also a tip. no need to hook up drivers with some special things there. regards, Markus -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-15 15:20 ` Markus Rechberger @ 2009-01-15 15:33 ` Carsten Meier [not found] ` <09CD2F1A09A6ED498A24D850EB10120817E30B7506@Colmatec004.COLMATEC.INT> 0 siblings, 1 reply; 13+ messages in thread From: Carsten Meier @ 2009-01-15 15:33 UTC (permalink / raw) To: Markus Rechberger; +Cc: video4linux-list Am Thu, 15 Jan 2009 16:20:23 +0100 schrieb "Markus Rechberger" <mrechberger@gmail.com>: > On Thu, Jan 15, 2009 at 3:41 PM, Carsten Meier <cm@trexity.de> wrote: > > Hello list, > > > > we recently had a discussion on the pvrusb2-list on how to identify > > a video-device connected via USB from an userspace app. (Or more > > precisely on how to associate config-data with a particular > > device). This led to a patch which returned the device's serial-no. > > in v4l2_capability's bus_info field. This one has been rejected, > > but I really feel that this is the right way to go. Here's the > > thread: > > http://www.isely.net/pipermail/pvrusb2/2009-January/002091.html > > > > I think the meaning of the bus_info-field should be modified > > slightly for USB-devices to reflect its dynamic nature. At least a > > string that won't change on dis-/reconnect and > > standby/wake-up-cycles should be returned. If a device has a unique > > serial-no. it is a perfect candidate for this, if not, some > > USB-port-info should be returned that won't change if the device is > > connected to the same port through the same hub. > > > > What do you think? > > (BTW: I'm not a kernel-hacker, I'm writing this from the > > perspective of an app-developer) > > > > write a few shellscripts and parse sysfs, or attach your application > to sysfs that it will > be notified if a device gets added. dbus is also a tip. no need to > hook up drivers > with some special things there. > > regards, > Markus But according to the docs, the bus_info-field is intended for the purpose of identifying particular devices. Other solutions may be possible, but they are much more complex and much more sensible to other kernel-changes. By using bus_info, there is a simple and clean solution that only depends on the V4L2-API and it also reflects the primary intention of the field. Other USB-device-drivers aren't required to change to the new policy, their current bus_info-string (if implemented like in pvrusb2) changes on every reconnect and standby/wake-up-cycle and is of no use anyway for any app. I really think that current behaviour is broken. Regards, Carsten -- 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] 13+ messages in thread
[parent not found: <09CD2F1A09A6ED498A24D850EB10120817E30B7506@Colmatec004.COLMATEC.INT>]
* Re: How to identify USB-video-devices [not found] ` <09CD2F1A09A6ED498A24D850EB10120817E30B7506@Colmatec004.COLMATEC.INT> @ 2009-01-15 16:51 ` Carsten Meier 2009-01-15 22:22 ` Pádraig Brady 0 siblings, 1 reply; 13+ messages in thread From: Carsten Meier @ 2009-01-15 16:51 UTC (permalink / raw) To: Jonathan Lafontaine; +Cc: video4linux-list > > -----Original Message----- > From: video4linux-list-bounces@redhat.com > [mailto:video4linux-list-bounces@redhat.com] On Behalf Of Carsten > Meier Sent: 15 janvier 2009 10:34 To: Markus Rechberger > Cc: video4linux-list@redhat.com > Subject: Re: How to identify USB-video-devices > > Am Thu, 15 Jan 2009 16:20:23 +0100 > schrieb "Markus Rechberger" <mrechberger@gmail.com>: > > > On Thu, Jan 15, 2009 at 3:41 PM, Carsten Meier <cm@trexity.de> > > wrote: > > > Hello list, > > > > > > we recently had a discussion on the pvrusb2-list on how to > > > identify a video-device connected via USB from an userspace app. > > > (Or more precisely on how to associate config-data with a > > > particular device). This led to a patch which returned the > > > device's serial-no. in v4l2_capability's bus_info field. This one > > > has been rejected, but I really feel that this is the right way > > > to go. Here's the thread: > > > http://www.isely.net/pipermail/pvrusb2/2009-January/002091.html > > > > > > I think the meaning of the bus_info-field should be modified > > > slightly for USB-devices to reflect its dynamic nature. At least a > > > string that won't change on dis-/reconnect and > > > standby/wake-up-cycles should be returned. If a device has a > > > unique serial-no. it is a perfect candidate for this, if not, some > > > USB-port-info should be returned that won't change if the device > > > is connected to the same port through the same hub. > > > > > > What do you think? > > > (BTW: I'm not a kernel-hacker, I'm writing this from the > > > perspective of an app-developer) > > > > > > > write a few shellscripts and parse sysfs, or attach your application > > to sysfs that it will > > be notified if a device gets added. dbus is also a tip. no need to > > hook up drivers > > with some special things there. > > > > regards, > > Markus > > But according to the docs, the bus_info-field is intended for the > purpose of identifying particular devices. Other solutions may be > possible, but they are much more complex and much more sensible to > other kernel-changes. By using bus_info, there is a simple and clean > solution that only depends on the V4L2-API and it also reflects the > primary intention of the field. > > Other USB-device-drivers aren't required to change to the new policy, > their current bus_info-string (if implemented like in pvrusb2) changes > on every reconnect and standby/wake-up-cycle and is of no use anyway > for any app. > > I really think that current behaviour is broken. > > Regards, > Carsten > Am Thu, 15 Jan 2009 10:55:40 -0500 schrieb Jonathan Lafontaine <jlafontaine@ctecworld.com>: > I think that generic devices (often cheapest price) do not identify > themselves exactly as well known trademarks. > > So you can identify kind of chip they use (empia 2860) but, the > eeprom space usb chips identity have, remain the > responsibility/regardless to the company who build the entire video > usb board and not the empia or otherelse chip you ask information on. > > You can identify the vendor (2 letters id)so, in this situation, > contact the vendor/company to get more precision about. > > Try lsusb in terminal. > > Hope this reply is usefull. Best regards, cheers Hi, I think you misunderstood me or I misunderstood your message. :) I don't want to recognize a particual device type (or brand), but I want to distinguish two identical devices connected to a system. Here comes the full story (again): I'm currently writing a tool to store and apply configuration settings like channel-frequencies and control-values. These should all be kept in an XML-file which has a section for every v4l-device in the system. Those sections are associated with a particular device by storing the card- and bus_info-fields of the v4l2_capability-struct in the XML-file. This works pretty well for PCI-cards, because the bus_info field never changes (assuming you don't put the card in a different PCI-slot). This use-case is exactly the one the bus_info field was made for. But with USB things changed a bit. Now (at least for pvrusb2) a string like "usb 7-2 address 6" is reported in bus_info. This is not tragic, but after a disconnect-reconnect and even after a standby-wakeup-cycle it reports a different string by increasing the address no. Now I ask: Does anybody like to reconfigure an app just because the laptop was idle and went to stand-by-mode? Storing device-file-names is also not an option because they are created dynamicly. I can't say much about the sysfs-approach because I don't know much about it. But it seems more complex and why depend on an external mechanism if the V4L2-API already defines one? Regards, Carsten -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-15 16:51 ` Carsten Meier @ 2009-01-15 22:22 ` Pádraig Brady 2009-01-15 22:45 ` Markus Rechberger 2009-01-15 22:55 ` Carsten Meier 0 siblings, 2 replies; 13+ messages in thread From: Pádraig Brady @ 2009-01-15 22:22 UTC (permalink / raw) To: Carsten Meier; +Cc: video4linux-list Carsten Meier wrote: > Storing device-file-names is also not an option because they are > created dynamicly. You use udev rules to give persistent names. Here is my /etc/udev/rules.d/video.rules file, which creates /dev/webcam and /dev/tvtuner as appropriate. KERNEL=="video*" SYSFS{name}=="USB2.0 Camera", NAME="video%n", SYMLINK+="webcam" KERNEL=="video*" SYSFS{name}=="em28xx*", NAME="video%n", SYMLINK+="tvtuner" To find distinguishing attributes to match on use: echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p cheers, Pádraig. -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-15 22:22 ` Pádraig Brady @ 2009-01-15 22:45 ` Markus Rechberger 2009-01-15 22:55 ` Carsten Meier 1 sibling, 0 replies; 13+ messages in thread From: Markus Rechberger @ 2009-01-15 22:45 UTC (permalink / raw) To: Pádraig Brady; +Cc: video4linux-list On Thu, Jan 15, 2009 at 11:22 PM, Pádraig Brady <P@draigbrady.com> wrote: > Carsten Meier wrote: >> Storing device-file-names is also not an option because they are >> created dynamicly. > > You use udev rules to give persistent names. > > Here is my /etc/udev/rules.d/video.rules file, > which creates /dev/webcam and /dev/tvtuner as appropriate. > > KERNEL=="video*" SYSFS{name}=="USB2.0 Camera", NAME="video%n", SYMLINK+="webcam" > KERNEL=="video*" SYSFS{name}=="em28xx*", NAME="video%n", SYMLINK+="tvtuner" > > To find distinguishing attributes to match on use: > > echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p > yep, this is more or less what I meant too, although I didn't know about udevinfo. I wonder if the output is consistent during the last 8(?) kernel releases because the sysfs structure changed, so I doubt that actually. regards, Markus -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-15 22:22 ` Pádraig Brady 2009-01-15 22:45 ` Markus Rechberger @ 2009-01-15 22:55 ` Carsten Meier 2009-01-15 23:40 ` Markus Rechberger 1 sibling, 1 reply; 13+ messages in thread From: Carsten Meier @ 2009-01-15 22:55 UTC (permalink / raw) To: Pádraig Brady; +Cc: video4linux-list Am Thu, 15 Jan 2009 22:22:11 +0000 schrieb Pádraig Brady <P@draigBrady.com>: > Carsten Meier wrote: > > Storing device-file-names is also not an option because they are > > created dynamicly. > > You use udev rules to give persistent names. > > Here is my /etc/udev/rules.d/video.rules file, > which creates /dev/webcam and /dev/tvtuner as appropriate. > > KERNEL=="video*" SYSFS{name}=="USB2.0 Camera", NAME="video%n", > SYMLINK+="webcam" KERNEL=="video*" SYSFS{name}=="em28xx*", > NAME="video%n", SYMLINK+="tvtuner" > > To find distinguishing attributes to match on use: > > echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p > > cheers, > Pádraig. This already came up on the pvrusb2-list and someone told me (I don't know much about udev) that it might cause problems on disconnection of a device with a file-descriptor open which then gets reconnected and there are two device-files for it. I also don't like it, because an average user (including me) usually can't or don't want to write udev rules. Finally v4l2 already contains a very simple and reliable mechanism for doing this (bus_info-field) which simply isn't used correctly by the USB-drivers. My app should simply scan for /dev/video*-files, read out capabilities from them, present the user menus to select devices and edit device settings, save settings to a file and apply them on demand. This would work fine if bus_info was filled right, without root-privileges, without special udev rules or other sysfs-magic. Regards, Carsten -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-15 22:55 ` Carsten Meier @ 2009-01-15 23:40 ` Markus Rechberger 2009-01-16 0:27 ` Carsten Meier 0 siblings, 1 reply; 13+ messages in thread From: Markus Rechberger @ 2009-01-15 23:40 UTC (permalink / raw) To: Carsten Meier; +Cc: video4linux-list On Thu, Jan 15, 2009 at 11:55 PM, Carsten Meier <cm@trexity.de> wrote: > Am Thu, 15 Jan 2009 22:22:11 +0000 > schrieb Pádraig Brady <P@draigBrady.com>: > >> Carsten Meier wrote: >> > Storing device-file-names is also not an option because they are >> > created dynamicly. >> >> You use udev rules to give persistent names. >> >> Here is my /etc/udev/rules.d/video.rules file, >> which creates /dev/webcam and /dev/tvtuner as appropriate. >> >> KERNEL=="video*" SYSFS{name}=="USB2.0 Camera", NAME="video%n", >> SYMLINK+="webcam" KERNEL=="video*" SYSFS{name}=="em28xx*", >> NAME="video%n", SYMLINK+="tvtuner" >> >> To find distinguishing attributes to match on use: >> >> echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p >> >> cheers, >> Pádraig. > > This already came up on the pvrusb2-list and someone told me (I don't > know much about udev) that it might cause problems on disconnection of > a device with a file-descriptor open which then gets reconnected > and there are two device-files for it. I also don't like it, > because an average user (including me) usually can't or don't want to > write udev rules. Finally v4l2 already contains a very simple and > reliable mechanism for doing this (bus_info-field) which simply isn't > used correctly by the USB-drivers. > check the device serial for this one. I don't know if the pvrusb2 devices have it set up properly I know some manufacturers don't do! Be flexible with the node, but not with the serial. cat /sys/class/video4linux/video0/device/serial 080702001788 you have the nodename in it, there are many ways to retrieve the nodename. > My app should simply scan for /dev/video*-files, read out capabilities > from them, present the user menus to select devices and edit device > settings, save settings to a file and apply them on demand. This would > work fine if bus_info was filled right, without root-privileges, > without special udev rules or other sysfs-magic. > > Regards, > Carsten > > -- > video4linux-list mailing list > Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe > https://www.redhat.com/mailman/listinfo/video4linux-list > -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-15 23:40 ` Markus Rechberger @ 2009-01-16 0:27 ` Carsten Meier 2009-01-16 0:59 ` Markus Rechberger 0 siblings, 1 reply; 13+ messages in thread From: Carsten Meier @ 2009-01-16 0:27 UTC (permalink / raw) To: Markus Rechberger; +Cc: video4linux-list Am Fri, 16 Jan 2009 00:40:47 +0100 schrieb "Markus Rechberger" <mrechberger@gmail.com>: > On Thu, Jan 15, 2009 at 11:55 PM, Carsten Meier <cm@trexity.de> wrote: > > Am Thu, 15 Jan 2009 22:22:11 +0000 > > schrieb Pádraig Brady <P@draigBrady.com>: > > > >> Carsten Meier wrote: > >> > Storing device-file-names is also not an option because they are > >> > created dynamicly. > >> > >> You use udev rules to give persistent names. > >> > >> Here is my /etc/udev/rules.d/video.rules file, > >> which creates /dev/webcam and /dev/tvtuner as appropriate. > >> > >> KERNEL=="video*" SYSFS{name}=="USB2.0 Camera", NAME="video%n", > >> SYMLINK+="webcam" KERNEL=="video*" SYSFS{name}=="em28xx*", > >> NAME="video%n", SYMLINK+="tvtuner" > >> > >> To find distinguishing attributes to match on use: > >> > >> echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p > >> > >> cheers, > >> Pádraig. > > > > This already came up on the pvrusb2-list and someone told me (I > > don't know much about udev) that it might cause problems on > > disconnection of a device with a file-descriptor open which then > > gets reconnected and there are two device-files for it. I also > > don't like it, because an average user (including me) usually can't > > or don't want to write udev rules. Finally v4l2 already contains a > > very simple and reliable mechanism for doing this (bus_info-field) > > which simply isn't used correctly by the USB-drivers. > > > > check the device serial for this one. I don't know if the pvrusb2 > devices have it set up properly > I know some manufacturers don't do! > Be flexible with the node, but not with the serial. > > cat /sys/class/video4linux/video0/device/serial > 080702001788 > > you have the nodename in it, there are many ways to retrieve the > nodename. If I do a "ls /sys/class/video4linux/video0/" it simply prints: dev index name power subsystem uevent and it will end up with many differnet cases to consider by any app. I stay at my opinion that current bus_info-impl is broken. This *is* a driver issue that needs fixing. > > > My app should simply scan for /dev/video*-files, read out > > capabilities from them, present the user menus to select devices > > and edit device settings, save settings to a file and apply them on > > demand. This would work fine if bus_info was filled right, without > > root-privileges, without special udev rules or other sysfs-magic. > > > > Regards, > > Carsten > > > > -- > > video4linux-list mailing list > > Unsubscribe > > mailto:video4linux-list-request@redhat.com?subject=unsubscribe > > https://www.redhat.com/mailman/listinfo/video4linux-list > > -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-16 0:27 ` Carsten Meier @ 2009-01-16 0:59 ` Markus Rechberger 2009-01-16 1:55 ` Carsten Meier 0 siblings, 1 reply; 13+ messages in thread From: Markus Rechberger @ 2009-01-16 0:59 UTC (permalink / raw) To: Carsten Meier; +Cc: video4linux-list On Fri, Jan 16, 2009 at 1:27 AM, Carsten Meier <cm@trexity.de> wrote: > Am Fri, 16 Jan 2009 00:40:47 +0100 > schrieb "Markus Rechberger" <mrechberger@gmail.com>: > >> On Thu, Jan 15, 2009 at 11:55 PM, Carsten Meier <cm@trexity.de> wrote: >> > Am Thu, 15 Jan 2009 22:22:11 +0000 >> > schrieb Pádraig Brady <P@draigBrady.com>: >> > >> >> Carsten Meier wrote: >> >> > Storing device-file-names is also not an option because they are >> >> > created dynamicly. >> >> >> >> You use udev rules to give persistent names. >> >> >> >> Here is my /etc/udev/rules.d/video.rules file, >> >> which creates /dev/webcam and /dev/tvtuner as appropriate. >> >> >> >> KERNEL=="video*" SYSFS{name}=="USB2.0 Camera", NAME="video%n", >> >> SYMLINK+="webcam" KERNEL=="video*" SYSFS{name}=="em28xx*", >> >> NAME="video%n", SYMLINK+="tvtuner" >> >> >> >> To find distinguishing attributes to match on use: >> >> >> >> echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p >> >> >> >> cheers, >> >> Pádraig. >> > >> > This already came up on the pvrusb2-list and someone told me (I >> > don't know much about udev) that it might cause problems on >> > disconnection of a device with a file-descriptor open which then >> > gets reconnected and there are two device-files for it. I also >> > don't like it, because an average user (including me) usually can't >> > or don't want to write udev rules. Finally v4l2 already contains a >> > very simple and reliable mechanism for doing this (bus_info-field) >> > which simply isn't used correctly by the USB-drivers. >> > >> >> check the device serial for this one. I don't know if the pvrusb2 >> devices have it set up properly >> I know some manufacturers don't do! >> Be flexible with the node, but not with the serial. >> >> cat /sys/class/video4linux/video0/device/serial >> 080702001788 >> >> you have the nodename in it, there are many ways to retrieve the >> nodename. > > If I do a "ls /sys/class/video4linux/video0/" it simply prints: > > dev index name power subsystem uevent > > and it will end up with many differnet cases to consider by any app. I > stay at my opinion that current bus_info-impl is broken. This *is* a > driver issue that needs fixing. > could it be that video0 is no usb device - or something else? The usb-core framework should give you the information about the serial id not the driver. $ ls /sys/bus/usb/devices/*/id* /sys/bus/usb/devices/*/serial | while read a; do cat $a; done 0c15 <- product 04fc <- vendor 00000CFD49 <- usb serial id 008e 0ccd 080702001788 6377 058f 920321111113 0000 <- nothing attached here 0000 0000:00:02.0 0000 0000 0000:00:02.1 $ lsusb Bus 002 Device 008: ID 0ccd:008e TerraTec Electronic GmbH Bus 002 Device 003: ID 058f:6377 Alcor Micro Corp. Bus 002 Device 002: ID 04fc:0c15 Sunplus Technology Co., Ltd Bus 002 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000 I use kernel 2.6.24.21 here; but the sysfs entries have been available for quite some time already. Markus -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-16 0:59 ` Markus Rechberger @ 2009-01-16 1:55 ` Carsten Meier 2009-01-16 2:03 ` Markus Rechberger 0 siblings, 1 reply; 13+ messages in thread From: Carsten Meier @ 2009-01-16 1:55 UTC (permalink / raw) To: Markus Rechberger; +Cc: video4linux-list Am Fri, 16 Jan 2009 01:59:51 +0100 schrieb "Markus Rechberger" <mrechberger@gmail.com>: > On Fri, Jan 16, 2009 at 1:27 AM, Carsten Meier <cm@trexity.de> wrote: > > Am Fri, 16 Jan 2009 00:40:47 +0100 > > schrieb "Markus Rechberger" <mrechberger@gmail.com>: > > > >> On Thu, Jan 15, 2009 at 11:55 PM, Carsten Meier <cm@trexity.de> > >> wrote: > >> > Am Thu, 15 Jan 2009 22:22:11 +0000 > >> > schrieb Pádraig Brady <P@draigBrady.com>: > >> > > >> >> Carsten Meier wrote: > >> >> > Storing device-file-names is also not an option because they > >> >> > are created dynamicly. > >> >> > >> >> You use udev rules to give persistent names. > >> >> > >> >> Here is my /etc/udev/rules.d/video.rules file, > >> >> which creates /dev/webcam and /dev/tvtuner as appropriate. > >> >> > >> >> KERNEL=="video*" SYSFS{name}=="USB2.0 Camera", NAME="video%n", > >> >> SYMLINK+="webcam" KERNEL=="video*" SYSFS{name}=="em28xx*", > >> >> NAME="video%n", SYMLINK+="tvtuner" > >> >> > >> >> To find distinguishing attributes to match on use: > >> >> > >> >> echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p > >> >> > >> >> cheers, > >> >> Pádraig. > >> > > >> > This already came up on the pvrusb2-list and someone told me (I > >> > don't know much about udev) that it might cause problems on > >> > disconnection of a device with a file-descriptor open which then > >> > gets reconnected and there are two device-files for it. I also > >> > don't like it, because an average user (including me) usually > >> > can't or don't want to write udev rules. Finally v4l2 already > >> > contains a very simple and reliable mechanism for doing this > >> > (bus_info-field) which simply isn't used correctly by the > >> > USB-drivers. > >> > > >> > >> check the device serial for this one. I don't know if the pvrusb2 > >> devices have it set up properly > >> I know some manufacturers don't do! > >> Be flexible with the node, but not with the serial. > >> > >> cat /sys/class/video4linux/video0/device/serial > >> 080702001788 > >> > >> you have the nodename in it, there are many ways to retrieve the > >> nodename. > > > > If I do a "ls /sys/class/video4linux/video0/" it simply prints: > > > > dev index name power subsystem uevent > > > > and it will end up with many differnet cases to consider by any > > app. I stay at my opinion that current bus_info-impl is broken. > > This *is* a driver issue that needs fixing. > > > > could it be that video0 is no usb device - or something else? > The usb-core framework should give you the information about the > serial id not the driver. > > $ ls /sys/bus/usb/devices/*/id* /sys/bus/usb/devices/*/serial | while > read a; do cat $a; done > 0c15 <- product > 04fc <- vendor > 00000CFD49 <- usb serial id > 008e > 0ccd > 080702001788 > 6377 > 058f > 920321111113 > 0000 <- nothing attached here > 0000 > 0000:00:02.0 > 0000 > 0000 > 0000:00:02.1 > > $ lsusb > Bus 002 Device 008: ID 0ccd:008e TerraTec Electronic GmbH > Bus 002 Device 003: ID 058f:6377 Alcor Micro Corp. > Bus 002 Device 002: ID 04fc:0c15 Sunplus Technology Co., Ltd > Bus 002 Device 001: ID 0000:0000 > Bus 001 Device 001: ID 0000:0000 > > I use kernel 2.6.24.21 here; but the sysfs entries have been available > for quite some time already. > > Markus Yes, it is a pvr-usb-device with an mpeg-encoder which resides under /sys/class/pvrusb2/. And exactly this difference shows that it should be solved by the driver's bus_info-string and not by programming this logic into an app. OK, I'm done for today. I'm arguing this for two full days now. :( Good night, Carsten -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-16 1:55 ` Carsten Meier @ 2009-01-16 2:03 ` Markus Rechberger 2009-01-16 4:14 ` Mike Isely 0 siblings, 1 reply; 13+ messages in thread From: Markus Rechberger @ 2009-01-16 2:03 UTC (permalink / raw) To: Carsten Meier; +Cc: video4linux-list On Fri, Jan 16, 2009 at 2:55 AM, Carsten Meier <cm@trexity.de> wrote: > Am Fri, 16 Jan 2009 01:59:51 +0100 > schrieb "Markus Rechberger" <mrechberger@gmail.com>: > >> On Fri, Jan 16, 2009 at 1:27 AM, Carsten Meier <cm@trexity.de> wrote: >> > Am Fri, 16 Jan 2009 00:40:47 +0100 >> > schrieb "Markus Rechberger" <mrechberger@gmail.com>: >> > >> >> On Thu, Jan 15, 2009 at 11:55 PM, Carsten Meier <cm@trexity.de> >> >> wrote: >> >> > Am Thu, 15 Jan 2009 22:22:11 +0000 >> >> > schrieb Pádraig Brady <P@draigBrady.com>: >> >> > >> >> >> Carsten Meier wrote: >> >> >> > Storing device-file-names is also not an option because they >> >> >> > are created dynamicly. >> >> >> >> >> >> You use udev rules to give persistent names. >> >> >> >> >> >> Here is my /etc/udev/rules.d/video.rules file, >> >> >> which creates /dev/webcam and /dev/tvtuner as appropriate. >> >> >> >> >> >> KERNEL=="video*" SYSFS{name}=="USB2.0 Camera", NAME="video%n", >> >> >> SYMLINK+="webcam" KERNEL=="video*" SYSFS{name}=="em28xx*", >> >> >> NAME="video%n", SYMLINK+="tvtuner" >> >> >> >> >> >> To find distinguishing attributes to match on use: >> >> >> >> >> >> echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p >> >> >> >> >> >> cheers, >> >> >> Pádraig. >> >> > >> >> > This already came up on the pvrusb2-list and someone told me (I >> >> > don't know much about udev) that it might cause problems on >> >> > disconnection of a device with a file-descriptor open which then >> >> > gets reconnected and there are two device-files for it. I also >> >> > don't like it, because an average user (including me) usually >> >> > can't or don't want to write udev rules. Finally v4l2 already >> >> > contains a very simple and reliable mechanism for doing this >> >> > (bus_info-field) which simply isn't used correctly by the >> >> > USB-drivers. >> >> > >> >> >> >> check the device serial for this one. I don't know if the pvrusb2 >> >> devices have it set up properly >> >> I know some manufacturers don't do! >> >> Be flexible with the node, but not with the serial. >> >> >> >> cat /sys/class/video4linux/video0/device/serial >> >> 080702001788 >> >> >> >> you have the nodename in it, there are many ways to retrieve the >> >> nodename. >> > >> > If I do a "ls /sys/class/video4linux/video0/" it simply prints: >> > >> > dev index name power subsystem uevent >> > >> > and it will end up with many differnet cases to consider by any >> > app. I stay at my opinion that current bus_info-impl is broken. >> > This *is* a driver issue that needs fixing. >> > >> >> could it be that video0 is no usb device - or something else? >> The usb-core framework should give you the information about the >> serial id not the driver. >> >> $ ls /sys/bus/usb/devices/*/id* /sys/bus/usb/devices/*/serial | while >> read a; do cat $a; done >> 0c15 <- product >> 04fc <- vendor >> 00000CFD49 <- usb serial id >> 008e >> 0ccd >> 080702001788 >> 6377 >> 058f >> 920321111113 >> 0000 <- nothing attached here >> 0000 >> 0000:00:02.0 >> 0000 >> 0000 >> 0000:00:02.1 >> >> $ lsusb >> Bus 002 Device 008: ID 0ccd:008e TerraTec Electronic GmbH >> Bus 002 Device 003: ID 058f:6377 Alcor Micro Corp. >> Bus 002 Device 002: ID 04fc:0c15 Sunplus Technology Co., Ltd >> Bus 002 Device 001: ID 0000:0000 >> Bus 001 Device 001: ID 0000:0000 >> >> I use kernel 2.6.24.21 here; but the sysfs entries have been available >> for quite some time already. >> >> Markus > > Yes, it is a pvr-usb-device with an mpeg-encoder which resides > under /sys/class/pvrusb2/. And exactly this difference shows that it > should be solved by the driver's bus_info-string and not by programming > this logic into an app. > > OK, I'm done for today. I'm arguing this for two full days now. :( > I understand, it should be fixed in the driver yes. good night, Markus -- 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] 13+ messages in thread
* Re: How to identify USB-video-devices 2009-01-16 2:03 ` Markus Rechberger @ 2009-01-16 4:14 ` Mike Isely 0 siblings, 0 replies; 13+ messages in thread From: Mike Isely @ 2009-01-16 4:14 UTC (permalink / raw) To: Markus Rechberger; +Cc: Video4Linux list On Fri, 16 Jan 2009, Markus Rechberger wrote: > On Fri, Jan 16, 2009 at 2:55 AM, Carsten Meier <cm@trexity.de> wrote: > > Am Fri, 16 Jan 2009 01:59:51 +0100 > > schrieb "Markus Rechberger" <mrechberger@gmail.com>: > > [...] > >> > >> could it be that video0 is no usb device - or something else? > >> The usb-core framework should give you the information about the > >> serial id not the driver. > >> > >> $ ls /sys/bus/usb/devices/*/id* /sys/bus/usb/devices/*/serial | while > >> read a; do cat $a; done > >> 0c15 <- product > >> 04fc <- vendor > >> 00000CFD49 <- usb serial id > >> 008e > >> 0ccd > >> 080702001788 > >> 6377 > >> 058f > >> 920321111113 > >> 0000 <- nothing attached here > >> 0000 > >> 0000:00:02.0 > >> 0000 > >> 0000 > >> 0000:00:02.1 > >> > >> $ lsusb > >> Bus 002 Device 008: ID 0ccd:008e TerraTec Electronic GmbH > >> Bus 002 Device 003: ID 058f:6377 Alcor Micro Corp. > >> Bus 002 Device 002: ID 04fc:0c15 Sunplus Technology Co., Ltd > >> Bus 002 Device 001: ID 0000:0000 > >> Bus 001 Device 001: ID 0000:0000 > >> > >> I use kernel 2.6.24.21 here; but the sysfs entries have been available > >> for quite some time already. > >> > >> Markus > > > > Yes, it is a pvr-usb-device with an mpeg-encoder which resides > > under /sys/class/pvrusb2/. And exactly this difference shows that it > > should be solved by the driver's bus_info-string and not by programming > > this logic into an app. > > > > OK, I'm done for today. I'm arguing this for two full days now. :( > > > > I understand, it should be fixed in the driver yes. > Markus: Of course he's talking about the pvrusb2 driver. This thread first started last week on the pvrusb2 mailing list and when Mauro rejected the resulting patch to adjust bus_info (something I also initially rejected but was convinced otherwise later), the discussion came here. In an earlier reply you said that the usb-core should be responsible for the serial number. Well in this case that's impossible. For Hauppauge devices handled by this driver, the serial number is not in the USB config data, but held in a non-standard private device-resident I2C ROM that is read by the tveeprom module in v4l-dvb and made directly available to the pvrusb2 driver itself. The information is not available as USB configuration data so there's no way for the USB core ever learn of the device's serial number. Basically the vendor has set things up so that the serial number is intrinsic to the device instance itself not the particular connection mechanism (e.g. USB). Of course, with all that said, I do agree that it would be very useful for that serial number to be available to udev (and thus it becomes visible in the sorts of ways that Mauro was suggesting). I'm reasonably certain this is done by the pvrusb2 driver stuffing it into a magic kobject that is linked into a magic location. But the last time I tried to figure this out, I came up completely empty. Right now I don't know how to do this, and the LDD3 is too old apparently to describe it. Honestly there's probably more digging I can do but I've got other higher priority issues to contend with and since the bus_info strategy is off the table, this problem is still left unsolved. I do find it disheartening that the querycap command can return all sorts of info about the device and it's too bad no allowance was ever made there to also include some sort of specific device-tagging unique (for a given device type) identifier, such as a serial number. Carsten is trying to do something that should in concept be simple, but the response he's getting involves a lot of complexity instead :-( -Mike -- Mike Isely isely @ pobox (dot) com PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8 -- 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] 13+ messages in thread
end of thread, other threads:[~2009-01-16 4:14 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-15 14:41 How to identify USB-video-devices Carsten Meier
2009-01-15 15:20 ` Markus Rechberger
2009-01-15 15:33 ` Carsten Meier
[not found] ` <09CD2F1A09A6ED498A24D850EB10120817E30B7506@Colmatec004.COLMATEC.INT>
2009-01-15 16:51 ` Carsten Meier
2009-01-15 22:22 ` Pádraig Brady
2009-01-15 22:45 ` Markus Rechberger
2009-01-15 22:55 ` Carsten Meier
2009-01-15 23:40 ` Markus Rechberger
2009-01-16 0:27 ` Carsten Meier
2009-01-16 0:59 ` Markus Rechberger
2009-01-16 1:55 ` Carsten Meier
2009-01-16 2:03 ` Markus Rechberger
2009-01-16 4:14 ` Mike Isely
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox