pwc driver


32 posts   Page 1 of 2   1, 2
by p4trykx » Wed Jun 27, 2012 8:35 pm
I connected Logitech Quickcam pro 4000. It's an old webcam on some philips chip. It has pwc driver. Some time in the past there was a bug in this driver. But in the current kernel for x86 it seems to work. Checked with my laptop. I also successfully run it on OpenWrt on Broadcom based router and motion.
Unfortunately it does not work with raspberry: (
I use latest Archlinux. I tried to connect it throug hub and drictly.
pwc module loads and there is /dev/video0 but when I run motion it hangs.
lsusb
Bus 001 Device 004: ID 046d:08b2 Logitech, Inc. QuickCam Pro 4000

dmesg shows this
Linux video capture interface: v2.00
pwc: Logitech QuickCam 4000 Pro USB webcam detected.
pwc: Registered as video0.


and when I run motion it hangs
and dmesg shows a lot of this
pwc: Iso frame 2 has error -4004
pwc: Iso frame 3 has error -4004
pwc: Iso frame 4 has error -4004
pwc: Iso frame 5 has error -4004
pwc: Iso frame 6 has error -4004
pwc: Iso frame 7 has error -4004
pwc: Iso frame 8 has error -4004
pwc: Iso frame 9 has error -4004
pwc: Failed to set LED on/off time (-32)
pwc: Failed to power off camera (-32)
vb2_vmalloc_put: Freeing vmalloc mem at vaddr=c8b6c000
vb2_vmalloc_put: Freeing vmalloc mem at vaddr=c8c50000
vb2_vmalloc_put: Freeing vmalloc mem at vaddr=c8d34000
vb2_vmalloc_put: Freeing vmalloc mem at vaddr=c8e18000


So I suspect that there is some bug. I wonder who should I report it to?
Posts: 118
Joined: Wed Jan 11, 2012 2:55 pm
by darkip » Thu Jun 28, 2012 4:21 pm
I can also confirm I've been having the same problem. I've tested with a range of distros (debian squeeze, raspbian, raspbmc) and had the same "Iso frame" errors.
Posts: 1
Joined: Thu Jun 28, 2012 4:20 pm
by reggie » Tue Jul 31, 2012 5:32 pm
I also have this error using a phlips spc900nc camera, I get lots of usb resets when I use the camera, my hub is pretty solid with it's own 2amp psu, 2amp solid 5v psu for the pi, it does attempt to capture a frame using fswebcam but it times out.
Posts: 151
Joined: Fri Aug 26, 2011 11:51 am
by p4trykx » Tue Jul 31, 2012 5:48 pm
It might as well be Raspi usb driver/hardware problem. I've read many posts that report these problems when using a HUB.
Posts: 118
Joined: Wed Jan 11, 2012 2:55 pm
by LeroyZ84 » Sat Aug 04, 2012 9:28 pm
exactly same problem here,
Tried some other grabbing utils, but still no effect :(
www.­djredmar.­com:­8080
Posts: 32
Joined: Fri Jul 27, 2012 9:23 pm
Location: Earth, Europe, Netherlands, Deventer
by sergiopasra » Fri Sep 21, 2012 2:22 pm
I experience the same problems using Fedora Remix, The webcam is contected directly to the rasp
Posts: 1
Joined: Fri Sep 21, 2012 2:19 pm
by themos » Fri Sep 21, 2012 4:49 pm
After having similar problems with my Philips SPC900NC (actually a 880 but firmware flashed to 900) I was able to use it last night with an astronomical software called OpenPHD. I will investigate further what causes success and failure as I had to give the pwc kernel module some options.
Posts: 7
Joined: Fri Sep 21, 2012 4:47 pm
by reggie » Sat Sep 22, 2012 3:43 am
Hi themos, fancy bumping into you here :D I have code for openPhd that should let us do long exposure, you can grab it from the openphd site from this post I made: http://code.google.com/p/open-phd-guidi ... l?id=29#c7

So are you getting full resolution images from your spc webcam in the phd you're using? I haven't tried it since the new updates, been messing with something else.

The code to get long exposure running in the linux version of openPHD is super simple, we could expand on it to use anything we like to do the switching, by that I mean it currently uses cts/rts but you could just as easily use an ftdi chip and it's gpio pins, or an arduino via serial commands, pic chip, etc.
Posts: 151
Joined: Fri Aug 26, 2011 11:51 am
by themos » Mon Sep 24, 2012 11:07 am
No, I can't get vga resolution (640x480). I do get 320x240 though, and a decent framerate, by using lin_guider. We need to sort out the pwc module, it seems that some apps manage to use it effectively, others don't. Perhaps we should rewrite pwc just for the SPC900NC, no compression, VGA resolution and 5 fps, ust for astro autoguiding purposes.
Posts: 7
Joined: Fri Sep 21, 2012 4:47 pm
by reggie » Mon Sep 24, 2012 12:35 pm
oh cool, at least you're getting better than 160x120 :D I'm guessing that the pwc driver is missing lots of stuff and hasn't had a great deal of attention in the last few years,it needs dragging up to date
Posts: 151
Joined: Fri Aug 26, 2011 11:51 am
by p4trykx » Mon Sep 24, 2012 2:20 pm
But pwc with my camera works just fine on Ubuntu x64 and also on a router with some Broadcom SoC and kernel 2.6.x
So you mean that there has to be some rewrite for Raspberry Pi architecture?
Posts: 118
Joined: Wed Jan 11, 2012 2:55 pm
by themos » Mon Sep 24, 2012 2:58 pm
p4trykx wrote:But pwc with my camera works just fine on Ubuntu x64 and also on a router with some Broadcom SoC and kernel 2.6.x
So you mean that there has to be some rewrite for Raspberry Pi architecture?


which kernel version? Which camera? which app opens the device? what is "just fine" exactly?
Posts: 7
Joined: Fri Sep 21, 2012 4:47 pm
by mister_wavey » Mon Sep 24, 2012 3:20 pm
I have same problem: philips toucam 740K works on x86 linux (3.2.0 kernel) but not on rasbian (3.2.27+)
User avatar
Posts: 98
Joined: Sun Sep 02, 2012 8:23 am
Location: Abergavenny, Wales, UK
by p4trykx » Mon Sep 24, 2012 3:26 pm
Camera is Logitech QuickCam Pro 4000 the same as in the first post. On OpenWrt I use it with motion and resolution 640x480. It is connected through a powered 7-port HUB or directly. The kernel version is 2.6.2something(can't remember exactly). The router is a Asus WL-500W it's brcm46xx.
When writing fine I mean that motion displays what the camera sees and detected frames are saved do disk.
On my laptop i tried it with Ubuntu 11.04 with 2.6 kernel and Ubuntu 12.04 with 3.x.x kernel. It displays fluent image in Cheese and also records in Motion when motion is detected.
So one can say that this drivers works fine on those architectures.

I don't know if there is some specific code for Raspberry but most likely the driver is OK and USB implementation is bad or maybe the driver just works only with some usb drivers.

I contacted the maintainer of the driver before I discovered that usb on Raspi generally does not work as expected.
Posts: 118
Joined: Wed Jan 11, 2012 2:55 pm
by reggie » Tue Sep 25, 2012 12:57 pm
The driver works, that's about all you can say, you can say it's stable on X86/A64 architectures and that bcm chip but that's about it :) You're quite possibly correct that the drivers are OK but not particularly on the pi, especially with the 'specialised' software that we're using and the out of spec method we're using to grab the actual frame of data that we want.

Themos and I both have a specific webcam that can be hardware modified to take long exposure single shots, the FPS will be something like 1 shot every 2 seconds with the exposure length to match or longer. With that in mind, it's quite possible that the drivers need looking at to accomodate what we want to do.

Themos, I wonder if it might be worth talking to the guys doing the usb fixes and send them a camera, I've got 3 here, I don't mind donating one to the cause :)
Posts: 151
Joined: Fri Aug 26, 2011 11:51 am
by reggie » Tue Sep 25, 2012 1:13 pm
Oh and I nearly forgot, the drivers sort of work in windows etc, except that the ioctls appear to be missing/broken.
Posts: 151
Joined: Fri Aug 26, 2011 11:51 am
by pluggy » Tue Sep 25, 2012 3:54 pm
Welcome to the Pi's crippled USB implementation ;)

After power problems (which can be worked around) you run into USB problems (which often can't). The drivers are gradually getting better, but I doubt they'll ever work properly. The USB implementaion is a 3rd party fudge onto a Broadcom SOC and nobody (not even Broadcom it seems) really knows how it works. Its highly dependent on a lot of attention from the ARM processor, and the nature of Linux (multi tasking operating system) means it often can't give the USB the attention it needs to work properly. In some cases the overlying protocols will save the situation, but with things like Webcams and WiFi adapters it falls apart. I have a whole load of USB stuff that works flawlessly on a PC with Linux, but the Pi won't entertain them.
Don't judge Linux by the Pi.......
User avatar
Posts: 2078
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by reggie » Wed Sep 26, 2012 2:04 pm
Well, like I said, the pwc driver based webcams that themos and I own have a very specific use case, I haven't looked into it too much but we are not using anywhere near the kind of data rate that most people would want so in theory, we probably don't need to do anything like the data transfer. We can slow our framerate/exposure to 1 frame per 30seconds or a 30 second exposure (actually we can probably expose indefinitely but the image quality would probably end up naff unless we did some cooling). The pwc driver has been written around using webcams how they were intended to be used, we actually access the long exposure via a serial pin (we toggle cts when we want to expose), so at the very least it might be reasonable for us to try and get that code into the pwc driver, or see if we can hack up the pwc driver for our specific use case :)
Posts: 151
Joined: Fri Aug 26, 2011 11:51 am
by rogerjames99 » Fri Sep 28, 2012 3:25 pm
Hello,

I have also been trying to get a modded spc900nc working on rasbian. The only way I have found to get it working is directly plugged into the pi and with the frame size set to minimum (160 x 120). I am driving it via a modded version of the indi_v4l_philips driver (and of course the kernel pwc driver). The current trunk version of the indi_v4l_philips and indi_v4l_generic drivers are broken when built against v4l2. They will only allow the very first single frame capture to work. I have hacked in a very dirty fix in anyone is interested.

Index: /home/roger/INDI-development/indi/libindi/libs/webcam/v4l2_base.cpp
===================================================================
--- /home/roger/INDI-development/indi/libindi/libs/webcam/v4l2_base.cpp (revision 733)
+++ /home/roger/INDI-development/indi/libindi/libs/webcam/v4l2_base.cpp (working copy)
@@ -312,7 +312,7 @@
buf.memory = V4L2_MEMORY_MMAP;
buf.index = i;

- if (-1 == xioctl (fd, VIDIOC_QBUF, &buf))
+ if ((-1 == xioctl (fd, VIDIOC_QBUF, &buf)) && (EINVAL != errno))
return errno_exit ("StartCapturing IO_METHOD_MMAP: VIDIOC_QBUF", errmsg);

}

I know there are problems with the pwc driver when the camera is plugged into a USB2.0 hub. I don't know if they are fixable without a major rewrite. But the problems when directly plugged in would seem to be related to the raspi USB implementation.

It has been so long since I used this camera that I have forgotten what the little switch bodged into it actually does! However I will look at whether the pwc driver allows the frame rate to be controlled via v4l2 ioctls. If it does I will hack support for that into the indi driver and see if that helps.

Roger
Posts: 2
Joined: Fri Sep 28, 2012 2:58 pm
by p4trykx » Fri Sep 28, 2012 5:57 pm
I know there are problems with the pwc driver when the camera is plugged into a USB2.0 hub. I don't know if they are fixable without a major rewrite. But the problems when directly plugged in would seem to be related to the raspi USB implementation.

I don't know if it helps but...
Actually when You connect the camera direct it's already connected through a HUB. The lan chip is connected to the same usb port on Broadcom processor. There is only one USB.
Posts: 118
Joined: Wed Jan 11, 2012 2:55 pm
by themos » Fri Sep 28, 2012 9:28 pm
I think that some apps just get lucky and do the right (for the pwc module) ioctls in the right order and get away with it. But that's just a hunch.
Posts: 7
Joined: Fri Sep 21, 2012 4:47 pm
by reggie » Sat Sep 29, 2012 5:11 pm
nope, I believe the driver implementation changed somewhere and quite a few of the ioctls were lost/removed. I don't seem to recall having issues with the spc plugged into a usb2 hub, unless you're specifically talking about the pi?

I haven't tried it yet with the latest raft of usb fixes but same as roger, I can only ever use 160x120 but most apps do actually work.
Posts: 151
Joined: Fri Aug 26, 2011 11:51 am
by rogerjames99 » Sun Sep 30, 2012 8:54 am
I did so many tests I got mixed up. The camera does work on the hub. Just not at higher resolution. Looking at the kernel code all the functionality appears to be still there. But the move from v4l1 to v4l2 has pulled access to some functionality up into the v4l2 API and out of the private ioctls. Exposure and fps in particular are now accessed in this way. The user space INDI driver is a bit of a tangled web in this area and I am still trying to understand it!

Roger
Posts: 2
Joined: Fri Sep 28, 2012 2:58 pm
by reggie » Sun Sep 30, 2012 1:07 pm
I've shorted the polyfuses on my pi, the camera works plugged directly into the pi, moving a mouse is enough for the camera to stall at 160x120 and it doesn't display any resolution bigger than that.
Posts: 151
Joined: Fri Aug 26, 2011 11:51 am
by p4trykx » Tue Oct 02, 2012 9:21 am
I can confirm that it works only in 160x120 and 1 frame/second with motion. It works this way connected throug a powered HUB.
However motion needs modulo 16 resolution so I set 160x128 and it's ok.

So I think we have to wait for better USB driver on Raspi. I doubt if it will be ever available.
Posts: 118
Joined: Wed Jan 11, 2012 2:55 pm