Monday, 30 July 2012


  1. Raspberry Pi
  2. BeagleBone
  3. syntek/'easycap' capture device
  4. em28xx capture devices
  5. 5v regulator
  6. SD card reader
  7. Multimeter

The bullet camera is mostly obscured by an elephant.

Friday, 27 July 2012


Advantech MIO2260


Monday, 23 July 2012

BeagleBone - ubuntu precise 12.04 armhf

Beaglebone with ubuntu precise

On debian laptop 

(, 2012)


sudo ./ --mmc /dev/sdX --uboot "board"

ssh into BeagleBone

 (R.Nelson, 2012)

apt-get update

apt-get upgrade

apt-get install libncurses5-dev lzma make gcc patchutils libproc-processtable-perl

create a swapfile

mkdir -p /var/cache/swap/ sudo dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=1024 sudo 

chmod 0600 /var/cache/swap/swapfile 
mkswap /var/cache/swap/swapfile
swapon /var/cache/swap/swapfile

get sources and BeagleBone patches

mkdir /home/stuff

cd /home/stuff



mkdir /home/linux

cd /home/linux


tar xjf linux-3.2.tar.bz2 

cd linux-3.2

zcat /home/stuff/patch-3.2-psp16.diff.gz | patch -p1

cp /dir/downloaded/defconfig .config

edit the em28xx driver (Makarov, 2011)

cd drivers/media/video/em28xx/

sed -i 's/height >>= norm_maxh(dev)/height = norm_maxh(dev) >> 1/' em28xx-core.c

cd /home/linux/linux-3.2

make menuconfig

Device drivers > USB support > disable DMA (always use PIO)


make modules_install

apt-get install motion

Getting a decent picture out of the lifecam, but timeouts from the em28xx.


Answer = use a syntek device!

thanks to :!topic/beagleboard/NZGU2gt-U2Y

Amazon uk link;

This card is currently producing a 720x576 image in motion on the BeagleBone running ubuntu 12.04 - and no mucking about with the kernel.

References, July 2012, BeagleBoardUbuntu, available from accessed 23rd July 2012

Robert C Nelson, (2012) in reply to ubuntu make error No such file or directory available from!topic/beagleboard/5xMAyFxQbdE accessed 23rd July 2012

Vitaly Makarov (2011) Non-portable code in em28XX driver, available from , accessed 21st July 2012

Sunday, 22 July 2012

BeagleBone Angstrom


used recommended

xz -dkc my_image_file.img.xz | pv | sudo dd of=/dev/your_sd_card

boots ok, logging in as root.
not familiar with opkg package manager, but first steps seems straightforward.

opkg update 

opkg upgrade

fuck, no motion/ffmpeg on opkg, ...girding my loins;

git clone git://



make install

