Skip to contentSkip to conversation

How to identify USB-video-devices

DISCUSSION Carsten Meier 4 participants 13 messages Jan 15, 2009 – Jan 16, 2009 1 message not in the archive Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#1 lore raw
Quoted 17 lines · Carsten Meier

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.

Quoted 4 lines

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#2 lore raw

Am Thu, 15 Jan 2009 16:20:23 +0100
schrieb "Markus Rechberger" <[email protected]>:

Quoted 25 lines · Carsten Meier
Quoted 19 lines

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.

Quoted 4 lines

What do you think?
(BTW: I'm not a kernel-hacker, I'm writing this from the perspective of an app-developer)

Quoted 8 lines

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

A message that is not in the archive (sent off-list or not yet received): 09CD2F1A09A6ED498A24D850EB10120817E30B7506@Colmatec004.COLMATEC.INT

#4 lore raw
Quoted 58 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Carsten Meier Sent: 15 janvier 2009 10:34 To: Markus Rechberger
Cc: [email protected]
Subject: Re: How to identify USB-video-devices

Am Thu, 15 Jan 2009 16:20:23 +0100
schrieb "Markus Rechberger" <[email protected]>:

Quoted 26 lines
Quoted 19 lines · Carsten Meier

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.

Quoted 4 lines

What do you think?
(BTW: I'm not a kernel-hacker, I'm writing this from the perspective of an app-developer)

Quoted 8 lines

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.

Quoted 5 lines

I really think that current behaviour is broken.

Regards,
Carsten

Am Thu, 15 Jan 2009 10:55:40 -0500
schrieb Jonathan Lafontaine <[email protected]>:

Quoted 8 lines

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.

Quoted 6 lines

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#5 lore raw
Quoted 2 lines · Carsten Meier

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#6 lore raw
Quoted 9 lines · Pádraig Brady
Quoted 2 lines · Carsten Meier

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.

Quoted 7 lines

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#7 lore raw
In reply to Pádraig Brady

Am Thu, 15 Jan 2009 22:22:11 +0000
schrieb Pádraig Brady <[email protected]>:

Quoted 13 lines
Quoted 2 lines · Carsten Meier

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"

Quoted 6 lines

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#8 lore raw
Quoted 23 lines · Carsten Meier

Am Thu, 15 Jan 2009 22:22:11 +0000
schrieb Pádraig Brady <[email protected]>:

Quoted 13 lines
Quoted 2 lines · Carsten Meier

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"

Quoted 6 lines

To find distinguishing attributes to match on use:

echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p

cheers,
Pádraig.

Quoted 9 lines

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.

Quoted 6 lines

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.

Quoted 8 lines

Regards,
Carsten

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#9 lore raw

Am Fri, 16 Jan 2009 00:40:47 +0100
schrieb "Markus Rechberger" <[email protected]>:

Quoted 39 lines · Carsten Meier
Quoted 23 lines

Am Thu, 15 Jan 2009 22:22:11 +0000
schrieb Pádraig Brady <[email protected]>:

Quoted 13 lines
Quoted 2 lines · Carsten Meier

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"

Quoted 6 lines

To find distinguishing attributes to match on use:

echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p

cheers,
Pádraig.

Quoted 9 lines

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.

Quoted 5 lines

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.

Quoted 10 lines
Quoted 10 lines

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

Quoted 6 lines
Quoted 6 lines

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#10 lore raw
Quoted 48 lines · Carsten Meier

Am Fri, 16 Jan 2009 00:40:47 +0100
schrieb "Markus Rechberger" <[email protected]>:

Quoted 39 lines · Carsten Meier
Quoted 23 lines

Am Thu, 15 Jan 2009 22:22:11 +0000
schrieb Pádraig Brady <[email protected]>:

Quoted 13 lines
Quoted 2 lines · Carsten Meier

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"

Quoted 6 lines

To find distinguishing attributes to match on use:

echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p

cheers,
Pádraig.

Quoted 9 lines

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.

Quoted 5 lines

cat /sys/class/video4linux/video0/device/serial
080702001788

you have the nodename in it, there are many ways to retrieve the nodename.

Quoted 8 lines

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#11 lore raw

Am Fri, 16 Jan 2009 01:59:51 +0100
schrieb "Markus Rechberger" <[email protected]>:

Quoted 89 lines · Carsten Meier
Quoted 50 lines

Am Fri, 16 Jan 2009 00:40:47 +0100
schrieb "Markus Rechberger" <[email protected]>:

Quoted 41 lines
Quoted 23 lines · Carsten Meier

Am Thu, 15 Jan 2009 22:22:11 +0000
schrieb Pádraig Brady <[email protected]>:

Quoted 13 lines
Quoted 2 lines · Carsten Meier

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"

Quoted 6 lines

To find distinguishing attributes to match on use:

echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p

cheers,
Pádraig.

Quoted 10 lines

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.

Quoted 5 lines

cat /sys/class/video4linux/video0/device/serial
080702001788

you have the nodename in it, there are many ways to retrieve the nodename.

Quoted 8 lines

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
Quoted 4 lines

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#12 lore raw
Quoted 95 lines · Carsten Meier

Am Fri, 16 Jan 2009 01:59:51 +0100
schrieb "Markus Rechberger" <[email protected]>:

Quoted 92 lines · Carsten Meier
Quoted 50 lines

Am Fri, 16 Jan 2009 00:40:47 +0100
schrieb "Markus Rechberger" <[email protected]>:

Quoted 41 lines
Quoted 23 lines · Carsten Meier

Am Thu, 15 Jan 2009 22:22:11 +0000
schrieb Pádraig Brady <[email protected]>:

Quoted 13 lines
Quoted 2 lines · Carsten Meier

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"

Quoted 6 lines

To find distinguishing attributes to match on use:

echo /sys/class/video4linux/video* | xargs -n1 udevinfo -a -p

cheers,
Pádraig.

Quoted 10 lines

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.

Quoted 5 lines

cat /sys/class/video4linux/video0/device/serial
080702001788

you have the nodename in it, there are many ways to retrieve the nodename.

Quoted 8 lines

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.

Quoted 9 lines
Quoted 1 line

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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#13 lore raw
Quoted 4 lines · Markus Rechberger
Quoted 3 lines · Carsten Meier

Am Fri, 16 Jan 2009 01:59:51 +0100
schrieb "Markus Rechberger" <[email protected]>:

[...]

Quoted 40 lines
Quoted 40 lines
Quoted 30 lines

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
Quoted 4 lines

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.

Quoted 5 lines
Quoted 2 lines

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

Signature · 8 lines
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:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list