Sunday, November 8, 2009

PS3 Eye Driver Patch

Update: A lot has happened since this was posted. The main line kernel now includes most of these fixes!

I've had a PS3 Eye lying around for a while but I hadn't gotten around to using it because when it first came out there were no drivers for it so it sat in my closet for almost a year. I decided to check out the current state of the PS3 Eye in Linux and was happy to find that there is now support in the 2.6.31 kernel.

What I was disappointed to find out though was that there was no ability to select frame rate or control a lot of the image quality. Lucky there is patch that allows selection of frames rates all the way up to 125 fps and some image quality controls. I patched my driver and tried it out but found that the color of the image was way off and none of the given controls could fix this.

I decided to do some research and add support for brightness, contrast, hue, and auto white balance.

before
With Kaswy's Patch


driver
With my patch


I'm going to just supply the whole .c file instead of a patch since they are almost the same size. Applying the patch is almost the same as Kaswy's

To apply:

Install necessary packages:

$ sudo apt-get install kernel-package libncurses5-dev wget bzip2 build-essential linux-source


Extract kernel source code:

$ sudo su
$ cd /usr/src
$ tar --bzip2 -xvf linux-source-2.6.(your version).tar.bz2
$ ln -s linux-source-2.6.(your version) linux


Replace driver:

$ cd linux
$ wget ucfilespace.uc.edu/~thrunml/ov534.c
$ rm drivers/media/video/gspca/ov534.c
$ mv ov534.c drivers/media/video/gspca/


Recompile driver:

$ cp /usr/src/linux-headers-$(uname -r)/Module.symvers /usr/src/linux
$ make oldconfig
$ make modules_prepare
$ make SUBDIRS=drivers/media/video/gspca modules


Install new driver:

$ cp drivers/media/video/gspca/gspca_ov534.ko /lib/modules/$(uname -r)/kernel/drivers/media/video/gspca
$ depmod


Check to make sure it installed:

$ modinfo gspca-ov534
filename: /lib/modules/2.6.31-14-generic/kernel/drivers/media/video/gspca/gspca_ov534.ko
license: GPL
description: GSPCA/OV534 USB Camera Driver(kaswy mod for MT use V0.5 / bear24rw patch V0.1)
author: Antonio Ospite
srcversion: 1F87820D2B0705822B61A16
alias: usb:v1415p2000d*dc*dsc*dp*ic*isc*ip*
depends: gspca_main
vermagic: 2.6.31.4 SMP mod_unload modversions
parm: videomode: = xx //Set the videomode(see doc) (int)
parm: autogain: = [0|1] //Autogain (agc,aec,awb) (bool)
parm: gain: = [0..63] //main gain (int)
parm: awb: = [0|1] //Auto White Balance (bool)
parm: exposure: = [0..255] //Exposure (int)
parm: brightness: = [0..255] //Brightness (int)
parm: contrast: = [0..255] //Contrast (int)
parm: redblc: = [0..255] //Red Balance (int)
parm: blueblc: = [0..255] //Blue Balance (int)
parm: hue: = [0..255] //Hue (int)
parm: sharpness: = [0..63] //Sharpness (int)
parm: vflip: = [0|1] //Vertical flip (bool)
parm: hflip: = [0|1] //Horizontal mirror (bool)


Now we can remove the one currently in use and load our new one:

$ modprobe -r gspca-ov534
$ modprobe gspca-ov534 videomode=10


The available video modes are:

00: 640x480@15
01: 640x480@30
02: 640x480@40
03: 640x480@50
04: 640x480@60
10: 320x240@30
11: 320x240@40
12: 320x240@50
13: 320x240@60
14: 320x240@75
15: 320x240@100
16: 320x240@125


You can adjust the image using guvcview

$ sudo apt-get install guvcview
$ guvcview


Hopefully the main line driver gets patched soon with these enhancements.

