|
|
(4 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
− | '''Webcam drivers on Open Embedded Part 1 - pwc driver webcams'''
| + | . |
− | | + | |
− | | + | |
− | I've spent a bit of time getting a couple of webcams successfully working on the gumstix and as something of a newbie found it not that straightforward. There seems to be quite a lot of interest in this area so I thought I would pull together a couple of Howtos - one for cameras using the pwc driver (Philips, etc) (this one) and one for cameras using the Linux uvc driver, which includes the Logitech Sphere / Orbit which has a motorised pan / tilt. It may well be possible to get other cameras working using a similar approach – I just haven’t tried it.
| + | |
− | | + | |
− | | + | |
− | | + | |
− | I am not a software developer and quite new to Linux. The approach set out here may not be the best but did work for me and therefore I hope should be understandable to anyone in the same position – ie not an “expert. Undoubtedly there will be better ways of achieving the end result - I just don't know what they are! Likewise I can't guarantee they will work for you and for all possible build configurations but I hope there is enough info here for you to figure out what went wrong if it doesn't work.
| + | |
− | | + | |
− | I will have a go at explaining why the various steps work and so hopefully this will enable the same principles to be used for cameras using other drivers. However I am pretty much a newbie so I may get this wrong….
| + | |
− | | + | |
− | '''Pre-requisites'''
| + | |
− | | + | |
− | I will assume you have set up Open Embedded on your build machine and have built one of the image recipes through to completion so you know all the bitbake elements actually work and it builds without errors. That's all that's essential I think - however if you haven't done this already, I highly recommend setting the gumstix up to boot and run from an SD or CF card. The advantages are you can keep the whole of the kernel and filesystem on the card and have no space limitation problems - and it's very quick and easy to change things just by loading the card into your desktop machine.
| + | |
− | | + | |
− | '''Pwc driver webcams'''
| + | |
− | | + | |
− | '''Outline'''
| + | |
− | | + | |
− | What you are going to do is rebuild the kernel, having custom edited the kernel config file, to produce a custom kernel with the appropriate drivers activated as modules. The sources for the pwc driver, the Video 4 Linux drivers and other drivers needed are already built into the build system so when you rebuild the kernel with bitbake, you get a new kernel and ipk packages for the modules which you can then install.
| + | |
− | | + | |
− | You want to make any custom changes in the user.collection folder. Why? Anything in user.collection takes priority over the same recipe elsewhere, but if you mess anything up (or just want to go back to the original configuration) you can delete the contents of user.collection and start over.
| + | |
− | | + | |
− | So the first step is to copy over the recipes for the kernel build and associated files into user.collection. Copy the whole "linux" package folder across from com.gumstix.collection.
| + | |
− | Next, find the .config file which was produced when you built your first (or subsequent) image. It should be in '''/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/linux-2.6.21/''' (or connex etc if you have a connex and not a verdex). The kernel version actually used by the build will change over time – this is the one mine currently uses.
| + | |
− | | + | |
− | CD into this directory and type '''“make ARCH=arm menuconfig”.'''
| + | |
− | | + | |
− | After a bit of crunching a menu based kernel configuration tool opens up. You can step through this and enable whatever you want - generally (but not always) you have the choice of building the driver into the kernel or building as a module.
| + | |
− | You want to build pwc and the associated drivers as modules so you will need to enter "M" where appropriate.
| + | |
− | | + | |
− | Here are the entries you want to change to build pwc and the supporting v4l support. You might want to wander through the menus though and change other stuff - for example I have modified my boot from SD card to run an ext3 filesystem.
| + | |
− | | + | |
− | --> Device drivers --> USB Support --> Support for host-side USB
| + | |
− |
| + | |
− | --> Device drivers --> USB Support --> turn off USB Gadget support
| + | |
− | | + | |
− | --> Multimedia devices --> Video For Linux
| + | |
− | | + | |
− | --> Multimedia devices --> Video Capture Adapters --> V4L USB Devices --> usb philips camera
| + | |
− | | + | |
− | When you are satisfied with the result, save it. This writes a new .config file back to the same place.
| + | |
− | Now you want to copy this file over the default kernel config file (defconfig) in user.collection, replacing it.
| + | |
− | | + | |
− | This will be in '''linux/gumstix-kernel-2.6.21/gumstix-custom-verdex/''' (or connex etc). Make sure you target the file for the same version of the kernel your build uses.
| + | |
− |
| + | |
− | Now type '''“bitbake -c rebuild gumstix-kernel”.''' You should end up, when the build process finishes, with a new kernel and a series of ipks in tmp/deploy.
| + | |
− | You may, however, get a message saying the kernel file is too big.
| + | |
− | | + | |
− | You can override the size checker by adding the following line to your gumstix-custom-verdex.conf file ( in /conf/machine/)
| + | |
− | | + | |
− | '''KERNEL_IMAGE_MAXSIZE += "1070000"''' (or whatever, a bit bigger than the expected size of the kernel).
| + | |
− | | + | |
− | Again, I would copy over the conf files into user.collection and edit them there.
| + | |
− | Making the kernel bigger is fine if like me you are booting from a card with 2GB of space and therefore don't care about the size of the kernel. If you really need to get the kernel under 1MB however you might have to go back to do some pruning of your changes to get the kernel to fit - so back to "menuconfig" etc.
| + | |
− | | + | |
− | You then replace your kernel with the newly built one, and install the ipks. There are 5 in total, for the following *.ko modules: compat_ioctl.ko, v4l1-compat.ko, v4l2-common.ko, videodev.ko, and pwc.ko.
| + | |
− | | + | |
− | The package manager should take care of the installation but you can install the modules manually - the four modules other than pwc.ko go in /lib/modules/2.6.21/kernel/drivers/media/video, and pwc goes in it’s own subdirectory in .... …/kernel/drivers/media/video/pwc. Then do depmod -a so your system recognises the modules.
| + | |
− | | + | |
− | The modules are now installed but not active. When you plug in your camera, however, the hotplugger should recognise the camera and load up the modules. If you can, try this with a connection over a serial port as then you will see the kernel messages over the port - otherwise run "dmesg". This should show your camera being recognised and if you go into /dev, you should see the new device (/dev/video0 if this is your only video device).
| + | |
− |
| + | |
− | | + | |
− | '''Seeing the output'''
| + | |
− | | + | |
− | So far so good, you might say, but how do I get a picture? I’m sure there are many ways of accessing the driver. I used a package called motion. It’s pretty straightforward to build and install motion and turn on the built in webserver. There is a bitbake recipe for motion which built for me with no problems. The documentation for motion is good - you do more or less everything by editing the conf file. One of the options is to set up a mini webserver. If you then view the webpage created from another machine, you should see your webcam picture, provided you don't use I E which can't handle the streaming format – but Firefox works fine if your viewing machine is running Windows.
| + | |
− | | + | |
− | '''Other camera drivers'''
| + | |
− | | + | |
− | My impression is this same process should work for the GSPCA driver – do the enabling in the kernel build, but choose the GSPCA driver rather than the Philips one - however I haven't actually tried it!
| + | |
− | | + | |
− | --[[User:Briany|Briany]] 10:54, 11 July 2008 (CDT)
| + | |
.