LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-12-2008, 12:28 PM   #1
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Rep: Reputation: 30
Question How can I assign a webcam to a specific /dev/video#?


Here's the situation. I have a MythTV box with 2 pci capture devices and a usb web cam I plug in every now and then. The problem happens if I leave the webcam plugged in and reboot. It assigns the webcam as /dev/video0 and the 2 capture cards as 1 and 2, which messes up MythTV. Is there a way to set the assignment of the USB device to say 3 or 4 so it won't mix up my devices if I have it plugged in or not?

Thanks,
Adam
 
Old 09-12-2008, 12:45 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,038

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
This is what udev is for.
You need to write a udev rule for your webcam to make it always be assigned to /dev/webcam for example.
See here: http://www.reactivated.net/writing_udev_rules.html
 
Old 09-24-2008, 07:46 AM   #3
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Original Poster
Rep: Reputation: 30
Thanks tredegar. That got me on the right track. I'm testing out a udev rule right now. I appreciate your help.
 
Old 09-24-2008, 10:42 AM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,038

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Quote:
I'm testing out a udev rule right now
Excellent! I hope you are making progress.

Please post your solution (when you have it) as I am sure other people will be interested to read how you went about writing your rule, deciding where to put it, and how you tested it.

You could even send Daniel Drake (who wrote "Writing udev rules") a link to your post here in case he'd like to include it in his list of examples.
 
Old 09-25-2008, 02:23 PM   #5
windisch
Member
 
Registered: Nov 2004
Location: Gahanna, Ohio, USA
Distribution: Fedora 9
Posts: 158

Original Poster
Rep: Reputation: 30
I'll try to do my best.

The pages that helped me figure this out were:

http://liquidat.wordpress.com/2008/0...or-udev-rules/
and
http://ubuntuforums.org/showthread.php?p=5698771

In my situation I did an lsusb and got this output:

Code:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 046d:08b2 Logitech, Inc. QuickCam Pro 4000
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 004: ID 03f0:020c Hewlett-Packard Multimedia Keyboard
Bus 002 Device 003: ID 03f0:010c Hewlett-Packard Multimedia Keyboard Hub
Bus 002 Device 002: ID 045e:0039 Microsoft Corp. IntelliMouse Optical
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Now that I found my ID for my Logitech Webcam, I created a udev rule at
Code:
/etc/udev/rules.d/25-name-video-devices.rules
Which contained:

Code:
SUBSYSTEM=="video4linux", BUS=="usb", SYSFS{idVendor}=="046d", SYSFS{idProduct}=="08b2", NAME="video5"
I pulled the Webcam out and back in and it went straight to /dev/video5! No more MythTV Conflicts!
 
Old 09-25-2008, 08:37 PM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,038

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Quote:
No more MythTV Conflicts!
Good.
You got it working.
But better:
You did your own research, followed simple advice (I just pointed you at udev), but you not only found the solution on your own but then explained how, and gave good links, so others will hopefully find their solution from this thread, hopefully without having to ask anything further at all.

If your two capture cards ever start swapping their /dev/names you will now know what to do to lock them into their right places.

Happy MythTV (I gave up on that a few years ago, maybe it's time for another try. Linux gets better by the month )

Congratulations, and thanks for the follow-up.
Have fun with linux.
 
  


Reply

Tags
cam, udev, udevrules, usb, web, webcam


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
/dev/video problem with TV tuner & webcam Road_map Slackware 1 07-31-2007 12:26 PM
Assign different shells to specific users in a winbind m2azer Linux - Newbie 0 01-18-2007 08:42 PM
spca50x-based webcam /dev/video problems nwhite Linux - Hardware 3 03-31-2005 08:59 PM
How do you assign a process to a specific processor? ter_roshak Linux - General 1 12-19-2003 01:38 AM
Assign Privs to specific user sikandar Linux - Software 13 08-31-2003 03:12 AM


All times are GMT -5. The time now is 09:26 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