<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>logIt &#187; video capture</title>
	<atom:link href="https://lakm.us/logit/tag/video-capture/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Ubuntu on Beagleboard xM with Easycap Video Capture (Compiling Driver)</title>
		<link>https://lakm.us/logit/2011/12/ubuntu-on-beagleboard-xm-with-easycap-video-capture-compiling-driver/</link>
		<comments>https://lakm.us/logit/2011/12/ubuntu-on-beagleboard-xm-with-easycap-video-capture-compiling-driver/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 12:25:58 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARMv7]]></category>
		<category><![CDATA[BeagleBoard]]></category>
		<category><![CDATA[embedded system]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[OMAP3]]></category>
		<category><![CDATA[rootfs]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[video capture]]></category>

		<guid isPermaLink="false">http://xp-racy.lan/it/?p=233</guid>
		<description><![CDATA[Attempt to run Ubuntu in BeagleBoard xM rev C board has taken me to try various options of kernel and release. The goal was to have both Ubuntu and widely-available Easycap as video input via the USB of this compact TI OMAP board. Porting Ubuntu would spare us some flexibility to try different alternatives of [...]]]></description>
				<content:encoded><![CDATA[<p>Attempt to run Ubuntu in <a href="http://beagleboard.org/hardware-xM">BeagleBoard xM</a> rev C board has taken me to try various options of kernel and release. The goal was to have both Ubuntu and widely-available <a href="http://easycap.co.uk/">Easycap</a> as video input via the USB of this compact TI OMAP board. Porting Ubuntu would spare us some flexibility to try different alternatives of video processing and networking options for the stream. The easiest way initially was to run Ubuntu preinstalled image. I had two popular options immediately: 1) Ubuntu Port CD Image release 2) Robert C. Nelson custom image (rootfs). I started with the later first to see the board running at once. The latest found in <a href="http://rcn-ee.net/deb/rootfs/">http://rcn-ee.net/deb/rootfs/</a> was ubuntu-11.10-r0-minimal-armel.tar.xz which gave me Ubuntu 11.10 Oneiric with custom linux 3.0.3-x2 kernel.</p>
<div class="wp-caption aligncenter" style="width: 510px"><img alt="Easycap USB Video-Audio Capture.jpg" src="../../../../images/easycap.jpg" title="Easycap USB Video-Audio Capture" class="aligncenter" width="138" height="127" /><p class="wp-caption-text">Easycap USB Video-Audio Capture</p></div>
<p>It turned out that this custom kernel hadn&#8217;t been compiled with<del datetime="2013-03-25T02:25:52+00:00">out</del> Easycap. We can compare that to my laptop running linux 2.6.38-10 where it was part of its kernel compilation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>ubuntu-laptop<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">cat</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-2.6.38-<span style="color: #000000;">10</span><span style="color: #000000; font-weight: bold;">/</span>.config <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-i</span> easy
<span style="color: #007800;">CONFIG_EASYCAP</span>=m</pre></div></div>

