Posts Tagged ‘linux’

Frustrations (and Solutions!) with LIRC and XBMC

Posted in Uncategorized on June 19th, 2010 by Nick – 3 Comments

Those of you who know me fairly well know that I’m a total HTPC geek. It’s to the point where I outright refuse to subscribe to cable television or even hook up an antenna to my TV. This geekery combined with my affinity for Linux leads me to running XBMC on Linux on my little home theater machine. It’s been a pretty smooth experience with the exception of getting my remote work with it. If you’re struggling with it too, hopefully my tales will help you get it going.

So, here’s my setup. I’ve got an Antec Fusion 430 (a silver one with the VFD), a Logitech Harmony remote, and Ubuntu 10.04. The Antec case is pretty cool since it looks like it belongs in my home theater setup, and it even includes an IR receiver built right into the case! Cool! It should accept signals from any IR remote, right?

Wrong.

In the hardware developer’s infinite wisdom, they made it only work with Windows Media Center remotes instead of just making it a dumb device that passes data along. They actually put more effort into designing the thing just to make my life harder. Augh! Luckily, when I got this case my then-roommate had an Xbox 360 remote which magically worked! So I eventually got a Logitech Harmony remote and told it that my HTPC was actually an Xbox 360. Step one complete.

The next step was to get LIRC to accept the remote. This is a bit tricky, but luckily I had backed up my configs. If you’re starting out from scratch, here’s how to do it in an Ubuntu system.

First of all, you need to install LIRC:

sudo aptitude install lirc

During the configuration phase of the install, it’ll ask you for what kind of device you have. I selected Soundgraph iMON PAD IR/VFD, which uses the lirc_imon driver. Unfortunately, since I have the silver Antec Fusion 430 I have the VFD and not the LCD display, which has a slightly different IR receiver. You have to specify the display_type=1 when the module is loaded. You can do this by adding a file called lirc-imon.conf to /etc/modprobe.d/ with these contents. If you don’t want to restart, you’ll have to throw commands at the system to reload the module with the correct options.

sudo service lirc stop
sudo rmmod lirc_imon
sudo modprobe lirc_imon display_type=1

While you have LIRC stopped, you might as well double-check that the IR receiver is actually receiving data with the following command (hit Ctrl-C to stop):

sudo cat /dev/lirc0

You should see a bunch of garbage get printed to the terminal when you press buttons on your remote. If you don’t, then either you have the wrong type of remote or you don’t need the display_type argument to modprobe.

Next, you need to setup the button config for your remote. Since I’m using a Logitech Harmony remote to emulate an Xbox 360 remote, I used the irrecord command to generate my config. Luckily there’s plenty of people out there who have already done this for you for a large amount of remotes (here’s a good list, for example). Once you have the remote config file downloaded or created, add an include to your lircd.conf for it, fire up LIRC, and test it out with the irw command.

sudo service lirc start
irw

When you press buttons, you should see the button commands scroll by in the terminal.

*whew* Almost there. Still with me? Good, because we only have one thing left, the XBMC Lircmap.xml file! I’ll spare you the nitty-girtty of it and just give you mine (right-click and save it). If you feel like making your own or need to tweak mine a bit, the XBMC wiki has some good information on how to do it.

For the impatient, here’s all of my files associated with getting this to work:

lircd.conf (LIRC)
hardware.conf (LIRC)
xbox360.conf (remote)
Lircmap.xml (XBMC)

Doing it right

Posted in Uncategorized on November 26th, 2009 by Nick – Be the first to comment

Well, I finally bit the bullet and got a Linode account. So far I’m pretty happy with it. I figured that with the costs of power and bandwidth, I was almost spending $20/month to run my old server on my own hardware. Incidentally, the lowest-grade Linode VM costs that much and is enough to suit my needs.

So now that I’ve been setting up a webserver from scratch again, I’m doing it right this time. I’m setting up some monitoring software to notify me when things go down, I’m no longer relying on myself for DNS (no more dynamic IPs!), and I’m also branching out and trying an alternative webserver.