107 comments:

  1. Seems nice,
    but I don't know why it doesn't work good for me (a lot flickering, low framerate and some freezing ???).
    By the way, just to tell you you need to add a "make oldconfig" before to "make modules_prepare" in your tuto.
    thx

    ReplyDelete
  2. "Seems nice,
    but I don't know why it doesn't work good for me (a lot flickering, low framerate and some freezing ???).
    By the way, just to tell you you need to add a "make oldconfig" before to "make modules_prepare" in your tuto.
    thx"

    ah, forgot modules_prepare, fixed it thanks!

    and are you getting issues in guvcview?

    ReplyDelete
  3. Now it's late for me in France,
    I will try this tomorrow on my mini9 (rraaa ! got to reinstall karmic)
    I'll give you the results, but playing with your parameters and my IR cam is quite funny. You can have some amazing vintage burned films effect with :)

    ReplyDelete
  4. it works like a charm on my mini9 !!
    just some (very few) flickerings
    a few notes :
    * in your tuto : ln -s linux-source-2.6.*** instead of linux-2.6.***
    * when "guvcview /dev/video0", "/dev/video0" is a useless parameter (guvcview always take the first video device whatever is the parameter you give)

    ReplyDelete
  5. @yomat

    Glad to hear it works on your mini9, there are other registers for fixing flicker caused by artificial light, I will look into adding those, maybe that is your problem?

    Thanks for noticing the ln -s, i have fixed it. Also the reason i had /dev/video0 was cause i have two webcams and was bouncing back n forth between the two

    ReplyDelete
  6. Thank your for your efforts in improving this driver!

    I just followed your instructions but sadly all I get from the camera (with motion, guvcviewer, ...) is this kind of flickering, which makes the webcam unusable: http://i35.tinypic.com/2uyk9l3.jpg

    The strange thing is, that in the first 2s after launching guvcview, it displays the image perfectly correct. Do you have any ideas what could cause this?

    I also tried using different modes without success.

    Im running this on a 600MHz Embedded Board.

    ReplyDelete
  7. Update:
    It´s not working with the Ubuntu-supplied driver either...

    The cam is working perfectly fine on my MacBook using the macam-driver, so I know its not a hardware-failure.

    Any ideas?

    ReplyDelete
  8. @Nick

    I see this EXACT problem if my opencv code takes to long to process the image. I have no idea what is causing it but i agree it is extreamly annoying. I gaurentee your problem is because you are running 600MHz and for some reason the driver does no properaly drop frames. I am still trying to find a solution to this problem.

    ReplyDelete
  9. Wow, thats what I call a quick reponse :-)

    Yeah it looks like it tries to drop some rames but instead overlays them with other frame-fragments...

    If you need me to test something, let me know!

    ReplyDelete
  10. Ok, im 100% sure now, that my CPU is too weak too handle 15fps let alone 30fps int this high-quality (The picture is fine, as long as the CPU% stays under ~85).

    Is there a way to limit the frames <15fps or to reduce the image-quality so my Embedded Board can handle it? (I guess I would have to limit the framerate in the ov534.c in the videomodes switch, but I don´t know which values I have to use...).

    Sorry for being so annoying, but I really need to get this camera to work on this specific Board.

    Sincerely

    ReplyDelete
  11. @nick

    Your CPU is only to blame because there is a serious error in the way it detects end/start of frame in the drive. Even my overclocked i7 cant keep up with same frame rates. There is a way to set framerate to < 15 but it requires calculating new register values. I will look into this after I implement some other stuff I want to add as well. Im in discussion with some other people about the frame over flow problem so hopefully it will be fixed.

    And you are defientely NOT annoying its really nice to get feedback and see that someone is using my patch. The only thing i can suggest is that you use another (well supported) camera until these bugs with the PS3 Eye are worked out.

    ReplyDelete
  12. Great!

    I´m using a Logitech Webcam in the meantime, which is supported by most of the applications and provides relatively sharp pictures.

    Again, If you need my assistance or something else, let me know, I´m happy to help, wherever I can.

    ReplyDelete
  13. nice, but couldn't find the .c file to test it :)

    ReplyDelete
  14. Thank you so much for this patch! The horrible yellow color from the previous version of the driver was driving me crazy. One thing I've noticed is that there is some glitching when the image gets too bright. Try playing around with the manual exposure and gain controls to see what I'm talking about. If the image is too bright then the driver seems to stop responding. It may be hard to replicate in low light conditions but if you point the camera outside it will definitely happen. Thanks again for your patch to this wonderfully cheap camera.

    ReplyDelete
  15. @Hantarex:
    There you go: ucfilespace.uc.edu/~thrunml/ov534.c

    ReplyDelete
  16. I'm noticing a lot of glitching with this driver which seems to be coming from high cpu utilization + high framerate. For example one project I have uses the 640x480@60fps mode, capturing in a separate thread and doing heavy processing on the video in another thread. if I set the driver to capture at 60fps, I get intermittently inserted "bad" frames, seems like the image gets shifted somehow or partially overwritten with a new frame, but in the wrong spot. setting the framerate lower causes less frequent glitching. I did not have this problem with kaswy's driver. Great work but this is a showstopper for this project at least. I'll look into the code to see if I can spot the problem but I'm not familiar with linux drivers.

    ReplyDelete
  17. I managed to fix the problem I was having by replacing the function implementation of

    static void sd_pkt_scan()

    With the implementation of that function from kaswy's driver. The difference that I can see is that kaswy's code is discarding frames more liberally than the new code, which is trying to detect some specific error state but still produce a valid frame if it can.

    Hope this helps!

    ReplyDelete
  18. @timothy

    I dont remember touching the sd_pkt_scan() at all, can you provide a diff?

    ReplyDelete
  19. Here's the relevant part of the diff. Kaswy's doesnt have the int payload_len variable, yours does.


    738a1011
    > int payload_len;
    739a1013
    > payload_len = gspca_dev->cam.bulk ? 2048 : 2040;
    741c1015
    < len = min(remaining_len, 2048);
    ---
    > len = min(remaining_len, payload_len);
    772,774c1046,1049
    <
    < gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
    < NULL, 0);
    ---
    > if (gspca_dev->last_packet_type == INTER_PACKET)
    > frame = gspca_frame_add(gspca_dev,
    > LAST_PACKET, frame,
    > NULL, 0);
    777,780c1052
    < }
    <
    < /* Add the data from this payload */
    < gspca_frame_add(gspca_dev, INTER_PACKET, frame,
    ---
    > gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
    782d1053
    <
    784c1055
    < if (data[1] & UVC_STREAM_EOF) {
    ---
    > } else if (data[1] & UVC_STREAM_EOF) {
    786,792d1056
    <
    < if (frame->data_end - frame->data !=
    < gspca_dev->width * gspca_dev->height * 2) {
    < PDEBUG(D_PACK, "short frame");
    < goto discard;
    < }
    <
    794c1058,1063
    < NULL, 0);
    ---
    > data + 12, len - 12);
    > } else {
    >
    > /* Add the data from this payload */
    > gspca_frame_add(gspca_dev, INTER_PACKET, frame,
    > data + 12, len - 12);

    ReplyDelete
  20. Hello, when I load the driver with modprobe gspca-ov534 videomode=10 I obtain the following Error:
    FATAL: Error inserting gspca_ov534 (/lib/modules/2.6.31-9-rt/kernel/drivers/media/video/gspca/gspca_ov.ko): Unknown symbol in module, or unknown parameter (see dmesg)

    This is what dmesg report:

    [13403.373022] usbcore: deregistering interface driver ov534
    [13403.373158] gspca: disconnect complete
    [13403.373185] ov534: deregistered
    [13403.412275] gspca: main deregistered
    [13418.873908] Linux video capture interface: v2.00
    [13418.879052] gspca: main v2.6.0 registered
    [13418.880461] gspca_ov534: disagrees about version of symbol gspca_frame_add
    [13418.880466] gspca_ov534: Unknown symbol gspca_frame_add
    [13418.880830] gspca_ov534: disagrees about version of symbol gspca_disconnect
    [13418.880833] gspca_ov534: Unknown symbol gspca_disconnect
    [13418.880932] gspca_ov534: disagrees about version of symbol gspca_resume
    [13418.880935] gspca_ov534: Unknown symbol gspca_resume
    [13418.881037] gspca_ov534: disagrees about version of symbol gspca_dev_probe
    [13418.881040] gspca_ov534: Unknown symbol gspca_dev_probe
    [13418.881139] gspca_ov534: disagrees about version of symbol gspca_suspend
    [13418.881141] gspca_ov534: Unknown symbol gspca_suspend
    [13566.255837] usb 1-8: USB disconnect, address 6
    [13572.828365] gspca_ov534: disagrees about version of symbol gspca_frame_add
    [13572.828371] gspca_ov534: Unknown symbol gspca_frame_add
    [13572.828744] gspca_ov534: disagrees about version of symbol gspca_disconnect
    [13572.828747] gspca_ov534: Unknown symbol gspca_disconnect
    [13572.828849] gspca_ov534: disagrees about version of symbol gspca_resume
    [13572.828852] gspca_ov534: Unknown symbol gspca_resume
    [13572.828945] gspca_ov534: disagrees about version of symbol gspca_dev_probe
    [13572.828948] gspca_ov534: Unknown symbol gspca_dev_probe
    [13572.829066] gspca_ov534: disagrees about version of symbol gspca_suspend
    [13572.829069] gspca_ov534: Unknown symbol gspca_suspend
    [13582.869020] usb 1-8: new high speed USB device using ehci_hcd and address 7
    [13582.986144] usb 1-8: configuration #1 chosen from 1 choice
    [13582.998922] gspca_ov534: disagrees about version of symbol gspca_frame_add
    [13582.998929] gspca_ov534: Unknown symbol gspca_frame_add
    [13582.999601] gspca_ov534: disagrees about version of symbol gspca_disconnect
    [13582.999631] gspca_ov534: Unknown symbol gspca_disconnect
    [13582.999800] gspca_ov534: disagrees about version of symbol gspca_resume
    [13582.999828] gspca_ov534: Unknown symbol gspca_resume
    [13583.000008] gspca_ov534: disagrees about version of symbol gspca_dev_probe
    [13583.000013] gspca_ov534: Unknown symbol gspca_dev_probe
    [13583.000181] gspca_ov534: disagrees about version of symbol gspca_suspend
    [13583.000185] gspca_ov534: Unknown symbol gspca_suspend
    [13688.590417] gspca_ov534: disagrees about version of symbol gspca_frame_add
    [13688.590423] gspca_ov534: Unknown symbol gspca_frame_add
    [13688.590858] gspca_ov534: disagrees about version of symbol gspca_disconnect
    [13688.590862] gspca_ov534: Unknown symbol gspca_disconnect
    [13688.590988] gspca_ov534: disagrees about version of symbol gspca_resume
    [13688.590991] gspca_ov534: Unknown symbol gspca_resume
    [13688.591089] gspca_ov534: disagrees about version of symbol gspca_dev_probe
    [13688.591092] gspca_ov534: Unknown symbol gspca_dev_probe
    [13688.591187] gspca_ov534: disagrees about version of symbol gspca_suspend
    [13688.591190] gspca_ov534: Unknown symbol gspca_suspend

    Wat to do?

    ReplyDelete
  21. It sounds like you are compiling against an older kernel/newer. you most likely also have to recompile gspca_main and load that as well. Im not exactly sure

    ReplyDelete
  22. A new patched driver with the light frequency control:
    www.cs.bris.ac.uk/~ebrahimi/ps3eye/ov534.c

    ReplyDelete
  23. @ebrahimi

    thanks for the patch, how do you know register 2b is for light freqency control? that data sheets says it is "Dummy Pixel Insert LSB"...

    ReplyDelete
  24. That datasheet is not for ov534, the Windows driver has these register addresses.

    ReplyDelete
  25. what do you think the minimmum cpu is needed to run the ps3 eye on the pc is. i am using a pretty old laptop that has a 1.6 Ghz celeron

    ReplyDelete
  26. @ebrahimi

    Where did the windows driver get 2b then? I dont see register 2b for flickering in either the ov538 or ov7720 data sheet. I agree that it would be nice to add but I would like to confirm it first

    @ontoptherock

    I honestly have no idea, it depends on what you are trying to do. Im sure it will work it just a matter of how many FPS you are going to get. Only way to find out is to try your application on the computer

    ReplyDelete
  27. So what do you make of the dropping frames issue? With my changes I still get dropped frames but instead of corrupted frames they are dropped. Still not ideal but better than corrupted frames I think.

    ReplyDelete
  28. @Timothy
    Could you possibly upload your ov534.c somewhere? I would love to try it!

    Thanks

    ReplyDelete
  29. Like I said all I did was replace bear's sd_pkt_scan() function with kaswy's. It still seems to drop frames on me, but at least they are not corrupted. I don't know why the frames are being dropped in the first place though.

    Here's the ov534.c code:
    http://pastebin.com/m6b65b001

    ReplyDelete
  30. I can confirm that frame-dropping works correctly using Timothy´s patch!

    No more corrupted Frames using my 600MHz SBC :D (although my CPU-Usage is around 80% using videomode 04).

    ReplyDelete
    Replies
    1. Hello, Niko

      I know this thread is nearly four years old, but I was wondering if you could give a little bit more information about what board you were able to use with the PS3 Eye webcam in 640x480 res and 60 fps, and what modifications you had to make to the Linux kernel. I am trying to get the same performance out of a BeagleBone (720 Mhz), but haven't been able to get above 15 fps with the driver in the mainlined kernel.

      I've been struggling with this for months now and need to get things working so I can progress with my thesis. Please let me know if you have any pointers for how I can get things up and running.

      Thanks!

      Delete
  31. Hi folks, glad to find something recent ragarding the frame dropping issue. I'm running Chakra (Arch distro) kernel 2.6.31, and I'm actually noticing all kinds of different behavior with the cam depending on what app I'm using. Flash-based webcam applets display the picture as a broken, interlaced composite. Skype just shows a green window. Xawtv doesn't show anything and freezes up. aMSN does the mad flickering jig that's been discussed.

    The only application that I've tried so far that displayed the video properly and in full quality, with no performance problems is "Cheese". My computer is a laptop with a 1.6ghz core2duo.

    Gonna keep my eye on this to see what develops. Keep up the good work. :)

    ReplyDelete
  32. Please repost the new patch whitout the flickering. The Pastebin link is death

    ReplyDelete
  33. The Pastebin-Link works fine for me, but here´s a mirror:
    http://www.mediafire.com/file/ltwomtftzyb/ov534.c

    ReplyDelete
  34. @nopt: Since I couldn't use unicap, I wrote a simple piece of code to use the mmap streaming method to capture frames and SDL to show them (no need to do color conversion). It works great. Cheese/GStreamer definitely uses the same method (memory mapping), but other applications probably use the other streaming method (user pointer), or grabbing frames one by one, and that's why they corrupted/dropped frames.

    @Max: It seems those guys have the datasheets of both chips, there are other commercial cameras that use these chips and have their Windows drivers.

    ReplyDelete
  35. I make it to this point in the instructions without a problem..

    Install new driver:
    # cp drivers/media/video/gspca/gspca_ov534.ko /lib/modules/$(uname -r)/kernel/drivers/media/video/gspca

    Looks like gspca_ov534.ko is not being built. Is there something I need to enable ov534.c to be built?

    btw. uname -r on my system is 2.6.31-34-fitpc2 and I do have the camera working according to the vw_kubel instructions at the top of this thread ( http://nuigroup.com/forums/viewthread/4079/P0/ )

    ReplyDelete
  36. Could you provide instructions to compile and install your patch with an older kernel, in my case 2.6.28 64 bits Jaunty?

    Thanx!

    ReplyDelete
  37. @Dasaki

    The instructions above should be relativly kernel independant, what part are you stuck on?

    @Everyone

    I have a new and improved patch that will be merged with mainline v4l2 tree after break, along with color corrections the frame rate/dropping issue appears to be fixed (by other people) and it will be alot easier to install. I'll post instructions as soon as it gets merged

    ReplyDelete
  38. @Max Thrun

    I think the problem is 2.6.28 doesn't include ov534 itself, so it ignores ov534.c when compiling.
    I managed to compile with kaswy's modified driver and the ov534.c downloaded from here, but for that I had to comment:

    /* cam->bulk = 1 ... cam-> bulk_nurbs = 2 */

    But then after make install, there is an error with modprobe gspca_ov534, it says it cannot insert the module: unknown symbol in module or unknown parameter

    ReplyDelete
  39. @Dasaki

    try compiling and replacing the gspca_main driver as well

    ReplyDelete
  40. @Max Thrun

    Tryed that too, using files from the 2.6.31 source without success

    I guess I'll have to wait for the whole new v4l2 tree

    ReplyDelete
  41. hello the links http://www.mediafire.com/file/ltwomtftzyb/ov534.c and
    http://pastebin.com/m6b65b001 are down please someone we need a new mirror for the patch, i have one please send me and i do the hard work calderonf@gmail.com
    thanks

    ReplyDelete
  42. @ Max Thrun
    thanks for the patch it have been very useful, i have the same problem in opencv with the corrupted frames when i load the pc and the frame rate lows, i look timothy solution but the function "sd_pkt_scan()" are the same in kaswy and your version.
    thanks

    ReplyDelete
  43. I added a small piece of code to sd_pkt_scan() to fix corrupting frames issue. I grabbed this part from official gspca mainline @ http://linuxtv.org/hg/~jfrancois/gspca/

    Here is the code:
    http://pastebin.com/f2b2e074c

    ReplyDelete
  44. Actually even my version still causes _minor_ glitches when cpu load is @ 100%, for me. Difference with previous problem is that now only the top 10, maybe 20, pixel-rows are glitching instead of the entire frame. This suffices for my application. I'm currently using PS3 EYE with OpenCV @ 50fps @ 640x480. I'm just not processing the top 20 pixel-rows.

    For example Cheese and guvcview have _zero_ glitches.

    If you want this fixed I suggest trying to compile the gspca mainline (where I copied the 'fixing code' from), which has had many fixes/patches/updates for PS3 EYE since release of kernel 2.6.31, and then adding Power Line Frequency Control to that version if you want that.

    ReplyDelete
  45. the .c in the link http://pastebin.com/f2b2e074c works 100% in Opencv thanks to all for your great work, if the link goes down please mail me at gmail.

    ReplyDelete
  46. i tried your version an it worked whitout any problem at 640x480@60 in my core-i7 with the lastest tested opencv-svn and openmp support, I tried lkdemo and 100 points, i dont see the 20 line glitching. I am very happy with this version.

    ReplyDelete
  47. @ jaspor

    Thanks a billion!
    The PS3 Eye now works perfectly with OpenCV!

    Has the ov534 @ http://linuxtv.org/hg/~jfrancois/gspca been updated to this version of the driver that now works in OpenCV?

    ReplyDelete
  48. Disregard my last post - the GSPCA mainline @ http://linuxtv.org/hg/~jfrancois/gspca already resolves the flickering in OpenCV.

    ReplyDelete
  49. Indeed it does. I finally managed to compile latest v4l (which gspca is part of) tree on Ubuntu 9.10.

    This is how I did that:
    1 - cd
    2 - wget http://linuxtv.org/hg/v4l-dvb/archive/tip.tar.bz2
    3 - tar xjf tip.tar.bz2
    4 - cd v4l.........
    5 - echo > ./linux/drivers/media/dvb/firewire/Makefile
    6 - make
    7 - make install (as root or use sudo)

    This fixes corrupted frames and even the top 20 lines flickering (although I seem to be the only one experiencing them)!

    Unfortunately this version does not support setting the power line frequency, which is a must have for me living in the Netherlands.

    From Ebrahim patch I learned that power line frequency setting is located @ register 0x2b, so I manually changed that register value to 0x9e, 50Hz. (0x00 being default, 60Hz)

    So... If you live in 50Hz area, do this:

    1 - cd
    2 - wget http://linuxtv.org/hg/v4l-dvb/archive/tip.tar.bz2
    3 - tar xjf tip.tar.bz2
    4 - cd v4l.........
    5 - wget http://tickets.thehumancircus.org/ov534.c
    6 - mv ov534.c ./linux/drivers/media/video/gspca/
    7 - echo > ./linux/drivers/media/dvb/firewire/Makefile
    8 - make
    9 - make install (as root or use sudo)

    I also changed the default setting 30fps to 60fps, but this can be changed easily with for example guvcview.

    I can now use PS3 EYE perfectly.

    Many thanks to Filipe A (listed on OpenCV wiki) for helping me out.

    @ Max Thrun: Perhaps possible to add this info to main article? This page still shows up very high in the google results when googling for PS3 eye driver. Not everybody will scroll down all the comments so perhaps it will help some of them.

    ReplyDelete
  50. @jasp0r

    Sorry i haven't been very vocal here, i have patches pending for linuxtv gspca tree that fixes alot of problems (as you already found out). When the patches get merged I'll post an update.

    ReplyDelete
  51. @jasp0r

    I assume your step 5 in your last post is to avoid compiling the firewire drivers or firedtv specifically, which is flagging an error? Also the current version of ir-raw-event is flagging an error at least in ubuntu Karmic. Here's what I did to get the PS3 working with patches:

    1. sudo apt-get install guvcview mercurial
    2. hg clone -r ee9826bc7106 http://linuxtv.org/hg/v4l-dvb # this gives you a version of v4l-dvb before the changes to ir which are flagging an error but still after the patches to the ps3 driver.
    3. make # do make -j2 for dual core processors, -j4 for quad core

    at this point the make will flag an error about firedtv or something like that. However, it will also have created the .config file we can now change so that firedtv is no longer built:

    4. sed -i 's/CONFIG_DVB_FIREDTV=m/CONFIG_DVB_FIREDTV=n/' ./v4l/.config
    5. make # will make without firedtv. use -j2 or -j4 again if appropriate
    6. sudo make install

    now check to see if you have the right gspca-ov534 driver:
    7. modinfo gspca-ov534
    and if that appears right, unload the old and load the new:
    8. modprobe -r gspca-ov534
    9. modprobe gspca-ov534

    now you can change the resolutions, frame rates, etc. with guvcview (not at load time). Everything works for me except 640x480@60Hz, which hasn't worked for me with any of the patches. But 640x480@50Hz as well as 320X240@ up to 125Hz all work great.

    ReplyDelete
  52. @ john

    Thanks for posting that. Thats what I had been doing aswell just havent had time to post the updated instructions.

    As you probably know linuxtv switched over to git but the trees have the full linux kernel in them. Do you know how to compile just v4l drivers against a different kernel? the linuxtv site suggests that you just run the kernel that is in their trees, this seems silly to me.

    ReplyDelete
  53. @ Max Thrun

    I don't know how to compile just v4l drivers.

    I do have a few smaller errors in my list of steps. Here's an updated list:

    1. sudo apt-get install guvcview mercurial
    2. hg clone -r ee9826bc7106 http://linuxtv.org/hg/v4l-dvb # this gives you a version of v4l-dvb before the changes to ir which are flagging an error but still after the patches to the ps3 driver
    2.5 cd v4l-dvb
    3. make # do make -j2 for dual core processors, -j4 for quad core

    at this point the make will flag an error about firedtv or something like that. However, it will also have created the .config file we can now change so that firedtv is no longer built:

    4. sed -i 's/CONFIG_DVB_FIREDTV=m/CONFIG_DVB_FIREDTV=n/' ./v4l/.config
    5. make # will make without firedtv. use -j2 or -j4 again if appropriate
    6. sudo make install

    now check to see if you have the right gspca-ov534 driver:
    7. modinfo gspca-ov534
    and if that appears right, unload the old and load the new:
    8. sudo modprobe -r gspca-ov534
    9. sudo modprobe gspca-ov534

    If you get an error in step 9, try rebooting.

    ReplyDelete
  54. Hi all,

    Thanks for these info, but it looks like I am missing something.

    I've just compiled v4l drivers :
    1. sudo apt-get install guvcview mercurial
    2. hg clone http://linuxtv.org/hg/v4l-dvb
    # didn't have an error - problem with ir changes solved ?
    2.5. cd v4l-dvb
    3. make all -j2
    6. make install
    5. modinfo gspca-ov534

    And then I still get the same :

    ==========
    filename: /lib/modules/2.6.32-3-amd64/kernel/drivers/media/video/gspca/gspca_ov534.ko
    license: GPL
    description: GSPCA/OV534 USB Camera Driver
    author: Antonio Ospite
    alias: usb:v1415p2000d*dc*dsc*dp*ic*isc*ip*
    depends: gspca_main,usbcore
    vermagic: 2.6.32-3-amd64 SMP mod_unload modversions
    ==========

    Is there something more to do ?

    Note: I am running Debian testing - but that should'nt change anything :-P

    ReplyDelete
  55. Hugo had the same problem until a reboot

    ReplyDelete
  56. I'm having the same problem as Hugo on 10.04 and tried restarting still says

    ============================0
    filename: /lib/modules/2.6.32-22-generic/kernel/drivers/media/video/gspca/gspca_ov534.ko
    license: GPL
    description: GSPCA/OV534 USB Camera Driver
    author: Antonio Ospite
    srcversion: 00CAB7CAB395540E1B74489
    alias: usb:v1415p2000d*dc*dsc*dp*ic*isc*ip*
    depends: gspca_main
    vermagic: 2.6.32-22-generic SMP mod_unload modversions
    ============================0

    ReplyDelete
  57. This comment has been removed by the author.

    ReplyDelete
  58. ok did some checking again, I actually get the right version but the settings you added ain't there :S meaning it's working but I get the "yellowy" picture :/

    btw I get perfect picture with the original driver but that one can only do 640x480 which aMSN wont accept

    ReplyDelete
  59. Hi all,

    thanks for these valuable tips that finally prove to me that the PS3 Eye can go beyond 30 FPS!

    There are other reports saying that the webcam can reach such frame rates (using OpenFrameworks for instance), but I want to use this webcam with blob tracking software.

    My weapon of choice is CCV (aka tbeta), from the NUIGroup.
    When I run this application now, it crashes with the following message:

    (:2031): GStreamer-WARNING **: pad source:src returned caps which are not a real subset of its template caps

    Looking online, it seems that this is due to the libv4l library (surprise! :S)
    So my question is ... what did these steps change, and do you have any idea how to overcome this issue?

    It looks like users of the PS3 Eye are of two different kinds: those who want to use it for videoconferencing/chatting, and those who want to use it in external software (essentially for multitouch blob tracking). Were the changes from this page intended to allow software like CCV to use the camera at higher resolution?

    Thanks

    ReplyDelete
  60. Hi,

    Thanks for this work and how-to.

    I used trunk from linuxtv and everything is working perfect under guvcview.

    (had to use sed -i 's/CONFIG_DVB_FIREDTV=m/CONFIG_DVB_FIREDTV=n/' ./v4l/.config)

    =======================
    ~/local/v4l-dvb$ modinfo gspca_ov534
    filename: /lib/modules/2.6.32-23-generic/kernel/drivers/media/video/gspca/gspca_ov534.ko
    license: GPL
    description: GSPCA/OV534 USB Camera Driver
    author: Antonio Ospite
    srcversion: DCCC13AC83E4A24F75E06E8
    alias: usb:v1415p2000d*dc*dsc*dp*ic*isc*ip*
    depends: gspca_main
    ========================================


    OpenCV question :

    I can set CV_CAP_PROP_FRAME_WIDTH and HEIGHT, that is nice.
    I can't get nor set CV_CAP_PROP_FPS under OpenCV (it is a known issue, and there is a rewrite planned for July iirc).

    I'd like to know if anyone has a workaround for it. Is it possible to set a default value from outside OpenCV? I tried

    sudo modprobe gspca_ov534 videomode=10

    but that option is not supported in trunk.

    Still, I'm quite happy. A webcam with such frame rate is pure gold for computer vision.

    ReplyDelete
  61. @billyzelsnack:

    For anyone trying to setup the ps3-eye on an embedded board like CompuLab’s Fit-PC2 or Axiomtek's pico820, after installing the 2.6.31-34-fitpc2 from http://www.fit-pc2.com/wiki/index.php?title=Installing_Ubuntu_9.10

    I got it working after some headaches with the above tutorial and these changes:

    instead of:
    sudo apt-get install linux-source
    use:
    apt-get source linux-image-$(uname -r)

    after running:
    make oldconfig

    do:
    edit the file .config
    search for line: "#CONFIG_USB_GSPCA_OV534 is not set" and replace with "CONFIG_USB_GSPCA_OV534=m"
    save, exit and proceed with the next steps of the tutorial.

    I had to reboot to get the mode 04 (640x480@60fps) working (with some flickering though).

    Hope it helps!

    ReplyDelete
  62. Weird,
    Just upgraded to 2.6.32-24 in Lucid, and tried make clean, make, make install, but it would work in the old 32-23 kernel directory.

    I did't know what file to clean so I deleted v4l-dvb and cloned a fesh new copy. Then make found the new kernel.

    Anyone know how to truly clean the v4l-dvb directory?

    ReplyDelete
  63. do you have any idea how to get the camera (PS eye) working in raw bayer mode? framerates up to 80Hz (640x480) can be achieved because the transmittes data is only half the size of yuv-picture. i tried to change the register settings for the ov534 and ov7720 but all i got were totally noisy pictures.

    ReplyDelete
  64. pardon my noobness, but I'm stuck at
    "# ln -s linux-source-2.6.(your version) linux"

    I'm running lucid lynx, how do I figure out what to put in for (your version), or could you just tell me, thx.

    ReplyDelete
  65. This comment has been removed by the author.

    ReplyDelete
  66. Hello,

    I've done pretty much everything on the tutorial but on the last part:

    $modprobe gspca-ov534 videomode=10

    i got the following error message:

    FATAL: Error inserting gspca_ov534 (/lib/modules/2.6.32-21-generic/kernel/drivers/media/video/gspca/gspca_ov534.ko): Unknown symbol in module, or unknown parameter (see dmesg)

    in dmesg i got this:

    [ 1149.157107] gspca_ov534: Unknown symbol gspca_frame_add
    [ 1149.157174] gspca_ov534: Unknown symbol gspca_debug
    [ 1149.157347] gspca_ov534: Unknown symbol gspca_disconnect
    [ 1149.157449] gspca_ov534: Unknown symbol gspca_resume
    [ 1149.157513] gspca_ov534: Unknown symbol gspca_dev_probe
    [ 1149.157581] gspca_ov534: Unknown symbol gspca_suspend

    I'm using Ubuntu 10.04 with kernel 2.6.32-21, can anyone give some hint in what to do?

    thanks in advance!

    ReplyDelete
  67. If you're seeing this error:

    FATAL: Error inserting gspca_ov534 (/lib/modules//kernel/drivers/media/video/gspca/gspca_ov534.ko): Unknown symbol in module, or unknown parameter (see dmesg)

    and the associated lines in dmesg:
    gspca_ov534: Unknown symbol gspca_frame_add
    gspca_ov534: Unknown symbol gspca_debug
    gspca_ov534: Unknown symbol gspca_disconnect
    gspca_ov534: Unknown symbol gspca_resume
    gspca_ov534: Unknown symbol gspca_dev_probe
    gspca_ov534: Unknown symbol gspca_suspend

    be sure to unload the gspca_main module, copy the new one (that you just compiled) and reload:

    modprobe -r gspca_main
    cp drivers/media/video/gspca/gspca_main.ko /lib/modules/$(uname -r)/kernel/drivers/media/video/gspca
    modprobe gspca_main
    modprobe gspca_ov534 videomode=XX

    NOTE: I'm not using any other gspca drivers. If you are, you will likely need to copy and reload those as well.

    ReplyDelete
  68. Hi folks !

    I've tested my webcam on Ubuntu 10.10, x86_64 and it works well by default !! :
    - GUVCViewer allows up to 125fps@320x240 and
    - OpenCV does not use a lot of CPU power anymore :-D

    ReplyDelete
  69. I try to wget the c file and it's not found... is there a new url for it?

    wget ucfilespace.uc.edu/~thrunm1/ov534.c

    ReplyDelete
  70. @anon

    wget ucfilespace.uc.edu/~thrunml/ov534.c

    it is an L not a 1

    Also this post is fairly dated. Most recent kernels have fairly good support for the ps3 eye now

    ReplyDelete
  71. This is the last step and I hit a brick wall. It won't load the driver I just compiled and I get this message:

    modprobe gspca_main
    FATAL: Error inserting gspca_main (/lib/modules/2.6.35-22-generic/kernel/drivers/media/video/gspca/gspca_main.ko): Invalid module format

    ReplyDelete
  72. For ubuntu 10.04, see http://wiki.tekkotsu.org/index.php/Sony_PlayStation_Eye_driver_install_instructions

    ReplyDelete
  73. I have Ubuntu 10.10 (kernel 2.6.35-23) and PS3eye works no problem in guvcview @125 fps. But as soon as I use opencv in my code it goes back to 30fps. I also tried to use "cvsetCaptureProperty" and "cvGetCaptureProperty" in my code. They just don't work and I get error. Any idea about this issue?

    ReplyDelete
  74. @alex, I also had that problem. I ended up just hard coding the framerate in the driver.

    ReplyDelete
  75. Max, can you give me a hint on how I can do that? Thanks :)

    ReplyDelete
  76. Alex, no promises but I *think* this is how I did it. I havent looked at ps3 eye in a while

    In ov534.c

    drivers/media/video/gspca/ov534.c


    static const struct rate_s rate_0[] = { /* 640x480 */
    {60, 0x01, 0xc1, 0x04},
    {50, 0x01, 0x41, 0x02},
    {40, 0x02, 0xc1, 0x04},
    {30, 0x04, 0x81, 0x02},
    {15, 0x03, 0x41, 0x04},
    };
    static const struct rate_s rate_1[] = { /* 320x240 */
    {125, 0x02, 0x81, 0x02},
    {100, 0x02, 0xc1, 0x04},
    {75, 0x03, 0xc1, 0x04},
    {60, 0x04, 0xc1, 0x04},
    {50, 0x02, 0x41, 0x04},
    {40, 0x03, 0x41, 0x04},
    {30, 0x04, 0x41, 0x04},
    };

    just comment out or delete all but the one you want for each size. so if you want 640x480@60Hz

    static const struct rate_s rate_0[] = { /* 640x480 */
    {60, 0x01, 0xc1, 0x04},

    };

    ReplyDelete
  77. Edit:

    but make sure you keep an array for each. in my example i should have left in the 320x240 array

    ReplyDelete
  78. Thanks a lot Max, it works if I change it among the first array (640*480) so i got up to 60fps now. but if i comment out all the 640*480 modes and enable one the modes from 320*480 it goes back to 30fps. Any thoughts?

    ReplyDelete
  79. alex,

    Don't comment out all the modes from 640x480. You pick one frame rate from each group that you uncomment.

    So if you wanted 640x480@60hz enabled as well as 320x480@100hz you would have:

    static const struct rate_s rate_0[] = { /* 640x480 */
    {60, 0x01, 0xc1, 0x04},
    };
    static const struct rate_s rate_1[] = { /* 320x240 */
    {100, 0x02, 0xc1, 0x04},
    };

    then i think if you set the camera size using the opencv functions it might work. other wise i think i used to open guvcview and change it to which ever resolution i wanted to work with and that stuck in the opencv program

    ReplyDelete
  80. great! It's working. Thanks Max :)

    ReplyDelete
  81. Unfortunately this no longer seems to work with Ubuntu Natty 11.10:

    [code]
    root@routh-codebox:/usr/src/linux# make SUBDIRS=drivers/media/video/gspca modules
    CC [M] drivers/media/video/gspca/ov534.o
    drivers/media/video/gspca/ov534.c: In function ‘sd_pkt_scan’:
    drivers/media/video/gspca/ov534.c:1049:8: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1049:8: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘void *’
    drivers/media/video/gspca/ov534.c:1049:8: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c:1047:11: error: void value not ignored as it ought to be
    drivers/media/video/gspca/ov534.c:1053:6: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1053:6: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘__u8 *’
    drivers/media/video/gspca/ov534.c:1053:6: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c:1058:7: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1058:7: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘__u8 *’
    drivers/media/video/gspca/ov534.c:1058:7: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c:1057:10: error: void value not ignored as it ought to be
    drivers/media/video/gspca/ov534.c:1063:7: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1063:7: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘__u8 *’
    drivers/media/video/gspca/ov534.c:1063:7: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c:1072:3: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1072:3: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘void *’
    drivers/media/video/gspca/ov534.c:1072:3: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c: At top level:
    drivers/media/video/gspca/ov534.c:1344:2: warning: initialization from incompatible pointer type
    drivers/media/video/gspca/ov534.c:1345:2: warning: initialization from incompatible pointer type
    drivers/media/video/gspca/ov534.c:1346:2: warning: initialization from incompatible pointer type
    make[1]: *** [drivers/media/video/gspca/ov534.o] Error 1
    make: *** [_module_drivers/media/video/gspca] Error 2
    [/code]

    ReplyDelete
  82. noooooooow got to stick with 11.04 then

    ReplyDelete
  83. It's a great post.

    I have a simple question.

    I am trying to record or processing data at 320x240@125Hz on linux, opencv2.2, Kernel 2.6.35.

    As you said on previous comments, I modified ov534.c file to set up only 1 mode, u320x240@125Hz.

    I think driver was properly patched because a framerate on guvcview was fixed. (It's not change even though a framerate was changed.)

    When I use the following openCV function to get CvCapture, it shows "select timeout" twice and Segmentation fault.

    ...
    CvCapture* capture = NULL;
    capture = cvCreateCameraCapture( 1 );
    IplImage *frames = cvQueryFrame(capture);
    ...

    Have you experienced this problem?

    The reason why cvCreateCameraCapture(1) is that I have two cameras.(Macbook built-insight and playstation eye)

    Thank you.

    ReplyDelete
  84. @Chris Routh & Anonymous

    I've got it working in oneiric, just made some slight tweaks to the function calls to work with the way that functions are defined in gspca.c

    You can my working ov534.c here: http://www.mediafire.com/?a0yngcag0rl3lo9

    :)
    Will

    ReplyDelete
  85. Will,

    I just treid to use your ov534.c on 11.10 and it compiles fine, but it doesn't seem to be changing anything from stock.

    $ modinfo gspca_ov524
    filename: /lib/modules/3.1.0-1282-omap4/kernel/drivers/media/video/gspca/gspca_ov534.ko
    license: GPL
    description: GSPCA/OV534 USB Camera Driver
    author: Antonio Ospite
    srcversion: 0BCED91DC7CF0911B82E3F7
    alias: usb:v1415p2000d*dc*dsc*dp*ic*isc*ip*
    alias: usb:v06F8p3003d*dc*dsc*dp*ic*isc*ip*
    depends: gspca_main
    vermagic: 3.1.0 SMP preempt mod_unload modversions ARMv7

    And if I try to
    $ modprobe gspca_ov534 videomode=10
    I get
    FATAL: Error inserting gspca_ov534 (/lib/modules/3.1.0-1282-omap4/kernel/drivers/media/video/gspca/gspca_ov534.ko): Unknown symbol in module, or unknown parameter (see dmesg)

    Thoughts? loki1725@gmail.com

    ReplyDelete
  86. I am on ubuntu 12.04 LTS kernel 2.3.0-23-generic i am not unable to change the fps of ps3 eye camera e

    root@routh-codebox:/usr/src/linux# make SUBDIRS=drivers/media/video/gspca modules
    CC [M] drivers/media/video/gspca/ov534.o
    drivers/media/video/gspca/ov534.c: In function ‘sd_pkt_scan’:
    drivers/media/video/gspca/ov534.c:1049:8: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1049:8: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘void *’
    drivers/media/video/gspca/ov534.c:1049:8: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c:1047:11: error: void value not ignored as it ought to be
    drivers/media/video/gspca/ov534.c:1053:6: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1053:6: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘__u8 *’
    drivers/media/video/gspca/ov534.c:1053:6: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c:1058:7: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1058:7: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘__u8 *’
    drivers/media/video/gspca/ov534.c:1058:7: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c:1057:10: error: void value not ignored as it ought to be
    drivers/media/video/gspca/ov534.c:1063:7: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1063:7: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘__u8 *’
    drivers/media/video/gspca/ov534.c:1063:7: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c:1072:3: warning: passing argument 3 of ‘gspca_frame_add’ from incompatible pointer type
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘const u8 *’ but argument is of type ‘struct gspca_frame *’
    drivers/media/video/gspca/ov534.c:1072:3: warning: passing argument 4 of ‘gspca_frame_add’ makes integer from pointer without a cast
    drivers/media/video/gspca/gspca.h:234:6: note: expected ‘int’ but argument is of type ‘void *’
    drivers/media/video/gspca/ov534.c:1072:3: error: too many arguments to function ‘gspca_frame_add’
    drivers/media/video/gspca/gspca.h:234:6: note: declared here
    drivers/media/video/gspca/ov534.c: At top level:
    drivers/media/video/gspca/ov534.c:1344:2: warning: initialization from incompatible pointer type
    drivers/media/video/gspca/ov534.c:1345:2: warning: initialization from incompatible pointer type
    drivers/media/video/gspca/ov534.c:1346:2: warning: initialization from incompatible pointer type
    make[1]: *** [drivers/media/video/gspca/ov534.o] Error 1
    make: *** [_module_drivers/media/video/gspca] Error 2

    ReplyDelete
    Replies
    1. @Abhay, are you sure that kernel version is correct?

      I'd be willing to bet that the kernel you are running already includes the patch from my post. This post is pretty out dated now.

      Delete
    2. I am sorry for the typing mistake Max kernel is 3.2.0-23-generic ubuntu 12.04 LTS, Please help and guide me.

      Delete
    3. hey Max i was waiting if you can help please if you have a patch for my kernel 3.2.0-23-generic ubuntu 12.04 LTS

      Delete
  87. Hi Abhay, The 3.2 kernel should have all my patches (and more) already included. The patches posted here are outdated.

    ReplyDelete
  88. ok so does that mean i don't have to do this at all?? my ps3 eye works with guvcview but when i use my camera with my opencv code it uses it;s default settings i.e 320x240 resolution and 30fps. how can i change the fps of ps3eye?
    thanx

    ReplyDelete
    Replies
    1. modinfo gspca -ov534 shows
      filename: /lib/modules/3.2.0-23-generic-pae/kernel/drivers/media/video/gspca/gspca_ov534.ko
      license: GPL
      description: GSPCA/OV534 USB Camera Driver
      author: Antonio Ospite
      srcversion: A36417239FB3BFD27E7CD24
      alias: usb:v06F8p3002d*dc*dsc*dp*ic*isc*ip*
      alias: usb:v1415p2000d*dc*dsc*dp*ic*isc*ip*
      depends: gspca_main
      intree: Y
      vermagic: 3.2.0-23-generic-pae SMP mod_unload modversions 686
      ---------------------------------------------------------------------------------------------------------------------------------------

      and not the parameters how would i be able to change the fps of my ps3 eye please help.
      thanx.

      Delete
  89. I am having the same issues as Abhay, the driver in the kernel does not accept params like your patch.

    any ideas?

    ReplyDelete
  90. Norton 360 new version of Norton Antivirus is specially good from finding and taking care of malware.

    ReplyDelete
  91. I realize this thread is super-outdated, but I've noticed that some people in here have discussed using the PS3 Eye on embedded processors. I am trying to get a PS3 Eye working on a BeagleBone (720 Mhz processor). For my application, I need 640x480 resolution, however I can only capture at 15 fps successfully. I eventually plan to put my system on an RC aircraft, so the motion blur isn't tolerable when the camera is moving at that fps setting. I really only need the board to be able to grab new frames at about 10-15 fps, but I do need the camera's FPS setting to be high enough to prevent motion blur (30, hopefully 60 fps). (In other words, the camera needs to be able to stop motion, but I don't care to grab every single frame.)

    When I set the camera above 15 fps, I get select timeout errors from the v4l2 API on my BeagleBone. I was wondering if anyone in here has more experience with the drivers for the PS3 webcam, and can stipulate as to what is preventing me from grabbing frames when the camera is set to 60 fps. I am using the most recent kernel available for the BeagleBone (3.8.8-bone14).

    If there are no workarounds with this setup, can anyone recommend a camera (UVC?) that would work well for this setup? (no motion blur at 640x480 resolution?) Thanks in advance!

    ReplyDelete
    Replies
    1. Hi Michael,

      I'm really not sure how to get more FPS out of the beaglebone, it might be limited by the USB hardware on the board. I know the initial proof of concept for interfacing with the PS3 eye was done with libusb in userspace so maybe you could try that (I can't remember where the original code was posted) but I sort of doubt you would gain any real performance bypassing the v4l layer.

      Max

      Delete
    2. Thanks for the info, Max. I have actually gotten the camera to capture up to the 30 fps setting using some custom v4l2 capture code written by someone else and modified a bit by me in place of OpenCV's capture code for v4l2 devices. However, as of right now I can only get the camera to start grabbing frames if I am "ssh-ing" into the board and if I cout a line of text at a certain point in my capture code :P Its progress at least!

      Delete
    3. Could you post the code? I remember always needing a cvWaitKey(5) or something like that in my main capture loop. I'm assuming any kind of delay (which your cout might be providing) works.

      Delete
  92. My modifications are actually quite subtle, so I'll point you to the original code for reference. (This should work "as-is" for most people who want to use the PS3 Eye with OpenCV since it sets the camera framerate, which OpenCV fails to do correctly. However, in my case, it doesn't work "as-is" on my BeagleBone):

    https://bitbucket.org/beldenfox/cvcapture/src/b7f279b278aa?at=default


    I have really just been tinkering with the code so far, so my changes aren't really documented well and I don't recall why I made all of the changes that I have made to OCVCapture.cpp, but here are the major points of difference:


    (1) I changed the width/height/framerate to 640/480/30. I also increased the number of "desiredBuffers", but that seems to have no effect on the success or failure of getting frames

    (2) I initially kept getting "select timeout" errors, so I tried commenting out the lines:

    /*
    else if (numReady == 0)
    {
    reportError("select timeout");
    status = kFailure;
    }
    */

    This basically ignores the select timeout and tries to dequeue frames anyways.

    (3) Inside the retry_ioctl function, I check if the request is for VIDIOC_DQBUF and loop through trying to request buffers via VIDIOC_REQBUFS a maximum of 2500 times (all of which get executed since it always fails with the errno corresponding to EBUSY). This loop seems to be the *magic step*, but I have no idea why or how it gets the camera started. As I mentioned earlier, it only works if I use SSH to connect to the BeagleBone (as opposed to serial USB via 'screen') and if I leave the cout line in the loop that gets executed 2500 times uncommented.

    I have tried replacing the cout line with various delays using usleep(), and different number of times the loop gets executed (about 2500+ seems to work well for me -- no idea why).



    I'm not sure the best way to share my code (I'm very new to Linux and the open-source community), so here is a link to a git repo that has all of my files if you really want to look at it: https://github.com/mdarling39/PS3EyeCapture.git

    You can compile everything with "g++ pleaseWork.cpp MartinFox/OCVCapture.cpp -o pleaseWork -I/usr/include -L/usr/lib -lopencv_core -lopencv_highgui -lv4l2". Note that there are two versions of the OCVCapture.cpp code. The one in the MartinFox directory works but minimal changes from the original code. (I have been poking around trying to display some debugging info with the other version in the main directory.)

    I have no idea how this will work on any other systems. As I mentioned, Martin's original code works great for me on my laptop computer, but won't start capturing frames when running on the BeagleBone.

    Thanks!



    ReplyDelete
  93. Hi
    I read your post and i appreciate your efforts.The information that you share in the above article is very nice ans useful.All the things that you share with people, are very nice.Thanks for this article.

    ReplyDelete
  94. Hi
    Nice one! I like the outfit of the characters. Wish i could do the same thing too but im not that techie.i like the outfit of “from farmer to warden”.. really interesting.

    ReplyDelete
  95. Online Cisco Training, Online CCIE Training, Online Ethical Hacking Training, Online CCNP Training, Online CCNA Training, Online MCSE Training, Online Linux Training India, MCITP Training, Online VMware Training and more offered by Zoom Technologies by highly proficient CISCO certified experts - Hyderabad, India. Visit http://zoomgroup.com

    ReplyDelete
  96. Heyhey,

    Just wanted to drop you a line, and tell you that real people are reading this still and are finding it useful. Job well done, and congrats on the mainline patch!

    ReplyDelete
  97. Heyyyyy,

    Enjoy your interest of driving not through games but experience through real one. Lots of driving training India institutes available which provide live training. In whole session of training concentrate on guidelines of traffic rules. Experts cover all the basic part of road driving and increase the confidence of candidate. So, experience your driving by sitting front seat of four wheelers. Through this blog you share interesting program for scared people because these games enhance the capability of driving and remove fear.

    ReplyDelete