LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   /dev/video devices keep switching (http://www.linuxquestions.org/questions/linux-hardware-18/dev-video-devices-keep-switching-664770/)

pickarooney 08-23-2008 02:52 AM

/dev/video devices keep switching
 
Each time I boot to Kubuntu my TV tuner and webcam switch device names, i.e. the webcam becomes /dev/video0 and the tuner becomes /dev/video1. On the next bootup they will switch back. This has the effect that my shortcut to my TV viewer application needs to be edited each time I reboot, which is a bit of a pain and not obvious for the lambda users of the PC. Is there some way of assigning these device names on a permanent basis?

Alternatively, does anyone know a way of configuring TVTime to default to a specific named device rather than its /dev/video* location?

pinniped 08-23-2008 03:31 AM

If the drivers make use of 'udev', you can control either the naming itself or symlinks to the devices by adding a rules file to /etc/udev/rules.d with appropriate rules; you may wish to read through existing rules to see if any of them affect your devices; if they do not, then you can give your rules file any priority you want and optionally end with a OPTIONS+="last_rule".


For example, on my machine:
cd /sys/class/video4linux
udevinfo -a -p ${PWD}/video0

I see things like this:
looking at device '/class/video4linux/video0':
KERNEL=="video0"
SUBSYSTEM=="video4linux"
DRIVER==""
ATTR{name}=="cx88_0_ video _Hauppauge WinTV-"
ATTR{dev}=="81:0"

So I can make a rule like this:
KERNEL=="video*", ATTR{name}=="cx88_0_ video _Hauppauge WinTV-", NAME="video1", OPTIONS+="last_rule"

See how I rename from "video-whatever" to "video1". Another option is to use "SYMLINK" rather than "NAME":
SYMLINK+="dvbt_tuner"

pickarooney 08-23-2008 04:54 AM

My video0 file begins with these lines

Code:

  looking at device '/devices/pci0000:00/0000:00:13.0/usb1/1-2/video4linux/video0':
    KERNEL=="video0"
    SUBSYSTEM=="video4linux"
    DRIVER==""
    ATTR{dev}=="81:0"
    ATTR{name}=="GSPCA USB Camera"
    ATTR{stream_id}=="GBRG"
    ATTR{model}=="Pixart PAC207-BCA"
    ATTR{pictsetting}=="force_rgb=0, gamma=3, OffRed=0, OffBlue=0, OffGreen=0, GRed=256, GBlue=256, GGreen= 256 "

and video1 with these

Code:


  looking at device '/devices/pci0000:00/0000:00:14.4/0000:02:00.0/video4linux/video1':
    KERNEL=="video1"
    SUBSYSTEM=="video4linux"
    DRIVER==""
    ATTR{dev}=="81:1"
    ATTR{name}=="BT878 video _Hauppauge _bt878__"
    ATTR{card}=="10"

Should I change the KERNEL== lines in both of these to

KERNEL=="video*", ATTR{name}=="GSPCA USB Camera", NAME="video0", OPTIONS+="last_rule"

and

KERNEL=="video*", ATTR{name}=="BT878 video _Hauppauge _bt878__", NAME="video1", OPTIONS+="last_rule"

respectively?

Would I need to change any other lines in this?

Thanks very much, by the way.


All times are GMT -5. The time now is 05:19 PM.