<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-346563396520232414</id><updated>2011-12-09T15:07:25.994-05:00</updated><category term='openwrt'/><category term='linux'/><category term='webcam'/><category term='sca'/><category term='microcontroller'/><category term='casting'/><category term='quickcam'/><category term='electronics'/><title type='text'>Bill Farrow</title><subtitle type='html'>You know when you discover something useful or cool, and you say: I should write that down and tell other people about it.  Well that is what I thought I would do here.

Topics will include Linux, embedded devices, software, electronics, DIY hacks, etc.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://billfarrow.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://billfarrow.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Bill Farrow</name><uri>http://www.blogger.com/profile/00984136630446825155</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrwm6faYAI/AAAAAAAAATg/3eWsPYI5uWc/S220/bill-side-head-2008.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-346563396520232414.post-2122201264262766305</id><published>2010-12-27T12:42:00.000-05:00</published><updated>2010-12-27T12:42:33.089-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Chumby upgrade problems</title><content type='html'>My Chumby One hasn't automatically upgraded it software since I bought it earlier this year.&amp;nbsp; So I downloaded the latest firmware file onto a USB stick and did a manual upgrade.&lt;br /&gt;&lt;br /&gt;After upgrading to "chumby one version 1.0.7 and control panel version 2.8.73" (from fw 1.0.3) via USB stick, the "My Streams" function would not produce any audio output when playing an mp3 stream URL.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Rebooting the Chumby did not help.&lt;/li&gt;&lt;li&gt;The volume knob moved the on screen volume slider.&lt;/li&gt;&lt;li&gt;The sound worked for the FM Radio function.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;So the last resort was to log in via SSH and look around.&amp;nbsp; I was finally able to get btplay working via ssh:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;killall btplayd; btplay --start-daemon --output=alsa:plug:dmixer http://202.6.74.107:8060/triplej.mp3&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After running the above command once on my Chumby, it now plays My Streams properly, even after a rebooting.&amp;nbsp; All fixed.&lt;br /&gt;&lt;br /&gt;My other complaint was that I had to re-enter all my mp3 streaming URLs, and all of my custom Alarms via the touchscreen.&amp;nbsp; Shouldn't these settings be carried forward during the upgrade ?&lt;br /&gt;&lt;br /&gt;It's fun to see how other Embedded Linux devices are setup and managed - I am always looking to improve my professional work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/346563396520232414-2122201264262766305?l=billfarrow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billfarrow.blogspot.com/feeds/2122201264262766305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://billfarrow.blogspot.com/2010/12/chumby-upgrade-problems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/2122201264262766305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/2122201264262766305'/><link rel='alternate' type='text/html' href='http://billfarrow.blogspot.com/2010/12/chumby-upgrade-problems.html' title='Chumby upgrade problems'/><author><name>Bill Farrow</name><uri>http://www.blogger.com/profile/00984136630446825155</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrwm6faYAI/AAAAAAAAATg/3eWsPYI5uWc/S220/bill-side-head-2008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-346563396520232414.post-5575453929979607120</id><published>2010-09-06T12:04:00.000-04:00</published><updated>2010-09-06T12:04:18.199-04:00</updated><title type='text'>Userspace access to PCI memory</title><content type='html'>&lt;h2&gt;Intro&lt;/h2&gt;When I start working on a new PCI device driver I generally go through a discovery phase of reading and writing to certain regsiters on the PCI card. Over the years I have written lots of small kernel modules to probe addresses within the PCI memory space, constantly iterating: modify code, recompile, scp to target, load module, unload module, dmesg.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Urk! There has to be a better way - sysfs and mmap() to the rescue.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Sysfs&lt;/h2&gt;Let's start at with the PCI files under sysfs:&lt;br /&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;bash# ls -l /sys/devices/pci0001\:00/0001\:00\:07.0/&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;total 0&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-rw-r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 broken_parity_status&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;lrwxrwxrwx 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 Jul&amp;nbsp; 2 20:13 bus -&amp;gt; ../../../bus/pci&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 class&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-rw-r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 256 Jul&amp;nbsp; 2 20:13 config&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 device&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 devspec&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-rw------- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 enable&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 irq&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 local_cpus&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 modalias&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-rw-r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 msi_bus&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 resource&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-rw------- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 resource0&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-rw------- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp; 65536 Jul&amp;nbsp; 2 20:13 resource1&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-rw------- 1 root root 16777216 Jul&amp;nbsp; 2 20:13 resource2&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;lrwxrwxrwx 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 Jul&amp;nbsp; 2 20:13 subsystem -&amp;gt; ../../../bus/pci&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 subsystem_device&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 subsystem_vendor&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-rw-r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 uevent&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;-r--r--r-- 1 root root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4096 Jul&amp;nbsp; 2 20:13 vendor&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;The vendor and device files report the PCI vendor ID and device ID:&lt;br /&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;bash# cat device&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;0x0001&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;This info is also available from lspci&lt;br /&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;bash# lspci -v&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;0001:00:07.0 Class 0680: Unknown device bec0:0001 (rev 01)&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Flags: bus master, 66MHz, medium devsel, latency 128, IRQ 31&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Memory at 8d010000 (32-bit, non-prefetchable) [size=4K]&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Memory at 8d000000 (32-bit, non-prefetchable) [size=64K]&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Memory at 8c000000 (32-bit, non-prefetchable) [size=16M]&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;This PCI card makes 3 separate regions of memory available to the host computer. The sysfs resource0 file corresponds to the first memory region. The PCI card lets the host computer know about these memory regions using the BAR registers in the PCI config.&lt;br /&gt;&lt;h2&gt;mmap()&lt;/h2&gt;These sysfs resource can be used with mmap() to map the PCI memory into a userspace applications memory space. The application then has a pointer to the start of the PCI memory region and can read and write values directly. (There is a bit more going on here with respect to memory pointers, but that is all taken care of by the kernel).&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;fd = open("&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;/sys/devices/pci0001\:00/0001\:00\:07.0/&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;resource0", O_RDWR | O_SYNC);&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;ptr = mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;printf("PCI BAR0 0x0000 = 0x%4x\n",&amp;nbsp; *((unsigned short *) ptr);&lt;/span&gt;&lt;/div&gt;&lt;h2&gt;Utils&lt;/h2&gt;&lt;span style="font-size: small; font-weight: normal;"&gt;The utility application "pcimem" reads and writes single values within the PCI memory space.&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;bash# ./pcimem /sys/devices/pci0001\:00/0001\:00\:07.0/resource0  0 w&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;/sys/devices/pci0001:00/0001:00:07.0/resource0 opened.&lt;br /&gt;Target offset is 0x0, page size is 4096&lt;br /&gt;mmap(0, 4096, 0x3, 0x1, 3, 0x0)&lt;br /&gt;PCI Memory mapped to address 0x4801f000.&lt;br /&gt;Value at offset 0x0 (0x4801f000): 0xC0BE0100&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Download the source: &lt;a href="http://github.com/billfarrow/pcimem"&gt;&lt;span style="font-size: small; font-weight: normal;"&gt;http://github.com/billfarrow/pcimem&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;h2&gt;PowerPC&lt;/h2&gt;To make this work on a PowerPC architecture you also need to make a small&lt;br /&gt;change to the pci core.  My example is from kernel 2.6.34, and hopefully this will be fixed for us in a later kernel version.&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;bash# vi arch/powerpc/kernel/pci-common.c&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* If memory, add on the PCI bridge address offset */&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (mmap_state == pci_mmap_mem) {&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;-#if 0 /* See comment in pci_resource_to_user() for why this is disabled */&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;+#if 1 /* See comment in pci_resource_to_user() for why this is disabled */&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; *offset += hose-&amp;gt;pci_mem_offset;&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&amp;nbsp;#endif&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; res_bit = IORESOURCE_MEM;&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: white; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: xx-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* We pass a fully fixed up address to userland for MMIO instead of&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * a BAR value because X is lame and expects to be able to use that&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * to pass to /dev/mem !&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * That means that we'll have potentially 64 bits values where some&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * userland apps only expect 32 (like X itself since it thinks only&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Sparc has 64 bits MMIO) but if we don't do that, we break it on&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * 32 bits CHRPs :-(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Hopefully, the sysfs insterface is immune to that gunk. Once X&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * has been fixed (and the fix spread enough), we can re-enable the&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * 2 lines below and pass down a BAR value to userland. In that case&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * we'll also have to re-enable the matching code in&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * __pci_mmap_make_offset().&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * BenH.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;br /&gt;-#if 0&lt;br /&gt;+#if 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (rsrc-&amp;gt;flags &amp;amp; IORESOURCE_MEM)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; offset = hose-&amp;gt;pci_mem_offset;&lt;br /&gt;#endif&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/346563396520232414-5575453929979607120?l=billfarrow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billfarrow.blogspot.com/feeds/5575453929979607120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://billfarrow.blogspot.com/2010/09/userspace-access-to-pci-memory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/5575453929979607120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/5575453929979607120'/><link rel='alternate' type='text/html' href='http://billfarrow.blogspot.com/2010/09/userspace-access-to-pci-memory.html' title='Userspace access to PCI memory'/><author><name>Bill Farrow</name><uri>http://www.blogger.com/profile/00984136630446825155</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrwm6faYAI/AAAAAAAAATg/3eWsPYI5uWc/S220/bill-side-head-2008.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-346563396520232414.post-7648081120581585913</id><published>2010-05-29T21:59:00.000-04:00</published><updated>2010-05-29T21:59:48.060-04:00</updated><title type='text'>Macbook OS X disk recovery</title><content type='html'>This is another story of why we should all do automated backups...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Problem&lt;/b&gt;:&lt;br /&gt;Kelly's Macbook stopped booting.&amp;nbsp; It would show the Apple Logo and a progress bar, and then just switch itself off.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Diagnosis:&lt;/b&gt;&lt;br /&gt;To show boot sequence details; hold down the "Command" and "V" keys when powering on.&amp;nbsp; This is called the Verbose Boot Mode, and it might show you what is going wrong.&amp;nbsp; In my case the boot sequence was failing at the filesystem check:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;** The volume Macintosh HD could not be repaired.&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Raw Disk Backup:&lt;/b&gt;&lt;br /&gt;Before risking further damage and loss of data, I make a backup of the entire drive.&amp;nbsp; Many failures like this are caused by a failing hard disk with bad sectors. Normal copying programs fail when they hit a back sector, so I use the GNU &lt;a href="http://www.gnu.org/software/ddrescue/ddrescue.html"&gt;ddrescue&lt;/a&gt; tool.&amp;nbsp; This makes a low level raw copy of the disk, and attempts to recover as much data as possible from dying disks.&lt;br /&gt;&lt;br /&gt;The ddrescue tool is available for on most Linux distributions. I used an &lt;a href="http://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt; computer with the Macbook hard drive attached via a SATA cable for maximum speed.&amp;nbsp; You will need to work out which disk is the macbook drive, and then run:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;mount /dev/sdb1 /mnt&lt;br /&gt;ddrescue /dev/sda /mnt/macbook-ddrescue.img /mnt/macbook-ddrescue.log&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If ddrescue fails to fully recover all of the data from the disk due to back sectors, you can run it again to make further attempts.&amp;nbsp; Don't worry, it uses the log file to only repeat reading the parts that it couldn't copy the first time.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;File Backup:&lt;/b&gt;&lt;br /&gt;Now that I have a full raw disk image, I am less concerned about doing something wrong and loosing data.&amp;nbsp; Putting the hard drive back into the macbook and booting into Single User mode, I was able to mount the broken filesystem in read-only mode and copy the files to another backup drive over USB.&amp;nbsp; This backup drive was previously formatted with HFS+, and could be mounted in Single User Mode.&lt;br /&gt;&lt;br /&gt;Insert the Snow Leopard Install DVD and boot it by holding "C" down  while powering on.&lt;br /&gt;&lt;br /&gt;Eventually the Snow Leopard install  screen will be displayed.&amp;nbsp; Don't follow the usual install process, but  select Terminal from the Utilities menu.&amp;nbsp; From the terminal we can  hopefully mount the broken drive and backup the files.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;mkdir  /Volumes/internal&lt;br /&gt;mount -o rdonly /dev/disk0s2 /Volumes/internal&lt;br /&gt;&lt;br /&gt;mkdir  /Volumes/backup&lt;br /&gt;mount /dev/disk9s2 /Volumes/backup&lt;br /&gt;&lt;br /&gt;ditto  -v -V /Volumes/internal /Volumes/backup/.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;First Attempted fix:&lt;/b&gt;&lt;br /&gt;Boot into Single User mode by holding down the "Command" and "S" keys while&amp;nbsp; powering on, and run the filesystem check by hand.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;fsck -fy /dev/disk0s2 &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If this doesn't work, try running this command to rebuild the B-Tree catalog:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;fsck_hfs -r  /dev/disk0s2&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Some people reported that they had to run this up to three times to finally fix their filesystem. In my case this didn't help.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Manufacturers Disk Diagnostic Tools&lt;/b&gt;&lt;br /&gt;Most hard drive manufactures provide free tools to check and diagnose their disks for low level hardware errors.&amp;nbsp; They do this to help minimize people RMA'ing perfectly good disks due to software problems.&lt;br /&gt;&lt;br /&gt;The Seagate tools are available as a DOS bootable CDROM image.&amp;nbsp; Run the short test first, and then the extended tests.&amp;nbsp; These tests can take several hours, so be patient.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Re-Installing Snow Leopard&lt;/b&gt;&lt;br /&gt;Now that I have the two separate backups, I felt more confidant about erasing the Macbook drive and re-installing Snow Leopard from scratch.&lt;br /&gt;&lt;br /&gt;Insert the OS X installation DVD and hold down the "C" key to boot from the DVD drive.&lt;br /&gt;&lt;br /&gt;The installation process will present you with an option to restore from a backup or migrate data from another machine. I was able to plug in the USB backup drive and restore all of the user data and applications. This was the easy part - thankyou Apple.&lt;br /&gt;&lt;br /&gt;After all that, the Macbook is up and running with everything exactly as it was. Nice.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/346563396520232414-7648081120581585913?l=billfarrow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billfarrow.blogspot.com/feeds/7648081120581585913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://billfarrow.blogspot.com/2010/05/macbook-os-x-disk-recovery.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/7648081120581585913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/7648081120581585913'/><link rel='alternate' type='text/html' href='http://billfarrow.blogspot.com/2010/05/macbook-os-x-disk-recovery.html' title='Macbook OS X disk recovery'/><author><name>Bill Farrow</name><uri>http://www.blogger.com/profile/00984136630446825155</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrwm6faYAI/AAAAAAAAATg/3eWsPYI5uWc/S220/bill-side-head-2008.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-346563396520232414.post-1555327684737945253</id><published>2010-02-18T23:02:00.000-05:00</published><updated>2010-02-18T23:07:08.246-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>OTA Digital TV Antenna</title><content type='html'>This post is about setting up an Over-The-Air (OTA) Digital TV Antenna in Raleigh, North Carolina, USA.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Background:&lt;/span&gt;&lt;br /&gt;Our living room TV is a large computer screen connected to a quiet Linux PC.  We watch OTA Digital TV using &lt;a href="http://www.mythtv.org/"&gt;MythTV&lt;/a&gt; and a &lt;a href="http://www.silicondust.com/"&gt;Silicondust&lt;/a&gt; HDHomeRun tuner.&amp;nbsp; We get following channels over the air for free:&lt;br /&gt;&lt;br /&gt;WUNC (PBS), WRAL (CBS), WTVD (ABC),&amp;nbsp;WNCN (NBC),&amp;nbsp;WLFL (CW),&amp;nbsp;WRDC (MNT), WRPX (ION, qubo, ION Life),&amp;nbsp;WRAZ (FOX, RTN).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Gray Hoverman Antenna:&lt;/span&gt;&lt;br /&gt;I built a &lt;a href="http://www.digitalhome.ca/ota/superantenna/"&gt;Gray Hoverman&lt;/a&gt; antenna out of a cardboard box, some fencing wire, hot glue, and a $5 balun from Radio Shack.  The antenna is mounted upstairs in the loft along with the HDHomerun box and just an ethernet cable running down to the main network switch.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_9vle9S6OG0Y/S34KlAlAepI/AAAAAAAAA8M/dN14eMZH8SI/s1600-h/gray-hoverman-antenna.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_9vle9S6OG0Y/S34KlAlAepI/AAAAAAAAA8M/dN14eMZH8SI/s320/gray-hoverman-antenna.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Local TV Transmission Towers:&lt;/span&gt;&lt;br /&gt;The Gray Hoverman antenna is directional by design, which makes it sensitive to small variations in rotation and tilt.  I used a combination of the webpages listed below and hdhomerun_config_gui which tunes into each channel and displays the signal strength.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_9vle9S6OG0Y/S34MmoneYbI/AAAAAAAAA8U/J__enlikBPM/s320/tv-transmitter-map.png" /&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://www.hdtvmagazine.com/programming/broadcast-market.php?dma_name[]=RALEIGH-DURHAM+%28FAYETVLLE%29"&gt;Raleigh Map&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Right now we point our antenna directly East so that it picks up WRAL (CBS) and most other channels except UNC (PBS) which is in the opposite direction.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_9vle9S6OG0Y/S3y9WZnLhVI/AAAAAAAAA78/4sBQGEssu7k/s1600-h/hdhomerun-tuning.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5439430642486707538" src="http://3.bp.blogspot.com/_9vle9S6OG0Y/S3y9WZnLhVI/AAAAAAAAA78/4sBQGEssu7k/s320/hdhomerun-tuning.png" style="cursor: pointer; height: 224px; margin: 0pt 0pt 10px 10px; width: 320px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Future directions:&lt;/span&gt;&lt;br /&gt;There are some occasional drops in signal quality which cause glitches in the picture.&amp;nbsp; If I can't improve these by tweaking the antenna position then I may have to try adding an omnidirectional antenna to my setup.&amp;nbsp; Suggestions are welcome.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Resources:&lt;/span&gt;&lt;br /&gt;Gray Hoverman antenna plans:&lt;br /&gt;&lt;a href="http://www.digitalhome.ca/ota/superantenna/"&gt;http://www.digitalhome.ca/ota/superantenna/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This webpage lists the local stations around your zip code:&lt;br /&gt;&lt;a href="http://antennaweb.org/"&gt;http://antennaweb.org&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This webpage displays a Google Map of the transmission towers around major cities in the USA&lt;br /&gt;&lt;a href="http://www.hdtvmagazine.com/programming/broadcast.php"&gt;http://www.hdtvmagazine.com/programming/broadcast.php&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/346563396520232414-1555327684737945253?l=billfarrow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billfarrow.blogspot.com/feeds/1555327684737945253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://billfarrow.blogspot.com/2010/02/ota-digital-tv-antenna.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/1555327684737945253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/1555327684737945253'/><link rel='alternate' type='text/html' href='http://billfarrow.blogspot.com/2010/02/ota-digital-tv-antenna.html' title='OTA Digital TV Antenna'/><author><name>Bill Farrow</name><uri>http://www.blogger.com/profile/00984136630446825155</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrwm6faYAI/AAAAAAAAATg/3eWsPYI5uWc/S220/bill-side-head-2008.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_9vle9S6OG0Y/S34KlAlAepI/AAAAAAAAA8M/dN14eMZH8SI/s72-c/gray-hoverman-antenna.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-346563396520232414.post-3237712691270821523</id><published>2009-01-04T22:06:00.009-05:00</published><updated>2009-02-21T16:57:21.160-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='openwrt'/><title type='text'>OpenWRT on Linksys WRT350N</title><content type='html'>&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 146px;" src="http://2.bp.blogspot.com/_9vle9S6OG0Y/SaBzEmYlH4I/AAAAAAAAAX4/PTsAtB4O1gc/s320/wrt350n.jpg" alt="" id="BLOGGER_PHOTO_ID_5305366883902758786" border="0" /&gt;My Linksys WRT350N wireless router started locking up more frequently recently, requiring a power cycle to reset it.  When this started happening every day, I decided to re-flash it with &lt;a href="http://www.openwrt.com/"&gt;OpenWRT&lt;/a&gt;  and replace the buggy Linksys v1.03.7 firmware last updated in 2007.&lt;br /&gt;&lt;br /&gt;I made the mistake of installing a pre-built Kamikaze 8.09 RC1 image (&lt;code&gt;openwrt-wrt350n_v1-squashfs.bin&lt;/code&gt;) using the upgrade webpage on the router.  When the router rebooted itself the Power LED flashed continuosly for a couple of minutes and then stayed on, but the ethernet switch was not functioning.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;TFTP&lt;br /&gt;&lt;/span&gt;The router responded to pings on 192.168.1.1 for the first few of seconds after the router was powered up.  This indicates that that the bootloader was functional and sending a new firmware image using TFTP should work. See &lt;a href="http://wiki.openwrt.org/OpenWrtDocs/Installing/TFTP"&gt;Installing OpenWRT via TFTP&lt;/a&gt;&lt;br /&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;echo -e "binary\nrexmt 1\ntimeout 60\ntrace\nput &lt;code&gt;openwrt-wrt350n_v1-squashfs.bin&lt;/code&gt;\n" | tftp 192.168.1.1&lt;/span&gt;&lt;/blockquote&gt;Unfortunatly this didn't work for me, the transfer would complete successfully but the router didn't appear to recover or reflash itself with the new image.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Serial Port&lt;/span&gt;&lt;br /&gt;The only option left was to add a serial port and gain access to the bootload console. This wepage has instructions on&lt;span style="font-size:100%;"&gt; &lt;a href="http://cascade.dyndns.org/%7Edatagarbage/wrt350n.html"&gt;Modding the Linksys WRT350N v1&lt;/a&gt;&lt;/span&gt; and &lt;a href="http://www.janitha.com/archives/106"&gt;WRT350N External Serial&lt;/a&gt; shows a way to access the serial port via the WAN port.  Several Linksys models have this special serial port connector on the WAN port, but there don't seem to be any connectors sold for it.  So I ended up opening the case and soldering on a header and custom cable - yuk.  Armed with an RS232 level converter and USB serial adaptor I got a serial console running and access to the bootloader.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Bootloader&lt;/span&gt;&lt;br /&gt;When the router boots it outputs the bootloader and kernel console info on the serial port (115200 baud, 8bits, no parity). With access to the bootloader I was able to tftp and flash a new image.  Simple really.&lt;br /&gt;&lt;br /&gt;Configuration&lt;br /&gt;OpenWRT has lots of configuration options, more than most routers.  My favorite features include being able to assign a dhcp assigned IP address to a particular MAC address and then give this IP address a host name.  Now I can browse to my PAP2 VOIP box using "http://voip/" from any computer on my network.  No more typing in IP addresses.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Software Packages&lt;/span&gt;&lt;br /&gt;Now that it was booting and I could log in via telnet and the web interface, I was able to cross-compile more packages from OpenWRT and install them.  First off the line was dropbear ssh server, install my ssh key, and disable telnet and ssh password logins.  Extra packages include statistic charting using collectd.&lt;br /&gt;&lt;br /&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 121px;" src="http://2.bp.blogspot.com/_9vle9S6OG0Y/SaB2CywIqsI/AAAAAAAAAYA/iYOfYqIrx8Y/s320/graph_eth0.png" alt="" id="BLOGGER_PHOTO_ID_5305370151397927618" border="0" /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;Conclusion&lt;/span&gt;&lt;br /&gt;My router has been running OpenWRT software for over a month now and has been doing a fantastic job.  There is still room for improvement and polish, but everything just feels solid.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.janitha.com/archives/106"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/346563396520232414-3237712691270821523?l=billfarrow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billfarrow.blogspot.com/feeds/3237712691270821523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://billfarrow.blogspot.com/2009/01/openwrt-on-linksys-wrt350n.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/3237712691270821523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/3237712691270821523'/><link rel='alternate' type='text/html' href='http://billfarrow.blogspot.com/2009/01/openwrt-on-linksys-wrt350n.html' title='OpenWRT on Linksys WRT350N'/><author><name>Bill Farrow</name><uri>http://www.blogger.com/profile/00984136630446825155</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrwm6faYAI/AAAAAAAAATg/3eWsPYI5uWc/S220/bill-side-head-2008.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_9vle9S6OG0Y/SaBzEmYlH4I/AAAAAAAAAX4/PTsAtB4O1gc/s72-c/wrt350n.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-346563396520232414.post-8584947066872296593</id><published>2008-12-30T21:35:00.006-05:00</published><updated>2008-12-30T22:01:53.764-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sca'/><category scheme='http://www.blogger.com/atom/ns#' term='casting'/><title type='text'>Metal Casting</title><content type='html'>&lt;span style="font-size:85%;"&gt;Over the last couple of years I have been dabbling in metal casting.  Metals include Pewter, Copper, and Aluminium.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Pewter Casting&lt;/span&gt;&lt;br /&gt;At Canterbury Fair in 2006 a NZ knight, Sir Sebastian vom dem&lt;br /&gt;Schwarzwald, taught a class on making soapstone molds and casting with Pewter.  After seeing this I was hooked.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;Longhouse Token&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_9vle9S6OG0Y/SVrbTTsadOI/AAAAAAAAAS8/Rs1tTbvhSqM/s1600-h/lillevang_ship.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 150px; height: 122px;" src="http://4.bp.blogspot.com/_9vle9S6OG0Y/SVrbTTsadOI/AAAAAAAAAS8/Rs1tTbvhSqM/s200/lillevang_ship.gif" alt="" id="BLOGGER_PHOTO_ID_5285778237423252706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I wanted to make a nice Event Token for the Arrowsreach Longhouse feast with a Viking theme.  Some quick research on Viking hordes turned up quite a few silver pendants and broaches that could be replicated in Pewter.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Dess. nr. 144 Found in a gravesite at Lillevang, Bornholm, Denmark. Dated circa 1,000 A.D. Stylized Viking ship, originally a brooch. Dragon heads clearly depicted on stern. Produced in silver and bronze.&lt;br /&gt;&lt;a href="http://uk.turm.dk/dk/default.asp?underside=/dk/pendants.asp"&gt;http://uk.turm.dk/dk/defau&lt;span style="font-size:85%;"&gt;lt.asp?underside=/dk/pendants.asp&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;I also found an online store selling similar reproductions in silver.  &lt;a href="http://www.urweg.com/"&gt;http://www.urweg.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Soapstone Mold&lt;/span&gt;&lt;br /&gt;Here is the hand carved soapstone mold for the token.  Notice the "scratches" to allow the gases to escape when the metal poured.  There is a second mold at the bottom of this stone for making vervelles.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrfeIfU75I/AAAAAAAAATU/FVecMPWldn4/s1600-h/lillevang_ship_mold.jpg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 229px;" src="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrfeIfU75I/AAAAAAAAATU/FVecMPWldn4/s400/lillevang_ship_mold.jpg" alt="" id="BLOGGER_PHOTO_ID_5285782821440647058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Completed Token&lt;/span&gt;&lt;br /&gt;Here is the completed token with cord attached.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_9vle9S6OG0Y/SVrcdDaufmI/AAAAAAAAATE/UNozYk9uBVo/s1600-h/lillevang_ship_token.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; cursor: pointer; width: 191px; height: 200px;" src="http://3.bp.blogspot.com/_9vle9S6OG0Y/SVrcdDaufmI/AAAAAAAAATE/UNozYk9uBVo/s200/lillevang_ship_token.jpg" alt="" id="BLOGGER_PHOTO_ID_5285779504364420706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/346563396520232414-8584947066872296593?l=billfarrow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billfarrow.blogspot.com/feeds/8584947066872296593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://billfarrow.blogspot.com/2008/12/metal-casting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/8584947066872296593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/8584947066872296593'/><link rel='alternate' type='text/html' href='http://billfarrow.blogspot.com/2008/12/metal-casting.html' title='Metal Casting'/><author><name>Bill Farrow</name><uri>http://www.blogger.com/profile/00984136630446825155</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrwm6faYAI/AAAAAAAAATg/3eWsPYI5uWc/S220/bill-side-head-2008.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_9vle9S6OG0Y/SVrbTTsadOI/AAAAAAAAAS8/Rs1tTbvhSqM/s72-c/lillevang_ship.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-346563396520232414.post-6284503343597397617</id><published>2008-12-30T21:17:00.008-05:00</published><updated>2008-12-30T21:31:31.647-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='electronics'/><category scheme='http://www.blogger.com/atom/ns#' term='microcontroller'/><title type='text'>Touch Lighting Controller</title><content type='html'>&lt;span style="font-size:85%;"&gt;This was created for my nephew, Mark W, as a component of his year 12 high school design project. He wanted mood lighting for a Four Poster Bed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrXHfHTspI/AAAAAAAAASE/izBpDi3K4TA/s1600-h/finished_bed_small.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrXHfHTspI/AAAAAAAAASE/izBpDi3K4TA/s320/finished_bed_small.jpg" alt="" id="BLOGGER_PHOTO_ID_5285773636283904658" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;Touch Sensors&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The Capacitive Touch Sensor is similar to this &lt;a href="http://www.discovercircuits.com/DJ-Circuits/5vmom1.htm"&gt;circuit&lt;/a&gt;.  To simplify the electronics I used the AVR to generate the 20kHz signal and a simplified transistor circuit.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;PIR Sensors&lt;/span&gt;&lt;br /&gt;The PIR Motion Sensors was bought from &lt;a href="http://www.jaycar.com.au/"&gt;JayCar&lt;/a&gt; and stripped down and hacked.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;RF Remote Control&lt;/span&gt;&lt;br /&gt;The reading lights on the bed are 240v halogen lamps and I didn't want to be responsible for electrocuting someone so these are controlled using RF Power Switch devices.  The remote control unit was re-wired and is now controlled by the AVR micro.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrX5UCU-7I/AAAAAAAAASM/zKF7yVwzupQ/s1600-h/lighting_controller_rf_remote_front.jpg"&gt;&lt;img style="cursor: pointer; width: 151px; height: 320px;" src="http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrX5UCU-7I/AAAAAAAAASM/zKF7yVwzupQ/s320/lighting_controller_rf_remote_front.jpg" alt="" id="BLOGGER_PHOTO_ID_5285774492303686578" border="0" /&gt;&lt;/a&gt;  &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrYQbKbnnI/AAAAAAAAASc/hpWfCcR-PpM/s1600-h/lighting_controller_rf_remote_back.jpg"&gt;&lt;img style="cursor: pointer; width: 152px; height: 320px;" src="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrYQbKbnnI/AAAAAAAAASc/hpWfCcR-PpM/s320/lighting_controller_rf_remote_back.jpg" alt="" id="BLOGGER_PHOTO_ID_5285774889353715314" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrYfWwfwhI/AAAAAAAAASk/qkzIKwx_LQI/s1600-h/rf_switch.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 196px;" src="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrYfWwfwhI/AAAAAAAAASk/qkzIKwx_LQI/s320/rf_switch.jpg" alt="" id="BLOGGER_PHOTO_ID_5285775145869230610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;White LEDs&lt;/span&gt;&lt;br /&gt;The bed has 12 White LEDs around the base. These provide mood lighting and turn on and off via touch sensors and PIR motion sensors.  They are controlled by the AVR micro and are pulse width modulated to provide dimming.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;AVR Micro&lt;/span&gt;&lt;br /&gt;The central controller was built using an old AVR 2313 micro (superseded by the AtTiny2313).&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrYvu-7CxI/AAAAAAAAASs/HemmWqOrOLI/s1600-h/lighting_controller_prototype.jpg"&gt;&lt;img style="cursor: pointer; width: 236px; height: 320px;" src="http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrYvu-7CxI/AAAAAAAAASs/HemmWqOrOLI/s320/lighting_controller_prototype.jpg" alt="" id="BLOGGER_PHOTO_ID_5285775427250096914" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_9vle9S6OG0Y/SVrY4NyXceI/AAAAAAAAAS0/SzYtj4mBzEk/s1600-h/lighting_controller_wiring.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 213px;" src="http://4.bp.blogspot.com/_9vle9S6OG0Y/SVrY4NyXceI/AAAAAAAAAS0/SzYtj4mBzEk/s320/lighting_controller_wiring.jpg" alt="" id="BLOGGER_PHOTO_ID_5285775572957884898" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/346563396520232414-6284503343597397617?l=billfarrow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billfarrow.blogspot.com/feeds/6284503343597397617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://billfarrow.blogspot.com/2008/12/touch-lighting-controller.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/6284503343597397617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/6284503343597397617'/><link rel='alternate' type='text/html' href='http://billfarrow.blogspot.com/2008/12/touch-lighting-controller.html' title='Touch Lighting Controller'/><author><name>Bill Farrow</name><uri>http://www.blogger.com/profile/00984136630446825155</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrwm6faYAI/AAAAAAAAATg/3eWsPYI5uWc/S220/bill-side-head-2008.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrXHfHTspI/AAAAAAAAASE/izBpDi3K4TA/s72-c/finished_bed_small.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-346563396520232414.post-7563972635493220362</id><published>2008-12-30T20:15:00.007-05:00</published><updated>2008-12-30T21:16:11.874-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webcam'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='quickcam'/><title type='text'>My Old Webcams</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_9vle9S6OG0Y/SVrPG85HHMI/AAAAAAAAARc/sySSOfQLUEY/s1600-h/reference-design.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 207px; height: 320px;" src="http://3.bp.blogspot.com/_9vle9S6OG0Y/SVrPG85HHMI/AAAAAAAAARc/sySSOfQLUEY/s320/reference-design.jpg" alt="" id="BLOGGER_PHOTO_ID_5285764831004531906" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;"Reference Design"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;This is the cheapest webcamera that I could find, and at AU$11 you get what you pay for.  Bought from http://msy.com.au&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Name: PC Camera&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Vendor/Product: 0x0C45:0x613A&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Bridge Chip:  SN9C120&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Image Sensor: OV7648&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; {{bill:lsusb_microdia.txt|lsusb -v -d 0c45:613a}}&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;I have tried the following Linux drivers:&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;OVCam Drivers: http://alpha.dyndns.org/ov511/&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Generic SN9Cxxx http://www.linux-projects.org (closed source)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;GSPCA / SPCA5xx http://mxhaard.free.fr/&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Usb Video Class UVC http://linux-uvc.berlios.de/&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;I'm really not confident in getting this webcam working on Linux.  It seems to be very hard to get the chip specifications, which leaves us with reverse engineering and usb packet sniffing.  It's probably not worth my time given the crappy image quality.&lt;br /&gt;&lt;br /&gt;I have been communicating with Sonix, the maker of the SN9C120 chip, and so far they have stated that they don't release the Register Descriptions or source code.  They then said that the SN9C120 was supported by gspca and UVC :-)&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Windows Driver Info&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;The Install disk for Windows says that it is installing "USB PC CAM-168" drivers and applications.  This installs an application "C:\Windows\AMCap.exe" and some driver files:&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Windows INF file {{linux:oem36.inf.txt|oem36.inf}}&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt; Datasheets &lt;/span&gt;&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;SN9C102 (similar to SN9C120) &lt;a href="http://www.mnementh.co.uk/sonix/sn9c102.pdf"&gt;http://www.mnementh.co.uk/sonix/sn9c102.pdf&lt;/a&gt;&lt;/li&gt;&lt;li&gt; OV7648 &lt;a href="http://www.ime.co.kr/Data/Omni/Web-sources/FB7648-FRF.pdf"&gt;http://www.ime.co.kr/Data/Omni/Web-sources/FB7648-FRF.pdf&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://pdf1.alldatasheet.com/datasheet-pdf/view/121707/ETC/OV7640/datasheet.pdf"&gt;http://pdf1.alldatasheet.com/datasheet-pdf/view/121707/ETC/OV7640/datasheet.pdf&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt; GSPCA&lt;/span&gt;&lt;/h3&gt;&lt;h3 style="font-weight: normal;"&gt;&lt;span style="font-size:85%;"&gt;I'm running Kubuntu on my laptop, so initially I installed the gspca-source package and used module-assistant to do the compilation.  When it didn't recognise the webcam, I modified the gspca_core.c code to include the 0x613a product id by copying the 0x613b code.  The commands to try this out are:&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style="font-size:85%;"&gt;&lt;code&gt;sudo -i&lt;br /&gt;./gspca_build&lt;br /&gt;rmmod gspca.ko&lt;br /&gt;insmod gspca.ko debug=5&lt;br /&gt;dmesg | tail&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrQI9NakWI/AAAAAAAAARk/LhCsv6R6iK8/s1600-h/gspca_0x0c45-0x613a.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrQI9NakWI/AAAAAAAAARk/LhCsv6R6iK8/s200/gspca_0x0c45-0x613a.jpg" alt="" id="BLOGGER_PHOTO_ID_5285765964961059170" border="0" /&gt;&lt;/a&gt;It still doesn't actually work, but it is closer.  The camera image is just a gray square with some periodic dots.  The problem is probably that the I configured the sensor chip as the OV7660 because  there was no entry for the OV7648 yet.  Next step is to add the usb and i2c init sequence for this sensor.&lt;br /&gt;&lt;br /&gt;Here is a good email about adding sensor support: http://lists-archives.org/spca50x-devs/01093-modifying-settings-for-0c45-613b.html&lt;br /&gt;&lt;br /&gt;To capture images from the webcam I am trying out fswebcam from http://www.firestorm.cx/fswebcam/&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;UVC&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrRE6VtQnI/AAAAAAAAARs/8gg-K334a0o/s1600-h/microdia_uvc.png.png"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 160px; height: 120px;" src="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrRE6VtQnI/AAAAAAAAARs/8gg-K334a0o/s200/microdia_uvc.png.png" alt="" id="BLOGGER_PHOTO_ID_5285766994982683250" border="0" /&gt;&lt;/a&gt;&lt;code|loading&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:courier new;"&gt;[215180.048000] usbcore: registered new interface driver uvcvideo&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215180.048000] USB Video Class driver (v0.1.0)&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215194.344000] usb 1-1: USB disconnect, address 6&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215201.336000] usb 1-1: new full speed USB device using uhci_hcd and address 7&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215201.496000] usb 1-1: configuration #1 chosen from 1 choice&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215201.500000] /usr/src/modules/gspca/gspca_core.c: driver gspca probing&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215201.500000] /usr/src/modules/gspca/gspca_core.c: driver gspca allocating memory&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215201.500000] /usr/src/modules/gspca/gspca_core.c: driver gspca detecting camera&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215201.500000] /usr/src/modules/gspca/gspca_core.c: USB SPCA5XX camera found. SONIX JPEG (sn9c1xx)&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215201.500000] /usr/src/modules/gspca/gspca_core.c: [spca5xx_probe:3997] Camera type JPEG&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;[215201.500000] /usr/src/modules/gspca/gspca_core.c: [spca5xx_getcapability:1192] maxw 640 maxh 480 minw 160 minh 120&lt;/span&gt; &lt;/span&gt;&lt;code|luvcview style="font-family: courier new;"&gt;&lt;br /&gt;luvcview version 0.2.1&lt;br /&gt;Video driver: x11&lt;br /&gt;A window manager is available&lt;br /&gt;video /dev/video0&lt;br /&gt;Error opening device /dev/video0: unable to query device.&lt;br /&gt;Init v4L2 failed !! exit fatal&lt;/code|luvcview&gt;&lt;/code|loading&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Reverse Engineering&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;I'm now using the latest source code: gspcav1-20070508.tar.gz&lt;br /&gt;&lt;br /&gt;After adding the i2c init sequence for the OV7648 that I reverse engineered from the Windows driver USB packet sniff, I still get the same "test pattern" image as above.&lt;br /&gt;&lt;br /&gt;Turn the camera LEDs on by writing 0x44 to the SN9C120 register 0x02 to set the required GPIO lines. This code example uses the usb functions provided in the gspca module code.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;__u8 regF1 = 0x44;&lt;br /&gt;sonixRegWrite(spca50x-&gt;dev, 0x08, 0x02, 0x0000, &amp;amp;regF1, 1);&lt;/code&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;QuickCam Express &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrSFHLY1-I/AAAAAAAAAR0/swr-7YHWoF8/s1600-h/quickcam-express.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 167px;" src="http://1.bp.blogspot.com/_9vle9S6OG0Y/SVrSFHLY1-I/AAAAAAAAAR0/swr-7YHWoF8/s200/quickcam-express.jpg" alt="" id="BLOGGER_PHOTO_ID_5285768097940690914" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;This camera is operational - more details to come when I get time.&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Ubuntu (Dapper) kernel quickcam driver&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Standard v4l applications like xawtv and streamer&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:78%;"&gt;&lt;code&gt;$ lsusb&lt;br /&gt;Bus 003 Device 003: ID 046d:0870 Logitech, Inc. QuickCam Express&lt;br /&gt;&lt;br /&gt;$dmesg&lt;br /&gt;[254694.256000] usb 2-1: new full speed USB device using uhci_hcd and address 5&lt;br /&gt;[254694.420000] usb 2-1: configuration #1 chosen from 1 choice&lt;br /&gt;[254695.320000] Linux video capture interface: v2.00&lt;br /&gt;[254695.416000] quickcam: QuickCam USB camera found (driver version QuickCam USB 0.6.6 $Date: 2006/11/04 08:38:14 $)&lt;br /&gt;[254695.416000] quickcam: Kernel:2.6.22-14-generic bus:2 class:FF subclass:FF vendor:046D product:0870&lt;br /&gt;[254695.424000] quickcam: Sensor HDCS-1020 detected&lt;br /&gt;[254695.428000] quickcam: Registered device: /dev/video0&lt;br /&gt;[254695.428000] usbcore: registered new interface driver quickcam&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;Aiptek Pencam&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrS1Jt9jnI/AAAAAAAAAR8/88xsLMB87L4/s1600-h/argus-camera.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 100px; height: 200px;" src="http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrS1Jt9jnI/AAAAAAAAAR8/88xsLMB87L4/s200/argus-camera.jpg" alt="" id="BLOGGER_PHOTO_ID_5285768923256295026" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This camera is operational - more details to come when I get time.&lt;br /&gt;&lt;br /&gt;GPhoto2 is able to capture and download "preview" photos&lt;br /&gt;&lt;/span&gt;&lt;code&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;$ lsusb&lt;br /&gt;Bus 002 Device 012: ID 2770:9120 NHJ, Ltd Che-ez! Snap / iClick Tiny VGA Digital Camera&lt;br /&gt;&lt;br /&gt;$ gphoto2 --auto-detect&lt;br /&gt;Model                          Port&lt;br /&gt;----------------------------------------------------------&lt;br /&gt;Argus DC-1510                  usb:&lt;br /&gt;Argus DC-1510                  usb:002,012&lt;br /&gt;&lt;br /&gt;$ ghoto2 --capture-preview&lt;br /&gt;Saving file as sq_cap.ppm&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/346563396520232414-7563972635493220362?l=billfarrow.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://billfarrow.blogspot.com/feeds/7563972635493220362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://billfarrow.blogspot.com/2008/12/my-old-webcams.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/7563972635493220362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/346563396520232414/posts/default/7563972635493220362'/><link rel='alternate' type='text/html' href='http://billfarrow.blogspot.com/2008/12/my-old-webcams.html' title='My Old Webcams'/><author><name>Bill Farrow</name><uri>http://www.blogger.com/profile/00984136630446825155</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/_9vle9S6OG0Y/SVrwm6faYAI/AAAAAAAAATg/3eWsPYI5uWc/S220/bill-side-head-2008.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_9vle9S6OG0Y/SVrPG85HHMI/AAAAAAAAARc/sySSOfQLUEY/s72-c/reference-design.jpg' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
