<?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"
	>

<channel>
	<title>Notes</title>
	<atom:link href="http://notes.brooks.nu/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.brooks.nu</link>
	<description>Notes for sharing</description>
	<pubDate>Fri, 16 Sep 2011 03:49:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Linux NAT via iptables</title>
		<link>http://notes.brooks.nu/2011/09/linux-nat-via-iptables/</link>
		<comments>http://notes.brooks.nu/2011/09/linux-nat-via-iptables/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 03:46:05 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=264</guid>
		<description><![CDATA[If eth0 has an external network connection and you want to NAT your eth1 connection, you can use the following commands (as root):

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

]]></description>
			<content:encoded><![CDATA[<p>If eth0 has an external network connection and you want to NAT your eth1 connection, you can use the following commands (as root):</p>
<pre>
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
</pre>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2011/09/linux-nat-via-iptables/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Change hue/color of icon using image magick</title>
		<link>http://notes.brooks.nu/2011/07/change-huecolor-of-icon-using-image-magick/</link>
		<comments>http://notes.brooks.nu/2011/07/change-huecolor-of-icon-using-image-magick/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 16:52:59 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=257</guid>
		<description><![CDATA[You can use the -modulate option to change the hue of an icon, but it does not, for some unknown reason, preserve the icons alpha channel. So here is the command line option to change the hue of an icon while preserving the alpha channel:

convert icon.png -modulate 100,100,50 -alpha off icon.png -compose CopyOpacity -composite PNG32:output.png

The [...]]]></description>
			<content:encoded><![CDATA[<p>You can use the -modulate option to change the hue of an icon, but it does not, for some unknown reason, preserve the icons alpha channel. So here is the command line option to change the hue of an icon while preserving the alpha channel:</p>
<pre>
convert icon.png -modulate 100,100,50 -alpha off icon.png -compose CopyOpacity -composite PNG32:output.png
</pre>
<p>The last option to the modulate option changes the hue. Change it from 50 to whatever you want to get the hue you want. A value of 100 will leave the hue unchanged.</p>
<p>From the image magick documentation:</p>
<blockquote><p>
The hue argument causes a &#8220;rotation&#8221; of the colors within the image by the amount specified. For example, 50 results in a counter-clockwise rotation of 90, mapping red shades to purple, and so on. A value of either 0 or 200 results in a complete 180 degree rotation of the image. Using a value of 300 is a 360 degree rotation resulting in no change to the original image</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2011/07/change-huecolor-of-icon-using-image-magick/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Garmin Connect on Linux</title>
		<link>http://notes.brooks.nu/2011/07/garmin-connect-on-linux/</link>
		<comments>http://notes.brooks.nu/2011/07/garmin-connect-on-linux/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 16:42:43 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=252</guid>
		<description><![CDATA[I have been wishing for Garmin to support Linux with their Communicator Plugin for quite some time. In fact, I have even considered writing the firefox plugin to enable Linux support several times, but just haven&#8217;t been able to find the time to do it, plus maintain it, etc. So I have been using Garmin [...]]]></description>
			<content:encoded><![CDATA[<p>I have been wishing for Garmin to support Linux with their Communicator Plugin for quite some time. In fact, I have even considered writing the firefox plugin to enable Linux support several times, but just haven&#8217;t been able to find the time to do it, plus maintain it, etc. So I have been using Garmin Connect in a virtual windows machine. It has been painful, but the other options were even less appealing to me.</p>
<p>Yesterday, however, while looking into adding Garmin Communicator support into <a title="Routometer" href="http://www.routometer.com">Routometer</a>, I did yet another Google search to see if someone else had written a Linux plugin, and what do you know, but YES. Check it out at <a title="Linux Garmin Communicator Plugin" href="http://www.andreas-diesner.de/garminplugin/doku.php?id=start">Linux Garmin Communicator Plugin</a>.</p>
<p>I tested it out. Fortunately it supports my watch, the Forerunner 305. I downloaded the RPMS and they installed without issue. I went to about:plugins with Firefox, and sure enough it was there. I went to Garmin Connect and the first message it gave was browser not supported. I restarted Firefox, and that error went away. The next problem, however, was that it said no devices were detected. I had long ago added &#8216;garmin_gps&#8217; to my modprobe blacklist, and looking at the RPMS it seems to create an blacklist conf file for you. I was not sure the problem, so I looked into Garmin Tools command line programs to see if I could figure it out. Running &#8216;garmin_get_info&#8217; returned nothing. So I unplugged and replugged in my Garmin Forerunner 305. Running &#8216;garmin_get_info&#8217; this time produced a screen full of information. I returned to Garmin Connect and this time it detected my device. I clicked to upload new activities. The watch beeped a couple times and then the progress bar on Garmin Connect froze. So I returned to the command line and tried the &#8216;garmin_save_runs&#8217; command. That downloaded everything just fine. So I reloaded Garmin Connect and tried uploading again. This time it made it through. I did not have any new runs on my watch, however, so it wasn&#8217;t a complete test.</p>
<p>I decided to go on a run just to test it out. I went on a short 4 mile loop. Upon returning I plugged it in and tried uploading. Everything seemed to work. It found the one new run and appeared to upload it. When I clicked the &#8220;Activities&#8221; link, however, to view it, it wasn&#8217;t there. Maybe I didn&#8217;t let it finish uploading. In retrospect I can&#8217;t be sure what I did, but the run was not there. So I tried uploading again. This time, however, it WORKED!!!! Below is my first run uploaded to Garmin Connect using Firefox on Linux. While the first try was not flawless, I could not be happier. Thanks to all those who have worked on it. Now I can add support for uploading hand-drawn courses in Routometer directly to your Garmin.</p>
<p><iframe width='480' height='584' frameborder='0' src='http://connect.garmin.com:80/activity/embed/100728640'></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2011/07/garmin-connect-on-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Arduino Uno on Fedora Linux</title>
		<link>http://notes.brooks.nu/2011/01/arduino-uno-on-fedora-linux/</link>
		<comments>http://notes.brooks.nu/2011/01/arduino-uno-on-fedora-linux/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 17:58:06 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=246</guid>
		<description><![CDATA[Here are some notes on things I did to get Arduino working on Fedora Linux:

Install the Arduino software

sudo yum install arduino


Edit udev rules so that you have permission to talk to the serial port. To do this I added the following line to /uetc/udev/rules.d/60.rules:

KERNEL=="ttyACM*", MODE="0666"



]]></description>
			<content:encoded><![CDATA[<p>Here are some notes on things I did to get Arduino working on Fedora Linux:</p>
<ul>
<li>Install the Arduino software
<pre>
sudo yum install arduino
</pre>
</li>
<li>Edit udev rules so that you have permission to talk to the serial port. To do this I added the following line to <code>/uetc/udev/rules.d/60.rules</code>:
<pre>
KERNEL=="ttyACM*", MODE="0666"
</pre>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2011/01/arduino-uno-on-fedora-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python gstreamer controller</title>
		<link>http://notes.brooks.nu/2011/01/python-gstreamer-controller/</link>
		<comments>http://notes.brooks.nu/2011/01/python-gstreamer-controller/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 20:10:52 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=235</guid>
		<description><![CDATA[I needed a GstController to control the alpha channel on a video crossfade. The gstreamer documentation makes it look easy, but it actually tripped me up for quite some time. I am using the python bindings, and they have some subtlies that took me some time to figure out.
First, I got the general usage out [...]]]></description>
			<content:encoded><![CDATA[<p>I needed a GstController to control the alpha channel on a video crossfade. The gstreamer documentation makes it look easy, but it actually tripped me up for quite some time. I am using the python bindings, and they have some subtlies that took me some time to figure out.</p>
<p>First, I got the general usage out of the Pitivi source code. To create a controller, you do the following:</p>
<pre language="python">
        controller = gst.Controller(alpha, "alpha")
        controller.set_interpolation_mode("alpha", gst.INTERPOLATE_LINEAR)
        controller.set("alpha", 0, 0.0)
        controller.set("alpha", 5*gst.SECOND, 1.0)
</pre>
<p>In the above example, <code>alpha</code> is the element to be controlled. This causes the <code>alpha</code> property on the <code>alpha</code> element to linearly change from 0.0 to 1.0 over the course of 5 seconds.</p>
<p>After adding the above code snippet to my application, however, it did not work. To debug it, I ended up checking out the gstreamer source code and after tracing things through using printf()&#8217;s, I finally discovered that my controller was getting attached to the <code>alpha</code> as I wanted but then it was getting detached almost immediately thereafter. That made me realize that in python I needed to hold a reference to the controller for the duration of the stream. I was letting the <code>controller</code> variable in the above example go out of scope, at which point it had no more references and therefore got deleted and removed from the <code>alpha</code> element. So the solution was to hold a reference to it as shown below in the example of a video crossfade:</p>
<pre language="python">
import os, time
import gobject
import pygst
pygst.require("0.10")
import gst

class Main:
    def __init__(self):
        src1 = gst.element_factory_make("filesrc")
        src2 = gst.element_factory_make("filesrc")

        src1.set_property("location", "/home/lane/test1.mp4")
        src2.set_property("location", "/home/lane/test2.mp4")

        dec1 = gst.element_factory_make("decodebin2")
        dec2 = gst.element_factory_make("decodebin2")

        alpha1 = gst.element_factory_make("alpha")
        alpha2 = gst.element_factory_make("alpha")

        self.controller = gst.Controller(alpha2, "alpha")
        self.controller.set_interpolation_mode("alpha", gst.INTERPOLATE_LINEAR)
        self.controller.set("alpha", 0, 0.0)
        self.controller.set("alpha", 5*gst.SECOND, 1.0)

        mixer = gst.element_factory_make("videomixer")

        queue = gst.element_factory_make("queue")
        color = gst.element_factory_make("ffmpegcolorspace")
        sink  = gst.element_factory_make("autovideosink")

        pipeline = gst.Pipeline("pipeline")
        pipeline.add(src1, src2, dec1, dec2, alpha1, alpha2, mixer, queue, color, sink)

        def on_pad(comp, pad, data, element):
            sinkpad = element.get_compatible_pad(pad, pad.get_caps())
            pad.link(sinkpad)

        dec1.connect("new-decoded-pad", on_pad, alpha1)
        dec2.connect("new-decoded-pad", on_pad, alpha2)
        src1.link(dec1)
        src2.link(dec2)
        alpha1.link(mixer)
        alpha2.link(mixer)
        mixer.link(queue)
        queue.link(color)
        color.link(sink)

        self.pipeline = pipeline

    def start(self):
        self.running = True
        bus = self.pipeline.get_bus()
        bus.add_signal_watch()
        bus.enable_sync_message_emission()
        bus.connect("message", self.on_message)
        self.pipeline.set_state(gst.STATE_PLAYING)

    def on_exit(self, *args):
        self.pipeline.set_state(gst.STATE_NULL)
        self.running = False

    def on_message(self, bus, message):
        t = message.type
	if t == gst.MESSAGE_EOS:
            self.on_exit()
	elif t == gst.MESSAGE_ERROR:
            err, debug = message.parse_error()
	    print "Error: %s" % err, debug
            self.on_exit()

loop = gobject.MainLoop()
gobject.threads_init()
context = loop.get_context()

m = Main()
m.start()

while m.running:
    context.iteration(True)
</pre>
<p>Some things to note in the above code:</p>
<ul>
<li>In order to prevent the <code>controller</code> from going out of scope and getting deleted, I added it as an attribute to the <code>Main</code> object (i.e. <code>self.controller</code>).</li>
<li>I am manually iterating the mainloop. This is so that I do not have to create any gtk stuff. I recently discovered this technique and I use it in command line tools that do not require X11 or a <code>$DISPLAY</code> environment variable set.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2011/01/python-gstreamer-controller/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gstreamer Video Crossfade Example</title>
		<link>http://notes.brooks.nu/2011/01/gstreamer-video-crossfade-example/</link>
		<comments>http://notes.brooks.nu/2011/01/gstreamer-video-crossfade-example/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 18:40:52 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=261</guid>
		<description><![CDATA[It took me an amazingly long amount of time to figure this one out, but here is a simplified python script to perform a video crossfade in gstreamer using the gnonlin package. 


import os, time
import gobject
import pygst
pygst.require("0.10")
import gst

gst.MILLISECOND = gst.SECOND / 1000

def get_crossfade(duration):
    # To crossfade, we add an alpha channel to [...]]]></description>
			<content:encoded><![CDATA[<p>It took me an amazingly long amount of time to figure this one out, but here is a simplified python script to perform a video crossfade in gstreamer using the gnonlin package. </p>
<pre language="python">

import os, time
import gobject
import pygst
pygst.require("0.10")
import gst

gst.MILLISECOND = gst.SECOND / 1000

def get_crossfade(duration):
    # To crossfade, we add an alpha channel to both streams. Then a video
    # mixer mixes them according to the alpha channel. We put a control
    # on the alpha channel to linearly sweep it over the duration of the
    # crossfade. The returned bin should get placed in a gnloperation.
    # The reason to put the alpha and final ffmpegcolorspace conversion
    # in this bin is that are only applied during the crossfade and not
    # all the time (saves some processing time).
    bin = gst.Bin()
    alpha1 = gst.element_factory_make("alpha")
    alpha2 = gst.element_factory_make("alpha")
    mixer  = gst.element_factory_make("videomixer")
    color  = gst.element_factory_make("ffmpegcolorspace")

    bin.add(alpha1, alpha2, mixer, color)
    alpha1.link(mixer)
    alpha2.link(mixer)
    mixer.link(color)

    controller = gst.Controller(alpha2, "alpha")
    controller.set_interpolation_mode("alpha", gst.INTERPOLATE_LINEAR)
    controller.set("alpha", 0, 0.0)
    controller.set("alpha", duration * gst.MILLISECOND, 1.0)

    bin.add_pad(gst.GhostPad("sink1", alpha1.get_pad("sink")))
    bin.add_pad(gst.GhostPad("sink2", alpha2.get_pad("sink")))
    bin.add_pad(gst.GhostPad("src",   color.get_pad("src")))

    return bin, controller # return the controller otherwise it will go out of scope and get deleted before it is even applied

class Main:
    def __init__(self):
        dur1 = 5000 # duration (in ms) to play of first clip
        dur2 = 5000 # duration (in ms) to play of second clip
        dur_crossfade = 500 # number of milliseconds to crossfade for

        # we play two clips serially with a crossfade between them
        # using the gnonlin gnlcomposition element.
        comp = gst.element_factory_make("gnlcomposition")

        # setup first clip
        src1 = gst.element_factory_make("gnlfilesource")
        comp.add(src1)
        src1.set_property("location", "/home/lane/work/sshow/src/test1.mp4")
        src1.set_property("start",          0    * gst.MILLISECOND)
        src1.set_property("duration",       dur1 * gst.MILLISECOND)
        src1.set_property("media-start",    0    * gst.MILLISECOND)
        src1.set_property("media-duration", dur1 * gst.MILLISECOND)
        src1.set_property("priority",       1)

        # setup second clip
        src2 = gst.element_factory_make("gnlfilesource")
        comp.add(src2)
        src2.set_property("location", "/home/lane/work/sshow/src/test2.mp4")
        src2.set_property("start",  (dur1-dur_crossfade) * gst.MILLISECOND)
        src2.set_property("duration",       dur2 * gst.MILLISECOND)
        src2.set_property("media-start",    0    * gst.MILLISECOND)
        src2.set_property("media-duration", dur2 * gst.MILLISECOND)
        src2.set_property("priority",       2)

        # setup the crossfade
        op = gst.element_factory_make("gnloperation")
        fade, self.controller = get_crossfade(dur_crossfade)
        op.add(fade)
        op.set_property("start",   (dur1-dur_crossfade) * gst.MILLISECOND)
        op.set_property("duration",       dur_crossfade * gst.MILLISECOND)
        op.set_property("media-start",    0             * gst.MILLISECOND)
        op.set_property("media-duration", dur_crossfade * gst.MILLISECOND)
        op.set_property("priority",       0)
        comp.add(op)

        # setup the backend viewer
        queue = gst.element_factory_make("queue")
        sink  = gst.element_factory_make("autovideosink")

        pipeline = gst.Pipeline("pipeline")
        pipeline.add(comp, queue, sink)

        def on_pad(comp, pad, element):
            sinkpad = element.get_compatible_pad(pad, pad.get_caps())
            pad.link(sinkpad)

        comp.connect("pad-added", on_pad, queue)
        queue.link(sink)

        self.pipeline = pipeline

    def start(self):
        self.running = True
        bus = self.pipeline.get_bus()
        bus.add_signal_watch()
        bus.enable_sync_message_emission()
        bus.connect("message", self.on_message)
        self.pipeline.set_state(gst.STATE_PLAYING)

    def on_exit(self, *args):
        self.pipeline.set_state(gst.STATE_NULL)
        self.running = False

    def on_message(self, bus, message):
        t = message.type
	if t == gst.MESSAGE_EOS:
            self.pipeline.set_state(gst.STATE_NULL)
            self.on_exit()
	elif t == gst.MESSAGE_ERROR:
            err, debug = message.parse_error()
	    print "Error: %s" % err, debug
            self.on_exit()

loop = gobject.MainLoop()
gobject.threads_init()
context = loop.get_context()

m = Main()
m.start()

while m.running:
    context.iteration(True)
</pre>
<p>I struggled to get the smpte transitions working using the <code>smpte</code> plugin element and never got it. Using the <code>smptealpha</code> plugin element, however, I was able to get transitions working using the same approach as the crossfade example above. All I had to do was create a new function:</p>
<pre languagne="python">

def get_smpte(duration, transition=1):
    # To crossfade, we add an alpha channel to both streams. Then a video
    # mixer mixes them according to the alpha channel. We put a control
    # on the alpha channel to linearly sweep it over the duration of the
    # crossfade. The returned bin should get placed in a gnloperation.
    # The reason to put the alpha and final ffmpegcolorspace conversion
    # in this bin is that are only applied during the crossfade and not
    # all the time (saves some processing time).
    bin = gst.Bin()
    alpha1 = gst.element_factory_make("alpha")
    smpte  = gst.element_factory_make("smptealpha")
    mixer  = gst.element_factory_make("videomixer")
    color  = gst.element_factory_make("ffmpegcolorspace")

    bin.add(alpha1, smpte, mixer, color)
    alpha1.link(mixer)
    smpte.link(mixer)
    mixer.link(color)

    smpte.set_property("type", transition)

    controller = gst.Controller(smpte, "position")
    controller.set_interpolation_mode("position", gst.INTERPOLATE_LINEAR)
    controller.set("position", 0, 1.0)
    controller.set("position", duration * gst.MILLISECOND, 0.0)

    bin.add_pad(gst.GhostPad("sink1", alpha1.get_pad("sink")))
    bin.add_pad(gst.GhostPad("sink2", smpte.get_pad("sink")))
    bin.add_pad(gst.GhostPad("src",   color.get_pad("src")))

    return bin, controller
</pre>
<p>Now I can call this function <code>get_smpte()</code> place of the <code>get_crossfade()</code> function and get an smpte transition instead. Works great so far.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2011/01/gstreamer-video-crossfade-example/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu BeagleBoard xM</title>
		<link>http://notes.brooks.nu/2010/12/ubuntu-beagleboard-xm/</link>
		<comments>http://notes.brooks.nu/2010/12/ubuntu-beagleboard-xm/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 20:42:26 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=214</guid>
		<description><![CDATA[Here is nice summary of package manage commands at Ubuntu for Fedora Users.
Install Ubuntu according to BeagleBoardUbuntu.
For network, edit /etc/network/interfaces to include

auto usb1
iface usb1 inet dhcp

Then restart networking. Then run 

apt-get update

For X

apt-get install xfce4 gdm xubuntu-gdm-theme xubuntu-artwork xserver-xorg-video-omap3

To run 

apt-get install python-gst0.10 gstreamer0.10 gstreamer0.10-plugins-good

For development:

apt-get install gcc libxext-dev libtool autoconf automake pkg-config python-dev libgstreamer0.10-dev [...]]]></description>
			<content:encoded><![CDATA[<p>Here is nice summary of package manage commands <a href="https://help.ubuntu.com/community/SwitchingToUbuntu/FromLinux/%20RedHatEnterpriseLinuxAndFedora">at Ubuntu for Fedora Users</a>.</p>
<p>Install Ubuntu according to <a href="http://www.elinux.org/BeagleBoardUbuntu">BeagleBoardUbuntu</a>.</p>
<p>For network, edit <code>/etc/network/interfaces</code> to include</p>
<pre>
auto usb1
iface usb1 inet dhcp
</pre>
<p>Then restart networking. Then run </p>
<pre>
apt-get update
</pre>
<p>For X</p>
<pre>
apt-get install xfce4 gdm xubuntu-gdm-theme xubuntu-artwork xserver-xorg-video-omap3
</pre>
<p>To run </p>
<pre>
apt-get install python-gst0.10 gstreamer0.10 gstreamer0.10-plugins-good
</pre>
<p>For development:</p>
<pre>
apt-get install gcc libxext-dev libtool autoconf automake pkg-config python-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev git libgdk-pixbuf2.0-dev libpng-dev
</pre>
<p>For extra:</p>
<pre>
apt-get install rsync emacs openssh-client midori apt-file
</pre>
<h3>Autologin</h3>
<p>Create a file called <code>/etc/gdm/custom.conf</code></p>
<pre>
[daemon]
AutomaticLoginEnable=true
AutomaticLogin=YourUserName
TimedLoginDelay=0
</pre>
<h3>Display</h3>
<p>Links:</p>
<ul>
<li><a href="http://www.mjmwired.net/kernel/Documentation/arm/OMAP/DSS">http://www.mjmwired.net/kernel/Documentation/arm/OMAP/DSS</a></li>
<li><a href="http://www.omappedia.com/wiki/Bootargs_for_enabling_display">http://www.omappedia.com/wiki/Bootargs_for_enabling_display</a>
</ul>
<p>For display, you edit the <code>boot.cmd</code> file in the uboot directory on the boot partition. The dvi_mode variable syntax is (taken from <code>drivers/video/modedb.c</code>):</p>
<blockquote><pre>
	Valid mode specifiers for @mode_option:
 *
 *	<xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] or
 *	<name>[-<bpp>][@<refresh>]
 *
 *	with <xres>, <yres>, <bpp> and <refresh> decimal numbers and
 *	<name> a string.
 *
 *      If 'M' is present after yres (and before refresh/bpp if present),
 *      the function will compute the timings using VESA(tm) Coordinated
 *      Video Timings (CVT).  If 'R' is present after 'M', will compute with
 *      reduced blanking (for flatpanels).  If 'i' is present, compute
 *      interlaced mode.  If 'm' is present, add margins equal to 1.8%
 *      of xres rounded down to 8 pixels, and 1.8% of yres. The char
 *      'i' and 'm' must be after 'M' and 'R'. Example:
 *
 *      1024x768MR-8@60m - Reduced blank with margins at 60Hz.
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2010/12/ubuntu-beagleboard-xm/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python DPMS</title>
		<link>http://notes.brooks.nu/2010/12/206/</link>
		<comments>http://notes.brooks.nu/2010/12/206/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 15:54:08 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=206</guid>
		<description><![CDATA[There have been several occasions where I have needed to control the power state of my monitor (LCD or CRT) programatically. One time was for a custom LCD digital picture frame that I made. I wanted to turn off the LCD after a certain timeout period and turn it back on whenever a motion sensor [...]]]></description>
			<content:encoded><![CDATA[<p>There have been several occasions where I have needed to control the power state of my monitor (LCD or CRT) programatically. One time was for a custom LCD digital picture frame that I made. I wanted to turn off the LCD after a certain timeout period and turn it back on whenever a motion sensor produced an event. For that project I used the &#8220;xset&#8221; command line program and used a command like:</p>
<pre>
xset dpms force &lt;on|off&gt;
</pre>
<p>to turn it on and off. That worked, but this time around I wanted to do it programmatically rather than dropping to a system shell. I downloaded the source code for xset and found they were interfacing to the DPMS X11 extension. So I downloaded the source to libXext and found the DPMS API. It is a simple API, so I created some Python bindings to it and have published the results over at github. You can checkout the <a href="https://github.com/dirjud/python-dpms"</a>python-dpms project page</a> over at github or <a href="https://github.com/dirjud/python-dpms/tarball/master">download the source tarball</a> and build it.</p>
<p>It is simple to turn on and off the monitor from python now:</p>
<pre>
import dpms, time
d=dpms.DPMS()
time.sleep(1) # this is necessary to prevent your last key press that launches this from waking the monitor right back up
d.ForceLevel(dpms.DPMSModeOff) # turn monitor off
d.Info()
#d.ForceLevel(dpms.DPMSModeOn) # turn it on
</pre>
<p>You will need to save this to a file and run it non-interactively because the interactive shell will cause it to wake up instantly. When you run it non-interactively, it will turn off your monitor and then you can press any key to wake it back up.</p>
<p>Here is the README file from the project:</p>
<pre>

ABOUT
=====

This is python bindings to the DPMS X11 extension module for controlling
your monitor power savings state.

The DPMS interface lets you control the power level of your monitor
(On, Standby, Suspend, or Off).  It is a simple interface that lets
you get/set timeouts of inactivity to enter these states or you can
force it to enter any of the states.

See example.py on how to use it. This file should be sufficient on how
to use it. It first shows how to query all the different settings and
then shows how to set them.

See also 'man xset' for a program that lets you modify the DPMS state
from the command line.

INSTALL
=======

Install libXext and python development packages installed. For
example, on RedHat/Fedora:

    yum install libXext-devel python-devel

On Ubuntu:

    apt-get install libxext6-dev python-dev

Then run:

    python setup.py build

Then as root, run:

    python setup.py install

That's it. Now run:

    python example.py

to test it out.
</pre>
<p>The included example.py shows how easy it is to use:</p>
<pre>
import dpms

d = dpms.DPMS() # to use the current display, or alternatively DPMS(":1")

# print up the display
print "Display         :", d.display()

# query extension, should return True as the first element
print "Query Extension :", d.QueryExtension()

# query Capable, not sure what it does
print "Capable         :", d.Capable() 

# query current version
print "Version         :", d.GetVersion()

# query the current state of things
(level, enabled) = d.Info()

print "DPMS enabled    :", enabled
if(level == dpms.DPMSModeOn):
    current_level = "On"
elif(level == dpms.DPMSModeStandby):
    current_level = "Standby"
elif(level == dpms.DPMSModeSuspend):
    current_level = "Suspend"
elif(level == dpms.DPMSModeOff):
    current_level = "Off"
else:
    current_level = "Unknown (%d)" % level

print "Current Level   :", current_level, "(", level, ")"

# query the current timeout settings
(standby, suspend, off) = d.GetTimeouts()
print "Timeouts"
print "  Standby       :", standby
print "  Suspend       :", suspend
print "  Off           :", off

# We have queried everything, now we will set everything back to its
# current state. We set back to the current state so as not to alter
# any state and so that you can see examples of setting state.

# set the timeout settings
d.SetTimeouts(standby, suspend, off)

# enable/disable DPMS
if(enabled):
    d.Enable()
else:
    d.Disable()

# force DPMS to a certain level
d.ForceLevel(level)

# if you wanted to force the monitor off, you could
#d.ForceLevel(dpms.DPMSModeOff)

# to force it back on
#d.ForceLevel(dpms.DPMSModeOn)

# You can also suspend or standby
#d.ForceLevel(dpms.DPMSModeSuspend)
#d.ForceLevel(dpms.DPMSModeStandby)
</pre>
<p>If you run <code>python example.py</code>, you will see output like:</p>
<pre>
Display         : :0.0
Query Extension : (True, 0, 0)
Capable         : True
Version         : (1, 1)
DPMS enabled    : True
Current Level   : On ( 0 )
Timeouts
  Standby       : 0
  Suspend       : 0
  Off           : 0
</pre>
<p>So just like that I can now turn on and off the monitor from my python programs. If you are not using python but C/C++, the <code>/usr/include/X11/extensions/dpms.h</code> shows how simple the API is, so don&#8217;t be afraid to use it.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2010/12/206/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Chronovu USB LA-8 Logic Analyzer</title>
		<link>http://notes.brooks.nu/2010/08/chronovu-usb-logic-analyzer/</link>
		<comments>http://notes.brooks.nu/2010/08/chronovu-usb-logic-analyzer/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 17:55:03 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[Circuits]]></category>

		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=174</guid>
		<description><![CDATA[I am a fan of reducing cost and complexity of test equipment by pushing the UI to the PC to make the test equipment headless. In this vein, however, I was previously disappointed in the purchase an ELAN USB oscilloscope. It claimed Linux support, but after much hoop jumping, I never got their java app working on [...]]]></description>
			<content:encoded><![CDATA[<p>I am a fan of reducing cost and complexity of test equipment by pushing the UI to the PC to make the test equipment headless. In this vein, however, I was previously disappointed in the purchase an ELAN USB oscilloscope. It claimed Linux support, but after much hoop jumping, I never got their java app working on linux. I ended up running it in a virtual machine running windows, and even then the experience was not great. That is story for another post, though. For this post I am going to provide my initial feedback on the <a href="http://www.chronovu.com">ChronoVu USB Logic Analyzer LA-8</a> that I purchased on Ebay for $189.00.</p>
<p>The primary reasons I picked the ChronoVu amongst the other several options (see Comments at this <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8938">link from SparkFun.com</a> for additional competitive products</a>) was that it sampled at 100MHz and the app ran on Linux without java. I downloaded the app prior to purchasing to give it a test run and noticed that it used QT for widgets, so I was happy that the performance had a chance at being adequate on Linux. </p>
<p>Amazingly, the setup on Linux (or at least Fedora 13) was quite seemless. I am used to futzing with everything from udev rules to 64b/32b issues to compiling kernel modules to etc. when using these sort of fringe products that claim Linux support, but everything worked out of the box on my Fedora 13 Linux install. The <code>lsusb</code> output is shown at the end of this post for those interested. It basically enumerates as a serial device and on my Fedora 13 machine, it appears on device node &#8216;/dev/ttyUSBX&#8217; with correct permissions so that I can use it without root access (in other words, udev rules exist and work without issue). The application seems to detect and find the correct ttyUSB devnode to use, so I am not sure how it would behave with multiple units plugged in, but I do have other usb-serial devs on ttyUSB nodes and it has never been confused or had issues with that. That was a refreshing experience that shows they are serious about linux and not just releasing crippled linux support for marketing reasons.</p>
<p>My initial experience was to debug an I2C problem I was having. I flipped into a precanned I2C setup on the application, hooked up my probes, and pressed play. It asked for a file to save the data to (which I now find a bit annoying). It then downloaded and processed the data. That takes more time than I would like, but the precanned I2C bus analysis worked well and performed a deserialization of the data correctly. All that worked without any issue. Kudos to ChronoVu. It was a better experience than I was expecting based on my previous experience with a piece of USB test equipment.</p>
<p>While the initial experience was positive, after using it, there are several user interface issues that still keep this device in a class below dedicated logic analyzers. The sad thing is that these are primarily software issues. I hope ChronoVu takes notice because if these are addressed, then it will be a happy day for me when I can replace a many tens of thousand dollar machine that is the size of a desktop PC and requires its own cart with a sub $200 pocket sized piece of equipment. They have already taken a major step to that end, but it is not quite there (yet).</p>
<h3>User Interface Issues</h3>
<ul>
<li>You cannot setup triggering options beyond the simple state==0 or state==1. This makes it hard to sync to events of interest. This is my biggest complaint. Makes it hard to do more than just simple debugging.</li>
<li>The zoom level resets after every acquisition. Quite a pain given that events of interest can take a while to find again. This issue is also related to the lack of complex triggering options given that even if the view didn&#8217;t reset, I will still have to scroll around to find my event.</li>
<li>The UI is sluggish to zoom and pan. This is annoying and further exacerbates the view reseting issue previously mentioned. This is my second biggest complaint.</li>
<li>You cannot zoom in indefinitely, and even worse, you cannot zoom in adequately to see even 25ns clocks. This is quite annoying. I sampled a 25MHz clock at 100MHz and would like to see the clock up close. I realize that there will be some frequency beating between the 25MHz clock and 100MHz sampling rate, and I can live with that, but I still want to be able to zoom in and put some cursors down at the clock transition edges and make sure my clock is running as I expect. Instead I can only zoom in close enough to see a very high frequency signal, but nothing sufficient for what I want.</li>
<li>It asks to save a file everytime you press play to capture some data. 90% of the time I am taking setup data and I want it as quickly as possible. For the 10% of the time I take data I care about (after I have it setup and framed the way I want), then it would be nice to click a &#8220;Save As&#8221; button and save the raw data somewhere. Otherwise, I would prefer it save to a temp file that I don&#8217;t have to manage or know about. I would rather click to save the data permanently after I know the data is what I want. Don&#8217;t bother me a priori with a popup box.</li>
<li>Download and process time take too long. I count around 12 Mississippi’s (seconds). This is not a show a stopper, but annoying. They must not be using USB 2.0 high speed. I am not familiar with the Future Technologies USB-Serial chip they are using, but they would be well served by going with a chipset that supported high speed option as this would make it around 10 times faster and much more bearable.</li>
<li>This one is a nit-pick, but the application installer creates a new root menu in the GNOME &#8220;Applications&#8221; menu list. Perhaps it should install in the FEL &#8220;Electronics&#8221; menu or &#8220;Other&#8221;.</li>
<li>I don&#8217;t need a CD or a carrying case and would prefer not to pay for them.
</ul>
<h3>Hardware Issues</h3>
<li>There is crosstalk issue. I plugged in a low frequency signals into channel 0 (FV) and channel 1 (LV) and a 50MHz clock into channel 2 (CLK).  The clock beats as expected against the 100MHz sampling rate, but it corrupts channel 0 and channel 1 as you can see in this screen shot.<br />
<a href="http://notes.brooks.nu/wp-content/uploads/screenshot-chronovu.png"><img src="http://notes.brooks.nu/wp-content/uploads/screenshot-chronovu-600x218.png" alt="" title="screenshot-chronovu" width="600" height="218" class="alignnone size-medium wp-image-177" /></a><br />
Disconnecting channel 2 probe from the clock and connecting it to ground solves the problem. The following is screen shot shows what channel 0 and channel 1 should look like in the previous capture.<br />
<a href="http://notes.brooks.nu/wp-content/uploads/screenshot-chronovu-11.png"><img src="http://notes.brooks.nu/wp-content/uploads/screenshot-chronovu-11-600x218.png" alt="" title="screenshot-chronovu-11" width="600" height="218" class="alignnone size-medium wp-image-180" /></a></li>
<p>If I had to guess, there is a significant inductance on the ground connection between the units and the ground bounce induced by the high frequency clock is causing this problem. It is hard to blame this one on them without some more futzing, so for now, I will only hook up to the clock when I slow everything down to debug.
</ul>
<h3>lsusb -v -s 001:080 output</h3>
<pre>
Bus 001 Device 080: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x0403 Future Technology Devices International, Ltd
  idProduct          0x6001 FT232 USB-Serial (UART) IC
  bcdDevice            6.00
  iManufacturer           1 ChronoVu
  iProduct                2 ChronoVu LA8
  iSerial                 3 CV100528120813
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 ChronoVu LA8
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2010/08/chronovu-usb-logic-analyzer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>X Forwarding Problem with ssh</title>
		<link>http://notes.brooks.nu/2010/06/x-forwarding-problem-with-ssh/</link>
		<comments>http://notes.brooks.nu/2010/06/x-forwarding-problem-with-ssh/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 15:38:54 +0000</pubDate>
		<dc:creator>lane</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://notes.brooks.nu/?p=172</guid>
		<description><![CDATA[Recently I ssh&#8217;d into one of my servers using the command &#8217;ssh -X hostname&#8217; from the client. I then tried to launch an X11 application but received the error:

Gtk-WARNING **: cannot open display:

I then found the DISPLAY environment variable was blank. A little searching around and I found that the I needed the xauth program [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I ssh&#8217;d into one of my servers using the command &#8217;ssh -X hostname&#8217; from the client. I then tried to launch an X11 application but received the error:</p>
<pre>
Gtk-WARNING **: cannot open display:
</pre>
<p>I then found the <code>DISPLAY</code> environment variable was blank. A little searching around and I found that the I needed the <code>xauth</code> program installed. A
<pre>yum install xorg-x11-xauth</pre>
<p> on the server did the trick. Now when I ssh in using the -X option, X11 applications run fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.brooks.nu/2010/06/x-forwarding-problem-with-ssh/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

