Skip to contentSkip to conversation

How to force the device assignment with V4l V2.0?

DISCUSSION Ian Pickworth 3 participants 5 messages Oct 17, 2008 – Oct 18, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

I'm having a play with the latest code from hg on the 2.6.27 kernel, Gentoo installation. This is triggered by the gspca driver being absorbed into the main tree (which is a great move by the way).

I have two devices - a CX88 based Hauppauge TV PCI card, and a USB webcam. In the "old" style drivers, I could force the loading of the two modules (cx8800 and gspca) in a set sequence, using blacklist and modules.autoload. This is enough to ensure that cx88 gets /dev/video0, and the usb webcam gets /dev/video1.

However, when trying a recent hg snapshot, the sequence of loading the modules does not change what the V4l driver is doing when loaded. Looking at dmesg, I see that the new drivers are doing quite a lot of detecting work themselves - it looks like they pick up the USB device first regardless of the module blacklist/load sequence I have specified.

So, question is: Is there a preferred way of forcing the sequence of device assignment in V4L these days? I need the cx88 to be /dev/video0 and the USB webcam to be /dev/video1 - otherwise all sorts of programs get confused.

Many thanks
Regards
Ian

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

#1 lore raw
Quoted 5 lines · Ian Pickworth

I have two devices - a CX88 based Hauppauge TV PCI card, and a USB webcam. In the "old" style drivers, I could force the loading of the two modules (cx8800 and gspca) in a set sequence, using blacklist and modules.autoload. This is enough to ensure that cx88 gets /dev/video0, and the usb webcam gets /dev/video1.

I 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

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

#2 lore raw
Quoted 12 lines · Pádraig Brady
Quoted 5 lines · Ian Pickworth

I have two devices - a CX88 based Hauppauge TV PCI card, and a USB webcam. In the "old" style drivers, I could force the loading of the two modules (cx8800 and gspca) in a set sequence, using blacklist and modules.autoload. This is enough to ensure that cx88 gets /dev/video0, and the usb webcam gets /dev/video1.

I 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 6 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

I did think about that, but the problem is that applications want to see /dev/video(n) style names. Especially TV Time that (I think) uses /dev/video - set to link to /dev/video0 by the standard udev rules.

I could be wrong - how does one get these programs to recognize the custom links created by udev rules? Or, is it possible to get udev to change /dev/video(n) assignment based on udev rules? I'm thinking not, since one of the things you can match on is KERNEL.

Regards
Ian

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

#3 lore raw
Quoted 18 lines · Ian Pickworth
Quoted 16 lines · Pádraig Brady
Quoted 6 lines · Ian Pickworth

I have two devices - a CX88 based Hauppauge TV PCI card, and a USB webcam. In the "old" style drivers, I could force the loading of the two modules (cx8800 and gspca) in a set sequence, using blacklist and modules.autoload. This is enough to ensure that cx88 gets /dev/video0, and the usb webcam gets /dev/video1.

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

To find distinguishing attributes to match on use:

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

I did think about that, but the problem is that applications want to see /dev/video(n) style names. Especially TV Time that (I think) uses /dev/video - set to link to /dev/video0 by the standard udev rules.

A bit more research and I can see how to set TVTIME to use a different

device:
In ~/.tvtime/tvtime.xml set this line:
<option name="V4LDevice" value="/dev/v4l/video0"/> or whatever the device is you want.

So I can have a go at the udev solution - I'll try it a bit later.

Thanks
Regards
Ian

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

#4 lore raw
In reply to Ian Pickworth
Quoted 16 lines · Ian Pickworth

I'm having a play with the latest code from hg on the 2.6.27 kernel, Gentoo installation. This is triggered by the gspca driver being absorbed into the main tree (which is a great move by the way).

I have two devices - a CX88 based Hauppauge TV PCI card, and a USB webcam. In the "old" style drivers, I could force the loading of the two modules (cx8800 and gspca) in a set sequence, using blacklist and modules.autoload. This is enough to ensure that cx88 gets /dev/video0, and the usb webcam gets /dev/video1.

However, when trying a recent hg snapshot, the sequence of loading the modules does not change what the V4l driver is doing when loaded. Looking at dmesg, I see that the new drivers are doing quite a lot of detecting work themselves - it looks like they pick up the USB device first regardless of the module blacklist/load sequence I have specified.

Quoted 4 lines

So, question is: Is there a preferred way of forcing the sequence of device assignment in V4L these days? I need the cx88 to be /dev/video0 and the USB webcam to be /dev/video1 - otherwise all sorts of programs get confused.

If you have an up to date udev you should have rules that creates persistent symlinks in /dev/v4l/by-path/

See the patches and rules here:
http://marc.info/?l=linux-video&m=120936768608839&w=2

Cheers,

Brandon

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