Showing posts with label embedded. Show all posts
Showing posts with label embedded. Show all posts

Tuesday, September 30, 2008

X10 Web Interface Added Slug

Last night, I installed the lighttpd web server and BlueLava CGI interface on the Slug. Now, we can web control the lighting at our other place. It's a bit sluggish as the CPU seems to get bogged down a bit after issuing a command, but it does the job.

Saturday, September 20, 2008

Slug Doesn't Mix with Edgeport

The 2nd NSLU2 arrived and I started hacking it. I installed SlugOS, moved it to a 2GB flash drive and then installed gcc. Next, I installed HeyU, compiled the source right on the Slug. Then I installed the Edgeport driver ( kernel-module-io-edgeport ) and put the Edgeport/2 on one USB port. It was recognized according to the syslog messages in /var/log/messages, but I couldn't get HeyU to recognize CM11A connected to the Edgeport. I tried a whole bunch of things - reflashing SlugOS, recompiling Heyu, reinstalling the drivers, installing Misterhouse, trying a W800 on it, etc. In the end, it appears the Edgeport driver doesn't work on the NSLU2.

I headed over to Fry's and picked up an Airlink USB to Serial adapter. It has the PL2303 chipset that is known to work on the Slug. I installed the kernel-module-pl2303 driver and presto, everything worked. I'll need to add a USB hub later since this, unlike the Edpgeport/2, only supports 1 serial port. Now, I need to work on a HeyU lighting schedule.

Thursday, August 28, 2008

Slug and Syslog Server

One thing I miss about having the web server on the Slug, is having logfiles. Since it's running on a USB flash drive, I've turned off logging for everything so I don't kill the flash. I finally got around to setting it up to use a syslog server and pointed it at my HA box.

To do this, I edited /etc/syslog.conf on the Slug, setting DESTINATION to "remote" and REMOTE pointing to the HA server.

DESTINATION="remote" # log destinations (buffer file remote)
MARKINT=60 # interval between --mark-- entries [min]
REDUCE=no # reduced-size logging
BUFFERSIZE=64 # buffer: size of circular buffer [kByte]
LOGFILE= # file: where to log
REMOTE=aaa.bbb.ccc.ddd:514 # remote: where to log
FOREGROUND=no # run in foreground (don't use!)

In /etc/lighttpd.conf, I set up some conditionals for access logging:

$HTTP["url"] !~ "(\.css|\.js$)" {
$HTTP["remoteip"] != "aaa.bbb.ccc.0/24" {
accesslog.use-syslog = "enable"
}
}

Anything other than .css and .js files viewed from anywhere but my LAN will get logged. Cool.

Finally, I played around with few free syslog servers. None of them did what I wanted so I wrote my own in Perl. It's very simple so far and not very efficient with the logfile handling, but it works for now:

use warnings;

use IO::Socket;
use IO::Select;
use Sys::Hostname;

$port = 514;

$socket = IO::Socket::INET->new(
Proto => 'udp',
LocalPort => $port,
);
die "Could not create socket: $!\n" unless $socket;

print "syslog server\n";

while (defined($socket)) {
recv($socket,$msg,1500,0);
@msg=split(' ',$msg);

if ($msg[11] ne "") {
print "$msg[1] $msg[2] $msg[3] $msg[4] $msg[7] $msg[11]\n";
}
open(SYSLOG,">>./syslog.txt");
print SYSLOG "$msg\n";
close(SYSLOG);
}

close($socket);

Thursday, August 21, 2008

Slug Online

I ended up ditching Unslung for OpenSlug, mainly because OpenSlug has drivers for the EdgePort USB to serial adapter. (I'm planning on getting another Slug to use as a minimal HA controller for monitoring our other house.) I also dropped Apache for the lighttpd which has a smaller memory footprint. I dropped the idea of Squid as I ended up using my home router as a SOCKS proxy over SSH. I've got my Slug running off a 1GB flash drive and it uses a meager 4-5 watts! I had tested it running an 40GB USB hard drive and together, it used about 13 watts. The 466 MHz Celeron that has run the webserver for years uses about 35-40 watts, but that will get shutdown when I iron out a few remote access issues. The Celeron box currently is instrumental in accessing the home network and I hope to move that functionality to the firewall. It is no longer a webserver, as the Slug is doing that as of today.

Tuesday, August 19, 2008

Playing With The Slug

I received the NSLU2 yesterday and had a few cycles to play around with it. I flashed it with the latest Unslung firmware. That was pretty easy. I checked out a what packages are available to see what I could put on it. I installed OpenSSH, my public key. I also installed Apache as I'm pondering replacing my public webserver (running on a 466 MHz Celeron) with this. Finally, I did the overclocking mod to boost the Slug's CPU frequency from 133MHz to 266Mhz. Apparently, the unit I got was an older rev. I'm also looking into installing Squid as a proxy, not a cache, since I use my current webserver to proxy web traffic from work inside an SSH tunnel. I'm not sure if this will have the power to proxy better than the Celeron box.

Friday, August 15, 2008

Slug On The Way

I bought a Linksys NSLU2 (aka Slug) off eBay the other day. I took advantage of the Microsoft Live 25% Cashback promotion and saved a little extra. I'm not sure what I'm going to do with it, but I'm going to play around with Unslung and build a cheap, low power server out of it.