Well, this seems to work with the lifecam at 320x240, struggled at 1280x720! Ram? 
Not working for the easycap DC60, but it is picking up the em28xx module.
No ffmpeg, (it's not installed), can't seem to install patchutils, let alone media_build drivers either. Feeling a bit lost without apt-get, going to bask my head against Ubuntu again for a while. Lots of new palettes on this motion installation though (17!).

Tuesday, 17 July 2012



N.B. this attempt has failed - starting from the top in the next post.

I've shelved the Raspberry Pi until the USB webcam issues magically go away. I don't think I have the time or resources to look into these issues any further myself, and 320x240 is a very poor solution in 2012. 

Meanwhile I've ordered a BeagleBone from Farnell, and it has arrived today. Back to square one - get the camera working.

Installing Ubuntu

I used the "Install Ubuntu core system" instructions from

see also;

get the software;

sudo apt-get update
sudo apt-get install ffmpeg motion
sudo nano /etc/motion/motion.conf

changes to motion.conf for em28xx capture device;

input 1
ffmpeg_deinterlace on

webcam_localhost off

Testing with kworld usb2800 gives familiar looking green screen....
Testing with cx321xx (hauppage USB live 2) hangs motion on startup.
(this looks very much like the initial Raspberry Pi results... )

mending em28xx

Trying the drivers first

need linux headers for BeagleBone first;


dpkg -i linux-headers-3.2.21-psp16_1.0oneiric_armel.deb

didn't quite work

make[2]: Entering directory `/usr/src/linux-headers-3.2.0-psp7'

  CC [M]  /home/test/media_build/v4l/altera-lpt.o

In file included from include/linux/timex.h:174:0,

                 from include/linux/jiffies.h:8,

                 from include/linux/ktime.h:25,

                 from include/linux/timer.h:5,

                 from include/linux/workqueue.h:8,

                 from include/linux/pm.h:25,

                 from include/linux/device.h:24,

                 from include/linux/input.h:1136,

                 from /home/test/media_build/v4l/compat.h:9,

                 from <command-line>:0:

/usr/src/linux-headers-3.2.0-psp7/arch/arm/include/asm/timex.h:15:24: fatal error: mach/timex.h: No such file or directory

compilation terminated.

this looks useful here!topic/beagleboard/5xMAyFxQbdE

Getting full source





apply patch

zcat /home/test/patch-3.2-psp16.diff.gz | patch -p1
copy config

cp /home/test/defconfig .config

Looks like we are rebuilding the kernel then. The best of luck!


6hrs 50min later  It's finished, but with some error. 

OBJCOPY arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
LZMA arch/arm/boot/compressed/piggy.lzma
/bin/sh: lzma: not found
make[2]: *** [arch/arm/boot/compressed/piggy.lzma] Error 1
make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2
make: *** [zImage] Error 2

I hope lzma isn't important. (did apt-get install lzma but haven't re-maked yet)... moving on regardless.

make modules

make modules_install


no progress...

ah - symlink!... /lib/modules/linux-xxx/build was still pointing to headers, not to the source. [Stupid twat.]

./build wants make oldconfig and make prepare now, so I did that.

nearly there I think, media_build now fails with omap_vout. This doesn't sound like something I need - i'm going to just try disabling that.

 CC [M]  /home/test/media_build/v4l/omap_vout.o
/home/test/media_build/v4l/omap_vout.c: In function 'omapvid_setup_overlay':
/home/test/media_build/v4l/omap_vout.c:423:2: error: 'struct omap_overlay' has no member named 'is_enabled'
/home/test/media_build/v4l/omap_vout.c: In function 'omap_vout_release':
/home/test/media_build/v4l/omap_vout.c:952:7: error: 'struct omap_overlay' has no member named 'disable'
/home/test/media_build/v4l/omap_vout.c: In function 'vidioc_streamon':
/home/test/media_build/v4l/omap_vout.c:1695:13: error: 'struct omap_overlay' has no member named 'enable'
/home/test/media_build/v4l/omap_vout.c: In function 'vidioc_streamoff':
/home/test/media_build/v4l/omap_vout.c:1731:7: error: 'struct omap_overlay' has no member named 'disable'

cd media_build
menu menuconfig
-disabled all v4l platform devices
-trying again
make works this time.

make install


Oh, that hasn't worked.
According to lsmod no em28xx module is loaded... fatal errors when I try and modprobe the em28xx.ko files in media_build/v4l. Looks like an issue with my
source and the kernel?

I'm going to try and rebuild the kernel again, and actually use the image it makes - at least I will have break for a few hours.

This time I have lzma, but it can't allocate any memory.

 Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/head.o
  LZMA    arch/arm/boot/compressed/piggy.lzma
lzma: Cannot allocate memory
make[2]: *** [arch/arm/boot/compressed/piggy.lzma] Error 1
make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2
make: *** [zImage] Error 2

I suspect that would be because there physically isn't enough RAM... swapfile?
(Interesting it was a few hours quicker getting to this stage with the quantal armhf image)


sudo mkdir -p /var/cache/swap/   
sudo dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=1024
sudo chmod 0600 /var/cache/swap/swapfile 
sudo mkswap /var/cache/swap/swapfile 
sudo swapon /var/cache/swap/swapfile 

it says add this line to /etc/fstab - i'm not sure i want a swapfile yet - i'll see how motion performs once it's working.

/var/cache/swap/swapfile    none    swap    sw    0   0

This compiles. No luck with the media_build driver this time... editing the driver in the kernel source gets me a flashing black/green screen... I'm going to stop and have a think. Something isn't right here. IR modded lifecam looks nice though...

After playing with Angstrom I've come back to this and tried removing motion and ffmpeg, and installing motion from source. Needed
sudo apt-get install libjpeg8 libjpeg8-dev
to work. (found the name of the jpeg packages here )Now I'm getting the seg faults on the lifecam at 720x576 (ok at 320x240).. but I am getting a picture out of the easycam em28xx devices.
Picture not useable - horizontal lines through it and colour problems. Suspect known USB DMA issues afoot?

looking at my .config confirms PIO not set!topic/beagleboard/rBv2ZGSietM


Rebuilding the kernel again with this change in .config < and then trying again, by doing it via make menuconfig

used this to make kernel image;

cd /home/test/linux/linux-3.2/arch/arm/boot/

mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux" -d zImage uImage 

mv /boot/uboot/uImage /boot/uboot/uImage.old

cp uImage /boot/uboot

modified from ( and

Notes to self
DC input 2.1mm x 5.5mm
Uses two 46 pin dual row .1 x .1 female headers
this looks useful

don't forget

apt-get install libncurses5-dev lzma make gcc patchutils libproc-processtable-perl

Monday, 2 July 2012

em28xx procedure

This is my em28xx procedure to get a working capture device running on a raspberry pi from an empty SD card. It is a bit crude - but it worked for me. These notes are primarily for my own benefit, so may not be as thorough as they could be... I presume there must be an easier way to build the em28xx driver without building everything each time, but this worked. I have presently dropped the RPi in favour of the BeagleBone, which doesn't seem to have any USB issues with larger image sizes. You won't see any sudo commands, other than building the wheezy image on the mac, as I log in as root on the raspberry pi

Make the disk image (mac)

diskutil list

sudo diskutil unmountDisk /dev/disk1

dd if=/Users/michael/Desktop/RaspberryPi/Images/2012-06-18-wheezy-beta.img of=/dev/disk1 bs=1m

boot the pi with new card

apt-get update && apt-get upgrade
apt-get install git ffmpeg motion libncurses5-dev

Rebuild the kernel


git clone --depth 1

cd linux

zcat /proc/config.gz > .config

make menuconfig

(enable i2c and em28xx stuff)


git clone

cd tools/mkimage/
python home/pi/linux/arch/arm/boot/Image

mv /boot/kernel.img /boot/kernel.old

cp kernel.img /boot/kernel.img

cd /home/pi/linux

make modules_install


update em28xx drivers

sudo apt-get install  patchutils libproc-processtable-perl

git clone git://

cd media_build


./build downloads the latest everything and tries to make it - if this works, that's great, but we need to edit em28xx-core.c and remake this. The sed command below changes height >>= norm_maxh(dev)to height = norm_maxh(dev) >> 1 in /linux/drivers/media/video/em28xx/em28xx-core.c to solve a portability issue to ARM. (Makarov, 2012)

cd linux/drivers/media/video/em28xx/

sed -i 's/height >>= norm_maxh(dev)/height = norm_maxh(dev) >> 1/' em28xx-core.c

Now build the drivers again. This time using make all instead of ./build to preserve changes to em28xx-core.c

cd media_build

make all    

make install

Note, Trying to repeat this process on another SD card has invoked an error during the ./build stage;

/home/pi/media_build/v4l/drxk_hard.c:333:3: error: implicit declaration of function '__i2c_transfer' [-Werror=implicit-function-declaration]

I'm not sure what I have done differently - but I ran make menuconfig in the media_build directory and removed any modules that 'didn't look very useful' and that fixed it.

Don't forget to edit /etc/motion/motion.conf

cd /etc/motion/motion.conf

cp motion.conf motion.conf.original

nano motion.conf

Input should be input 1 or input 0 depending on the device - if you get it wrong, and the device is working you will see a black screen (not green!). I would recommend the resolution is 320x240 for the first run. Turn on interlacing (ffmpeg_deinterlace on) and webserver (webcam_localhost off), you will probably want webconfig too (control_localhost off)... you know all this stuff. Here are some sed commands I might use next time I do this, because it's getting boring;

sed -i 's/input 8/input 0/' motion.conf

sed -i 's/ffmpeg_deinterlace off/ffmpeg_deinterlace on/' motion.conf

sed -i 's/webcam_localhost on/webcam_localhost off/' motion.conf

sed -i 's/control_localhost on/control_localhost off/' motion.conf

Then test it



Vitaly Makarov (2011) Non-portable code in em28XX driver, available from , accessed 21/7/12
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License