The webserver in question is Cherokee which claims to use less memory and perform better than Apache. It sure does use less memory, but as a down side it doesn’t have a native PHP module, so I’m required to use FastCGI for that purpose. Right now, there’s five php-cgi processes running each using about 25-30 MB. This wouldn’t be a problem except that I’ve only got 360 MB of memory to play with. On the plus side its got a pretty sweet admin interface with wizards to help you set up things like WordPress, Drupal, Ruby on Rails, Django, etc. and you can setup some pretty complex rules for what and how files should be hosted.

On the monitoring side of things, I’m using Munin to monitor the various stats on the server, Piwik for website visit statistics, and I plan on getting Monit going for service monitoring. It’s a bit more important now that I keep and eye on memory and data transfer now that I’m limited on that. Also, if some process goes wild and starts using crazy amounts of CPU power and memory, I’ll be able to catch it.

Unfortunately when you move servers, you have to move everything that was running on them. I’m still in that process, but it’s been going pretty smoothly.

PXE boot with DD-WRT and Ubuntu

Posted in Uncategorized on April 18th, 2009 by Nick – Be the first to comment

After spending all afternoon fighting with my new server and my DD-WRT router, I finally figured out how to get my server to PXE boot and fire up an Ubuntu install. All it really involved was setting up TFTP on another box (my desktop, to be specific), adding a line to DD-WRT’s DNSMasq options, and configuring the damn server to boot from PXE, which was the hardest part. Luckily, for those of you who are struggling with it, here’s how I did it.

Setting up the PXE client

I had to get my server to boot PXE in the first place. For most people, this just means poking around in the BIOS. Not for me though.

After poking around the HP site, I’ve found out that my server is a first generation Proliant DL360. Since it’s an older machine, this means that it doesn’t have a built-in BIOS config, but I had to actually download the old Compaq SmartStart 5.5 CD. I had to hunt around the HP website, but to save you the trouble, you can snag it here:

http://ftp.hp.com/pub/products/servers/supportsoftware/ZIP/smartstart-5.50-0.zip

Once you boot from the CD, you’ll want to go into the System Configuration Utility when prompted. From there, it’s just like a giant BIOS. Just turn PXE on for whatever ethernet port you’re using and it’s rarin’ to go.

Setting up the TFTP server

Once my server was setup for PXE booting, I had to set up a tftp server for it to grab the boot image from. Since I was using my desktop, which runs Ubuntu, as a host, setup was pretty easy. I just used tftpd-hpa per the Ubuntu wiki’s recommendation.

# sudo aptitude install tftpd-hpa

I had to also edit the configuration file at /etc/default/tftpd-hpa. Mine looks like this:

#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"

Since I was wanting to PXE boot into an Ubuntu install, I had to extract the install files into /var/lib/tftpboot as I put in the config file. For example, the netboot image files for Ubuntu 9.04 can be found here:

http://archive.ubuntu.com/ubuntu/dists/jaunty/main/installer-i386/current/images/netboot/netboot.tar.gz

Setting up the the DHCP server

DD-WRT uses dnsmasq for DHCP, so if you have a system which uses it too it shouldn’t be too much different to setup. Watch out, though! I initially screwed up my configuration which really messed with my router.

All you have to do is add a line to the Additional DNSMasq Options found under the Services tab. If you’re running plain dnsmasq, just add the line to your dnsmasq.conf file. The line goes a little something like this:

dhcp-boot=pxelinux.0,mybox,10.0.0.100

where pxelinux.0 is the file to boot, mybox is the hostname of the tftp server, and 10.0.0.100 is the IP address of the tftp server. You could probably get away with only specifying the hostname or just leaving it blank and supplying the IP address. You can also get more fancy and send certain boot images to certain machines, etc. This way works just fine on a home network like mine.

Once you get this all setup, any machines that try to PXE boot will receive the image and boot to it. If you used the Ubuntu install image like I did, you’ll be able to install Ubuntu on any PXE-capable machine or even boot into a rescue shell! Just remember that if you can’t setup a boot order (like my Proliant) make sure to disable the PXE boot in dnsmasq before rebooting.