LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 08-23-2008, 03:52 AM   #1
pickarooney
Member
 
Registered: Aug 2003
Distribution: (X)ubuntu Maverick
Posts: 152

Rep: Reputation: 15
/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?
 
Old 08-23-2008, 04:31 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
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"
 
Old 08-23-2008, 05:54 AM   #3
pickarooney
Member
 
Registered: Aug 2003
Distribution: (X)ubuntu Maverick
Posts: 152

Original Poster
Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Switching Ethernet devices on boot omega9380 Linux - Networking 1 02-21-2006 08:36 PM
switching between/activate network devices snow_bound Mandriva 3 06-04-2005 01:48 AM
Switching between two sound output devices in FC2 fat-guy Linux - Hardware 3 11-24-2004 09:18 PM
mounting 2 ide-scsi devices /dev/cdrom and /dev/cdrom1 issue penguin123 Linux - Hardware 3 09-26-2003 09:36 PM
Two Video Devices - /dev/video0 & /dev/video1 liguorir Linux - Software 1 07-21-2003 09:20 PM


All times are GMT -5. The time now is 06:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration