LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 09-14-2010, 10:45 AM   #1
Linux31
Member
 
Registered: Aug 2004
Posts: 296

Rep: Reputation: 30
Ubuntu 10.04 - Suddenly /dev/video0 Fails to open


I'm running Ubuntu Lynx on an AMD dual-core machine that has a Hauppauge PVR-150 card and a Logitech webcam (recently installed).

The webcam seemed to preempt the /dev/video0 identity but ran fine under Cheese for about 2 weeks. Suddenly, yesterday neither the webcam nor the PVR will run. I removed Cheese and the webcam but still no success.

When I run ivtv-tune c-3 to check video0 I get:
Failed to open /dev/video0

I checked and there is a /dev/video0 file.

I tried creating a udev rule and making the webcam video5 but that didn't help.

I still get the video0 failure message even after doing a complete removal of Cheese and the webcam so that takes care of any conflict.

I have no idea what is wrong or how to fix it. Does anyone have any suggestions?

Thanks for any help that you can provide.
 
Old 09-14-2010, 03:35 PM   #2
Rambo_Tribble
Member
 
Registered: Aug 2005
Location: N 44 Deg. 56.537' W 123 Deg. 3.683'
Distribution: Kubuntu, MEPIS, SUSE & Debian
Posts: 30

Rep: Reputation: 19
Does dmesg offer any salient information?
 
Old 09-14-2010, 04:10 PM   #3
Linux31
Member
 
Registered: Aug 2004
Posts: 296

Original Poster
Rep: Reputation: 30
Thanks for the suggestion.

dmesg shows entries indicating that it sees both the Haupaugge card and the webcam so I seem to have a problem with /dev/video0 rather than a HW problem.
 
Old 09-14-2010, 04:46 PM   #4
Rambo_Tribble
Member
 
Registered: Aug 2005
Location: N 44 Deg. 56.537' W 123 Deg. 3.683'
Distribution: Kubuntu, MEPIS, SUSE & Debian
Posts: 30

Rep: Reputation: 19
I'm not sure it will accomplish anything, but I might try removing the webcam, booting and fetching the contents of dmesg. Then I'd attach the cam and do a new reading of dmesg to see if any difference between the two shed any light on what seems to look like an assignment conflict.

I'm afraid I'm kind of shooting in the dark here, as I don't have a webcam. I do have a system with Lucid that has a Hauppauge card, (I'm not sure which model, offhand), and it shows /dev/video0, as well as video24 and 32.

Last edited by Rambo_Tribble; 09-14-2010 at 04:50 PM.
 
1 members found this post helpful.
Old 09-15-2010, 10:15 AM   #5
Linux31
Member
 
Registered: Aug 2004
Posts: 296

Original Poster
Rep: Reputation: 30
Thanks for the suggestions. That's what I ended up trying and I have the webcam back.

I think the original problem may have been caused by trying to hook up two of the same kind of webcams (same Logitech models). The OS couldn't tell them apart even when I assigned them each a different video number in a udev rule. The manufacturer and model id is the same. Maybe the problem would have gone away in the udev rule if they were different models or manufacturers.

Anyway, just one webcam and things are working again.

By any chance, do you know if there's a way of solving this problem of multiple copies of the same model HW with a udev rule?

Thanks again for the help.
 
Old 09-15-2010, 11:12 AM   #6
Rambo_Tribble
Member
 
Registered: Aug 2005
Location: N 44 Deg. 56.537' W 123 Deg. 3.683'
Distribution: Kubuntu, MEPIS, SUSE & Debian
Posts: 30

Rep: Reputation: 19
I'm glad to hear you have made some progress. Unfortunately, my knowledge of udev isn't sufficient to answer your question. My only thought is, that if the cameras have different MAC addresses, that might make it possible to get udev to differentiate between them.
 
Old 09-15-2010, 12:58 PM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
"Identical" devices can still be differentiated with udev rules by matching on the physical USB socket they are plugged into. You'll have to make a note to yourself so you remember which socket to plug which device into.

It's a while since I played with this but try looking at your cameras like this (I have a single USB cam (= 2 "virtual" identical devices, as long as I only use one at a time ), that is registered as /dev/video1 when I plug it in):

Plug it into "front USB socket" then
Code:
tred@laptop:~$ udevadm info -ap $(udevadm info -q path -n /dev/video1) > frontvid
Unplug it, wait a moment, plug it into "rear USB socket" then
Code:
tred@laptop:~$ udevadm info -ap $(udevadm info -q path -n /dev/video1) > rearvid

tred@laptop:~$ diff frontvid rearvid
8c8
<   looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/video4linux/video1':
---
>   looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/video4linux/video1':
15,16c15,16
<   looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0':
<     KERNELS=="2-1.2:1.0"
---
>   looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0':
>     KERNELS=="2-1.5:1.0"
28,29c28,29
<   looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2':
<     KERNELS=="2-1.2"
---
>   looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5':
>     KERNELS=="2-1.5"
37c37
<     ATTRS{urbnum}=="5140"
---
>     ATTRS{urbnum}=="5139"
48c48
<     ATTRS{devnum}=="5"
---
>     ATTRS{devnum}=="6"
64c64
<     ATTRS{urbnum}=="113"
---
>     ATTRS{urbnum}=="152"
90c90
<     ATTRS{urbnum}=="39"
---
>     ATTRS{urbnum}=="46"
tred@laptop:~$
The interesting bits are coloured,
Once you have established what the positional information you need to differentiate between the cameras is, you'll need a udev rule something like this:

BUS="usb", ID=="2-1.5:1.0", SYMLINK+="camfront"
BUS="usb", ID=="2-1.2:1.0", SYMLINK+="camrear"

Please let us know how you get on.
 
Old 08-29-2011, 11:23 AM   #8
washakie
LQ Newbie
 
Registered: Oct 2003
Location: california
Posts: 6

Rep: Reputation: 0
same problem on laptop

Hello, I'm raising an old thread here because it seems to be the most relevant my search has turned up...

I'm having a similar problem on a laptop, but I don't have the option of 'disconnecting' the camera to reset it. I was using it with Cheese, just fine, but for some reason it has recently stopped functioning.

Looking at dmesg, udevadm, etc. doesn't seem to reveal anything obvious. So I'm at a loss... also, note that if I do plug in another USB camera, it mounts at /dev/video1 and functions as expected.

Is there a way to 'simulate' an internal camera being disconnected? Or something else I can try?

Thank you.
 
Old 08-29-2011, 11:46 AM   #9
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Your laptop camera is probably seen as a USB device.
lsusb should list it, along with vendor : product ID codes. If it is listed,
please tell us what it says.

It is surprising that a second USB camera appears at /dev/video1 as
this suggests the built-in one was detected (presumably as /dev/video0).

It is unusual for cameras to stop working suddenly.

What distro of linux are you using, have you changed anything since the
camera was last working?

Is there anything in the BIOS to enable it? Or a function-key combination?

You could try booting a live distro from CD, and see if that can use your
built-in camera.

Quote:
Is there a way to 'simulate' an internal camera being disconnected?
Not as far as I know.
 
Old 08-29-2011, 12:52 PM   #10
washakie
LQ Newbie
 
Registered: Oct 2003
Location: california
Posts: 6

Rep: Reputation: 0
Hello, the attached file is output from udevadm with lsusb appended below.

I'm writing from a usb distro now, and there's no difference.

ubuntu@ubuntu:~$ lsusb
Bus 002 Device 003: ID 1005:b113 Apacer Technology, Inc. Handy Steno 2.0/HT203
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 04f2:b183 Chicony Electronics Co., Ltd
Bus 001 Device 004: ID 138a:0007 DigitalPersona, Inc
Bus 001 Device 003: ID 03f0:231d Hewlett-Packard
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

and udevadm seems to provide similar values as well...

Cheese also has the same response, no Error messages, it opens fine, but then just shows a blank empty screen... if I didn't know better, I'd think I left the lens cap on!!

Sorry, also should mention I'm running 11.04 ubuntu

Last edited by washakie; 08-29-2011 at 12:53 PM. Reason: release info
 
Old 08-29-2011, 01:29 PM   #11
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Your camera seems to be 04F2:B183 = "HP Webcam [2 MP Macro]" (took me a while to search on this, can you confirm it?)

Searching google returns precious little for this device, which might mean that it works perfectly with linux (as most HP stuff does), or that yours is just broken.

Can you boot to win? Does it work there?
 
Old 08-29-2011, 02:11 PM   #12
washakie
LQ Newbie
 
Registered: Oct 2003
Location: california
Posts: 6

Rep: Reputation: 0
Eeek. Hadn't thought of that possibility.

No, I'm committed. Third laptop with *nix. Haven't dual booted in several years. This is a weird issue, and I'm at a loss where to look.
 
Old 08-29-2011, 02:50 PM   #13
washakie
LQ Newbie
 
Registered: Oct 2003
Location: california
Posts: 6

Rep: Reputation: 0
I've googled around to see other ways to test. The only I've come across that is helpful so far is VLC. Trying to open /dev/video0 I get the following output on the command line:

[0x17693c0] v4l2 demux error: cannot set input (Device or resource busy)
[0x17693c0] v4l2 demux error: cannot set input (Device or resource busy)
[0x1589b20] v4l2 access error: cannot set input (Device or resource busy)
libv4l2: error attempting to open more then 16 video devices
[0x1589b20] v4l2 access error: cannot set input (Device or resource busy)
[0x174f830] main input error: open of `v4l2:///dev/video0' failed: (null)

Then I thought to go back to cheese and run it from the command line to capture some output. I get this:

ubuntu@ubuntu:~$ cheese
libv4l2: error setting pixformat: Device or resource busy


So it seems somehow that /dev/video0 is getting 'grabbed' up by something else, but I don't know what?! It's as if the fix could be what the OP did, just unplug it and replug it, but I can't do that in this case... any further suggestions?
 
Old 08-29-2011, 04:20 PM   #14
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
No, I'm committed.
Ok. So am I.

Quote:
So it seems somehow that /dev/video0 is getting 'grabbed' up by something else, but I don't know what?
What other stuff have you recently installed? (motion maybe,) before your camera broke?

lsof /dev/video0 may give you some idea as to what might be grabbing the device.

If this does not help you, please start a new thread, with a suitable title, the body containing good information: your distro, camera details (please confirm these, as above) from lsusb

If you do this (and I think you should) I'd appreciate it if you posted a link to your new thread here, so I can be informed, and then follow it up.

I suspect the OP's to this original post have solved it, are long gone, or have lost interest.

Best wishes.

Last edited by tredegar; 08-29-2011 at 04:22 PM.
 
Old 08-29-2011, 04:48 PM   #15
washakie
LQ Newbie
 
Registered: Oct 2003
Location: california
Posts: 6

Rep: Reputation: 0
Unfortunately, I'm quite sure it is a hardware problem. My last post was in error (too many terminals open). On one terminal as a regular user I was trying to use streamer to take a picture with the web cam. In another terminal (tab) as root, I was doing the tests that produced the results I posted... thus, it was 'streamer' that was grabbing the device. Once I CTRL-C'd streamer (which was 'waiting for output', but otherwise showed no errors associated with /dev/video0), the other tests ran, but also only provided a black screen.

The last clue, is that the little blue LED light doesn't come on either. So I'm just not sure what is happening, but suspect it must be a connection that has gone bad. I plugged in two other webcams (one embedded in my second monitor and another external) and everything worked fine!

Thanks for your feedback. I learned about udevadm and now lsof
 
  


Reply

Tags
lynx, ubuntu, 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
v4l: open /dev/video0: No such file or directory mdkusr Linux - Hardware 1 11-08-2006 09:40 PM
Hauppauge-250 card gives ' cannot open capture device /dev/video0 ' message thouze Linux - Hardware 1 07-17-2006 07:57 AM
ivtv - can't open capture device - /dev/video0 rrrssssss Linux - Hardware 7 02-02-2006 09:39 AM
please help! Couldn't open /dev/video0 jrmontg Linux - Hardware 3 10-30-2005 06:47 PM
cannot open tv card and /dev/video0 device on suse 9.3 gros777 Linux - Hardware 1 08-05-2005 12:12 PM


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

Main Menu
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