So, you want to install the latest PSEYE driver and you’re running the latest kernel version. The drivers for the Playstation Eye usually are up to date with the latest kernel- which make life easy. Follow this tutorial for downloading the git and building the driver: [1]
But, what if you’re on a platform which doesn’t currently support the latest kernel version? Or maybe you just want to stick with the kernel version you’re currently running. But if you try to build the latest driver it can fail due to differences between kernel versions. So there are a couple of options:
1. Use the driver which was current for your version of the kernel- this is will work, but won’t contain any changes to the driver which has happened since then, so you’ll be missing out on all the new features!!
2. Use the current driver but only reverse patches that are applicable for the compatibility with the kernel. And luckily video for linux has your back! The media_build git (git://linuxtv.org/media_build.git) from linuxtv.org is just for this. It contains a set of patches which will revert the driver to the required kernel version without reverting new features to the drivers themselves. So you’ll want to do something like this: [2]
In my case I want to build the latest PSEYE for the 2.6.32 kernel, while the current drivers are time of writing are for the 2.6.40 kernel. For my project I will be compiling these drivers for the BeagleBoard using OpenEmbedded. Now this is a little bit tricky as I will need to manually insert all the relevant patches into the kernel recipe. I have discussed this process in an earlier post: “OpenEmbbeded: Linux kernel + adding PSEYE (patched) modules” where I built the driver using method 1 from above, ie: reverting to an older driver version.
First I cloned the latest git of the gspca driver and the media_build git:
dave@ubuntu:~/setup-scripts/sources/gspca-latest$ git clone git://linuxtv.org/jfrancois/gspca.git Cloning into gspca... remote: Counting objects: 2011313, done. remote: Compressing objects: 100% (353721/353721), done. remote: Total 2011313 (delta 1644787), reused 2003581 (delta 1639209) Receiving objects: 100% (2011313/2011313), 472.56 MiB | 190 KiB/s, done. Resolving deltas: 100% (1644787/1644787), done.
Rather than using the scripts in the media_build I want to run the patches manually with:
for i in $(cat /home/dave/setup-scripts/sources/gspca-latest/media_build/backports/v2.6.32_series
patch -p1 < /home/dave/setup-scripts/sources/gspca-latest/media_build/backports/$i
done
dave@ubuntu:~/setup-scripts/sources/gspca-latest/gspca$ ./do_patch_v2.6.32 patching file drivers/media/video/cx18/cx18-driver.c patching file drivers/media/video/cx18/cx18-driver.h patching file drivers/media/video/cx18/cx18-streams.h patching file drivers/media/rc/rc-main.c patching file drivers/media/dvb/dvb-usb/dvb-usb-remote.c patching file drivers/media/video/videobuf2-memops.c patching file drivers/media/dvb/firewire/firedtv-fw.c patching file drivers/media/video/bt8xx/bttv-input.c patching file drivers/media/video/cx18/cx18-i2c.c patching file drivers/media/video/cx23885/cx23885-i2c.c patching file drivers/media/video/em28xx/em28xx-cards.c Hunk #1 succeeded at 2443 (offset -11 lines). patching file drivers/media/video/ivtv/ivtv-i2c.c patching file drivers/media/video/v4l2-common.c patching file drivers/media/video/ivtv/ivtv-driver.c Hunk #3 succeeded at 1013 (offset 2 lines). Hunk #4 succeeded at 1241 (offset 2 lines). Hunk #5 succeeded at 1381 (offset 2 lines). patching file drivers/media/video/ivtv/ivtv-driver.h patching file drivers/media/video/ivtv/ivtv-irq.c patching file drivers/media/video/ivtv/ivtv-irq.h patching file drivers/media/dvb/dvb-core/dvb_net.c patching file drivers/media/rc/imon.c patching file drivers/media/dvb/frontends/tua6100.c patching file drivers/media/rc/rc-main.c patching file drivers/media/dvb/dvb-usb/dvb-usb-remote.c patching file drivers/media/video/pvrusb2/pvrusb2-sysfs.c patching file drivers/media/rc/rc-core-priv.h patching file drivers/media/rc/ir-raw.c patching file drivers/media/video/cx23885/cx23888-ir.c patching file drivers/media/video/cx25840/cx25840-ir.c patching file drivers/media/video/meye.c patching file drivers/media/video/meye.h patching file include/media/lirc_dev.h
The driver is then patched for backwards compatibility with the 2.6.32 kernel. I then do a diff of this patched driver with the current 2.6.32 kernel driver:
dave@ubuntu:~/setup-scripts/sources/gspca-latest$ diff -rupN v2.6.32_kernel/drivers/media/video/gspca/ gspca/drivers/media/video/gspca/ > update_gspca.patch
So the patch I’ve just created, patches the 2.6.32 kernel with the new gspca driver which is patched for backwards compatibility.
I insert this into my OpenEmbedded recipes recompile the kernel in OpenEmbedded as described here: “OpenEmbbeded: Linux kernel + adding PSEYE (patched) modules“:
dave@ubuntu:~/setup-scripts$ MACHINE=beagleboard ./oebb.sh bitbake virtual/kernel -c clean dave@ubuntu:~/setup-scripts$ MACHINE=beagleboard ./oebb.sh bitbake virtual/kernel
So if you’re doing anything like me and using an experimental driver which is off the main video for linux tree then it is highly possibly that you’ll get some compile errors due to changes in the code since the official version. You could either use the main v4l tree or go through each of the compile errors and fix them yourself. I decided to fix each of the errors as there didn’t appear to be too many.
The compile errors I was getting:
| CC [M] drivers/media/video/gspca/conex.o | CC [M] drivers/media/video/gspca/etoms.o | CC [M] drivers/media/video/gspca/finepix.o | CC [M] drivers/media/video/gspca/gspca.o | drivers/media/video/gspca/gspca.c: In function 'alloc_and_submit_int_urb': | drivers/media/video/gspca/gspca.c:216: error: implicit declaration of function 'usb_alloc_coherent' | drivers/media/video/gspca/gspca.c:217: warning: assignment makes pointer from integer without a cast | drivers/media/video/gspca/gspca.c:236: error: implicit declaration of function 'usb_free_coherent' | drivers/media/video/gspca/gspca.c: In function 'create_urbs': | drivers/media/video/gspca/gspca.c:738: warning: assignment makes pointer from integer without a cast | drivers/media/video/gspca/gspca.c: In function 'gspca_release': | drivers/media/video/gspca/gspca.c:1208: error: implicit declaration of function 'video_device_node_name' | drivers/media/video/gspca/gspca.c:1208: warning: format '%s' expects type 'char *', but argument 2 has type 'int' | drivers/media/video/gspca/gspca.c: In function 'gspca_dev_probe2': | drivers/media/video/gspca/gspca.c:2270: warning: format '%s' expects type 'char *', but argument 2 has type 'int' | drivers/media/video/gspca/gspca.c: In function 'gspca_disconnect': | drivers/media/video/gspca/gspca.c:2324: warning: format '%s' expects type 'char *', but argument 2 has type 'int' | make[4]: *** [drivers/media/video/gspca/gspca.o] Error 1 | make[3]: *** [drivers/media/video/gspca] Error 2 | make[2]: *** [drivers/media/video] Error 2 | make[1]: *** [drivers/media] Error 2 | make: *** [drivers] Error 2 | + die 'oe_runmake failed' | + oefatal 'oe_runmake failed' | + echo FATAL: 'oe_runmake failed' | FATAL: oe_runmake failed | + exit 1 NOTE: package linux-omap-psp-2.6.32-r100c+gitr5fc29e7b2a76a64a739f857858ef0b98294aa155: task do_compileconfigs: Failed ERROR: Function 'do_compileconfigs' failed (see /home/dave/setup-scripts/build/tmp-angstrom_2008_1/work/beagleboard-angstrom-linux-gnueabi/linux-omap-psp-2.6.32-r100c+gitr5fc29e7b2a76a64a739f857858ef0b98294aa155/temp/log.do_compileconfigs.6497 for further information) ERROR: Task 12 (/home/dave/setup-scripts/sources/openembedded/recipes/linux/linux-omap-psp_2.6.32.bb, do_compileconfigs) failed with exit code '1' ERROR: '/home/dave/setup-scripts/sources/openembedded/recipes/linux/linux-omap-psp_2.6.32.bb' failed
So I found the best way to fix these compile errors is to jump onto the git history and look at kernel patches merges from the master tree. For my errors I narrowed it down to a particular kernel patch:
USB: rename usb_buffer_alloc() and usb_buffer_free() users
Daniel Mack [Mon, 12 Apr 2010 11:17:25 +0000 (13:17 +0200)]
For more clearance what the functions actually do,
usb_buffer_alloc() is renamed to usb_alloc_coherent()
usb_buffer_free() is renamed to usb_free_coherent()
They should only be used in code which really needs DMA coherency. All call sites have been changed accordingly, except for staging drivers.
After successful compliation, I checked that the patch was applied by checking the logs (OE temp folder, log.do_patch) :
NOTE: Applying patch 'update_gspca.patch' (../sources/openembedded/recipes/linux/linux-omap-psp-2.6.32/update_gspca.patch)
Then I copy the new kernel + modules to the SD then boot it up! Once it has booted I can check the info on the module to see the updated version:
root@beagleboard:~# modinfo gspca_ov534 + modinfo gspca_ov534 filename: /lib/modules/2.6.32/kernel/drivers/media/video/gspca/gspca_ov534.ko license: GPL description: GSPCA/OV534 USB Camera Driver author: Antonio Ospite <ospite@studenti.unina.it> srcversion: 43331721D0931CE8AD7191A alias: usb:v06F8p3002d*dc*dsc*dp*ic*isc*ip* alias: usb:v1415p2000d*dc*dsc*dp*ic*isc*ip* depends: gspca_main vermagic: 2.6.32 preempt mod_unload modversions ARMv7 root@beagleboard:~#
Lets give it a try using gstreamer:

Great! The auto-white balance is working. So here we have the Playstation eye plugged into a BeagleBoard -xM capturing video with the latest drivers on the 2.6.32 kernel.
References:
[1] http://nuigroup.com/forums/viewthread/4079/
[2] http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers
Update 2011-06-20
As requested: gspca kernel objects for BeagleBoard 2.6.32 Kernel (current as of 2011-06-12): LINK
Could you please let us know which color spaces are supported by this camera? In particular I am interested if UYVY is supported because this is the only one accepted by TIVidenc1 on BeagleBoard.
I don’t have any experience with TIVidenc1 but will move towards it for streaming eventually. I believe the camera is natively YUYV which is essentially the same as UYVY but has different different component ordering. Don’t quote me on this, as I haven’t tested them but the drivers support a range of modes, and gst-inspect tells me it supports UYVY.
Your projects looks very interesting. I have been hoping to do something similar by utilizing the high framerate of 125hz in the Playstation Eye to reduce motion blur while the vehicle is moving. If you do go towards the Playstation Eye I’m interested to know how you get on. I can even test out some code for you if you like
Hey,
great Post, thanks!
I have pretty much the same setup. BeagleBoard xM, Angstrom, PSEye Camera. Im experiencing problems with the standard driver (brightness, speed) and i want to test the latest driver.
Is it possible to send me the Kernel Object you created?
Thanks man!
Ralph
I’ve posted the kernel objects for the gspca drivers. gspca_ov534 depends of gspca_main so you’ll need to copy both. Just remember these were compiled for the 2.6.32 kernel. Let me know how you get on. Have fun!
Thank you! I will test these later. Yesterday my sd card got broken… i’ll have get a new one today
Meanwhile i’m trying to complete your steps to compile the kernel with the new driver by myself.
The generated patch for the 2.6.32 won’t work in the building process. I get these errors:
Applying patch update_gspca.patch
patching file drivers/media/video/gspca/coarse_expo_autogain.h
patching file drivers/media/video/gspca/cpia1.c
Hunk #1 FAILED at 1262.
Hunk #2 FAILED at 1284.
Hunk #3 FAILED at 1770.
3 out of 3 hunks FAILED — rejects in file drivers/media/video/gspca/cpia1.c
patching file drivers/media/video/gspca/gl860/gl860.c
Hunk #1 FAILED at 499.
1 out of 1 hunk FAILED — rejects in file drivers/media/video/gspca/gl860/gl860.c
patching file drivers/media/video/gspca/gspca.c
Hunk #1 FAILED at 55.
Hunk #2 FAILED at 2495.
2 out of 2 hunks FAILED — rejects in file drivers/media/video/gspca/gspca.c
patching file drivers/media/video/gspca/gspca.h
Hunk #1 FAILED at 9.
Hunk #2 FAILED at 25.
2 out of 2 hunks FAILED — rejects in file drivers/media/video/gspca/gspca.h
patching file drivers/media/video/gspca/jeilinj.c
Hunk #1 FAILED at 6.
Hunk #2 FAILED at 26.
Hunk #3 FAILED at 36.
Hunk #4 FAILED at 88.
Hunk #5 FAILED at 102.
Hunk #6 FAILED at 400.
Hunk #7 FAILED at 570.
7 out of 7 hunks FAILED — rejects in file drivers/media/video/gspca/jeilinj.c
patching file drivers/media/video/gspca/Kconfig
Hunk #1 FAILED at 77.
1 out of 1 hunk FAILED — rejects in file drivers/media/video/gspca/Kconfig
The next patch would delete the file drivers/media/video/gspca/kinect.c,
which does not exist! Applying it anyway.
patching file drivers/media/video/gspca/kinect.c
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED — rejects in file drivers/media/video/gspca/kinect.c
patching file drivers/media/video/gspca/Makefile
Hunk #1 FAILED at 5.
Hunk #2 FAILED at 47.
2 out of 2 hunks FAILED — rejects in file drivers/media/video/gspca/Makefile
patching file drivers/media/video/gspca/ov519.c
Hunk #1 FAILED at 609.
Hunk #2 FAILED at 3307.
Hunk #3 FAILED at 3470.
Hunk #4 FAILED at 3511.
Hunk #5 FAILED at 4478.
5 out of 5 hunks FAILED — rejects in file drivers/media/video/gspca/ov519.c
patching file drivers/media/video/gspca/sonixj.c
Hunk #1 FAILED at 60.
1 out of 1 hunk FAILED — rejects in file drivers/media/video/gspca/sonixj.c
patching file drivers/media/video/gspca/spca508.c
Hunk #1 FAILED at 1375.
Hunk #2 FAILED at 1385.
Hunk #3 FAILED at 1402.
3 out of 3 hunks FAILED — rejects in file drivers/media/video/gspca/spca508.c
patching file drivers/media/video/gspca/stk014.c
Hunk #1 FAILED at 436.
1 out of 1 hunk FAILED — rejects in file drivers/media/video/gspca/stk014.c
patching file drivers/media/video/gspca/stv06xx/stv06xx_hdcs.h
Hunk #1 FAILED at 125.
1 out of 1 hunk FAILED — rejects in file drivers/media/video/gspca/stv06xx/stv06xx_hdcs.h
patching file drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c
Hunk #1 FAILED at 217.
1 out of 1 hunk FAILED — rejects in file drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c
patching file drivers/media/video/gspca/sunplus.c
Hunk #1 FAILED at 396.
Hunk #2 FAILED at 422.
Hunk #3 FAILED at 469.
Hunk #4 FAILED at 507.
Hunk #5 FAILED at 532.
Hunk #6 FAILED at 584.
Hunk #7 FAILED at 729.
Hunk #8 FAILED at 762.
Hunk #9 FAILED at 836.
Hunk #10 FAILED at 850.
10 out of 10 hunks FAILED — rejects in file drivers/media/video/gspca/sunplus.c
patching file drivers/media/video/gspca/t613.c
Hunk #1 FAILED at 92.
Hunk #2 FAILED at 1377.
2 out of 2 hunks FAILED — rejects in file drivers/media/video/gspca/t613.c
patching file drivers/media/video/gspca/zc3xx.c
Hunk #1 FAILED at 3065.
Hunk #2 FAILED at 3077.
Hunk #3 FAILED at 3089.
Hunk #4 FAILED at 3101.
Hunk #5 FAILED at 3113.
Hunk #6 FAILED at 3125.
Hunk #7 FAILED at 6266.
Hunk #8 FAILED at 6358.
8 out of 8 hunks FAILED — rejects in file drivers/media/video/gspca/zc3xx.c
Patch update_gspca.patch does not apply (enforce with -f)
NOTE: package linux-omap-psp-2.6.32-r100c+gitr5fc29e7b2a76a64a739f857858ef0b98294aa155: task patch_do_patch: Failed
ERROR: Function ‘patch_do_patch’ failed
I checked out the kernel from:
git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git v2.6.32
Is this right?
Hmm. I assume the patch you’re running here is the diff between the latest patched driver with the current 2.6.32 kernel driver.
It looks like every single hunk failed. Are you sure you’re running it at the correct striplevel? If you want to insert it into an open-embedded recipe you’ll need to make the patch so it run at striplevel 1 from within the unpacked source directory. REF
I actually just used the kernel source v2.6.32 tar from the download directory in open-embedded. Without looking at the recipe I’d assume it gets it from the git you’re using.
If you’re having trouble getting the patch you’ve created to work, post it some where and I’ll have a look tomorrow.