<p>Compiling the whole thing using <code>make menuconfig</code> to change <code>.config</code> file and so on seemed too much. A more partial approach was to touch only relevant <code>Makefile</code> involved in building the driver. First we needed the kernel header files provided as <a href="http://rcn-ee.net/deb/oneiric/v3.0.6-x3/linux-headers-3.0.6-x3_1.0oneiric_armel.deb">linux-headers-3.0.6-x3_1.0oneiric_armel.deb</a> and then source files for Easycap. As this was custom kernel, by guessing I found that it was closest to official linux 3.0.0-12.20 at <a href="https://launchpad.net/ubuntu/+source/linux/3.0.0-12.20">launchpad</a>, hence easycap source files were copied from it (the custom kernel might&#8217;ve been forked from this release as some random header files comparison to <code>linux-headers-3.0.0-12-omap_3.0.0-12.20_armel</code> returned no difference).</p>
<p>FYI Easycap linux driver is no longer developed separately as a SourceForge project, it has been part of <code>drivers/staging</code> in recent kernel releases (where you get <code>dmesg</code> like &#8220;<em>module is from the staging directory, the quality is unknown, you have been warned</em>&#8221; when inserting it). In the source we&#8217;ll find <code>/linux-3.0/drivers/staging/easycap/</code> to be copied into <code>/usr/src/linux-headers-3.0.6-x3/drivers/staging/easycap/</code> on the board.</p>
<p>After removing the old one (pointed to  <code>build -> /build/buildd/linux-3.0</code>), I created a link inside <code>/lib/modules/3.0.6-x3</code> named <code>build</code> pointing to:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">build -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3</pre></div></div>

<p>then copied the <code>Makefile</code> from my laptop to replace original Easycap source with this content of rules:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">obj-m	+= easycap.o
&nbsp;
easycap-y	:= easycap_main.o easycap_low.o easycap_sound.o
easycap-y	+= easycap_ioctl.o easycap_settings.o
easycap-y	+= easycap_testcard.o
&nbsp;
ccflags-y := <span style="color: #660033;">-Wall</span>
<span style="color: #666666; font-style: italic;"># Impose all or none of the following:</span>
ccflags-y += -DEASYCAP_IS_VIDEODEV_CLIENT
ccflags-y += -DEASYCAP_NEEDS_V4L2_DEVICE_H
ccflags-y += -DEASYCAP_NEEDS_V4L2_FOPS
ccflags-y += -DEASYCAP_NEEDS_UNLOCKED_IOCTL</pre></div></div>

<p>Compiling should work afterward:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">-C</span> <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>build<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #007800;">M</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>
  LD      <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>built-in.o
  CC <span style="color: #7a0874; font-weight: bold;">&#91;</span>M<span style="color: #7a0874; font-weight: bold;">&#93;</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>easycap_main.o
  CC <span style="color: #7a0874; font-weight: bold;">&#91;</span>M<span style="color: #7a0874; font-weight: bold;">&#93;</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>easycap_low.o
  CC <span style="color: #7a0874; font-weight: bold;">&#91;</span>M<span style="color: #7a0874; font-weight: bold;">&#93;</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>easycap_sound.o
  CC <span style="color: #7a0874; font-weight: bold;">&#91;</span>M<span style="color: #7a0874; font-weight: bold;">&#93;</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>easycap_ioctl.o
  CC <span style="color: #7a0874; font-weight: bold;">&#91;</span>M<span style="color: #7a0874; font-weight: bold;">&#93;</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>easycap_settings.o
  CC <span style="color: #7a0874; font-weight: bold;">&#91;</span>M<span style="color: #7a0874; font-weight: bold;">&#93;</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>easycap_testcard.o
  LD <span style="color: #7a0874; font-weight: bold;">&#91;</span>M<span style="color: #7a0874; font-weight: bold;">&#93;</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>easycap.o
  Building modules, stage 2.
  MODPOST <span style="color: #000000;">1</span> modules
  CC      <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>easycap.mod.o
  LD <span style="color: #7a0874; font-weight: bold;">&#91;</span>M<span style="color: #7a0874; font-weight: bold;">&#93;</span>  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>staging<span style="color: #000000; font-weight: bold;">/</span>easycap<span style="color: #000000; font-weight: bold;">/</span>easycap.ko
<span style="color: #c20cb9; font-weight: bold;">make</span>: Leaving directory <span style="color: #000000; font-weight: bold;">`/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #ff0000;">'</span></pre></div></div>

<p>I tried to <code>insmod</code> the <code>easycap.ko</code> built, but dmesg showed some error and no <code>/dev/video0</code> created. There must be some other drivers that must be loaded first which I didn&#8217;t know in what sequence (i.e. <code>v4l2-common</code> etc.), hence I decided to just copy that under the <code>/lib/modules/3.0.6-x3/kernel/drivers/staging/easycap</code>, <code>depmod -a</code>, <del datetime="2012-01-10T04:33:20+00:00">and reboot</del>.</p>
<p>If you plug the Easycap while inspecting the <code>syslog</code> tail, there won&#8217;t be similar message as found in kernel 2.6.38-10. Instead, you&#8217;ll see:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1377.696838</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> usb <span style="color: #000000;">1</span>-<span style="color: #000000;">2.3</span>: new high speed USB device number <span style="color: #000000;">6</span> using ehci-omap
mtp-probe: checking bus <span style="color: #000000;">1</span>, device <span style="color: #000000;">6</span>: <span style="color: #ff0000;">&quot;/sys/devices/platform/usbhs-omap.0/ehci-omap.0/usb1/1-2/1-2.3&quot;</span>
mtp-probe: bus: <span style="color: #000000;">1</span>, device: <span style="color: #000000;">6</span> was not an MTP device
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1378.052459</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Linux video capture interface: v2.00
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1378.169006</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Easycap version: 0.9.01
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1378.198944</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> usbcore: registered new interface driver snd-usb-audio
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.043853</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_standard: selected standard: PAL_BGHIN
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.151245</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_format: sought:    640x480,UYVY<span style="color: #7a0874; font-weight: bold;">&#40;</span>0x59565955<span style="color: #7a0874; font-weight: bold;">&#41;</span>,<span style="color: #000000;">1</span>=field,<span style="color: #000000;">0</span><span style="color: #007800;">x00</span>=std mask
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.151306</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_format: sought:    V4L2_FIELD_NONE
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.151336</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_format: actioning: 640x480 PAL_BGHIN_AT_640x480_FMT_UYVY-n
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.181488</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_brightness: adjusting brightness to  0x7F
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.184478</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_contrast: adjusting contrast to  0x3F
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.212768</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_saturation: adjusting saturation to  0x2F
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.214599</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_hue: adjusting hue to  0x00
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.219207</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0easycap_usb_probe: registered with videodev: <span style="color: #000000;">0</span>=minor
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.219238</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0easycap_usb_probe: ends successfully <span style="color: #000000; font-weight: bold;">for</span> interface <span style="color: #000000;">0</span>
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.219543</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> usbcore: registered new interface driver easycap
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1381.314453</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap:: easycap_open: ==========<span style="color: #007800;">OPEN</span>=========
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1384.031188</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_standard: selected standard: PAL_BGHIN
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1384.228759</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_format: sought:    640x480,UYVY<span style="color: #7a0874; font-weight: bold;">&#40;</span>0x59565955<span style="color: #7a0874; font-weight: bold;">&#41;</span>,<span style="color: #000000;">1</span>=field,<span style="color: #000000;">0</span><span style="color: #007800;">x00</span>=std mask
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1384.228790</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_format: sought:    V4L2_FIELD_NONE
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1384.228851</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_format: actioning: 640x480 PAL_BGHIN_AT_640x480_FMT_UYVY-n
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1384.233489</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_brightness: adjusting brightness to  0x7F
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1384.235198</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_contrast: adjusting contrast to  0x3F
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1384.237884</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_saturation: adjusting saturation to  0x2F
kernel: <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">1384.239501</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> easycap::0adjust_hue: adjusting hue to  0x00</pre></div></div>

<p>Later I find out that newer image is available on the Robert&#8217;s site, but not sure which linux source I should use for the Easycap if I were to to use it. Anyway, before deciding to just go with this one I&#8217;ve tried various kernels. Here are list of images and their kernel versions (I wasn&#8217;t quite sure which one was running smoothly and which wasn&#8217;t):</p>
<ol>
<li>linux-2.6.35.9-l9 Ubuntu 10.04 Lucid: ubuntu-10.04.1-r4-minimal-armel.tar</li>
<li>linux-3.1.4-x6 Ubuntu 11.10 Oneiric: ubuntu-11.10-r2-minimal-armel.tar.xz</li>
<li>linux-3.1.4-x6 Ubuntu 11.04 Natty: ubuntu-11.04-r7-minimal-armel.tar.xz</li>
<li>linux-2.6.38.2-d9 Ubuntu 10.10 Maverick: ubuntu-10.10-r6-minimal-armel.tar.xz</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2011/12/ubuntu-on-beagleboard-xm-with-easycap-video-capture-compiling-driver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
