Installing and Using SlimRIO
I’ve previously talked about the SlimRIO project, but I finally got around to actually getting it properly setup and installed in the playroom downstairs. I figure I should give back to the community and write up a short How-To article.
I run a Linux based music server, but SlimRIO will also work if you wanted to use Windows to serve up music. I will focus on Linux issues here, more specifically Ubuntu (Debian) configuration. There will also be some amount of hand waving that occurs, I’m going to assume you can figure out some of the details yourself. The SlimRIO website does cover Linux installation and configuration. I’m actually using SlimServer still as I haven’t upgraded to SqueezeCenter yet.
The first hurdle you might stumble on is getting the DHCP server to offer up an IP address. This will vary depending on your setup, but in my case my DHCP server is handled by my Linksys WRTGL router running DD-WRT. If you’ve got a compatible router, I strongly recommend considering using DD-WRT. Under the Adminstration->Services tab you can define a list of static leases that map MAC addresses to names and IPs. It’s really nice to talk to all of the devices on the home network by name – instead of trying to remember the IP address. [ok, so this probably wasn’t terribly helpful but there are lots of how-to documents on Linux DHCP servers]
Initially just run the Python based SSDP server. I found that on Linux the auto-detection of the host machines IP address didn’t work, so to be safe I recommend passing the numeric IP address (ie: 192.168.1.12) of your NFS file server. Later I’ll talk about using the C version and growing an /etc/init.d script for Debian based systems.
The next tricky part will be getting an NFS server configured. This is where the name (or IP) address you’ve assigned to the RIO will matter. I ended up using WireShark to sniff traffic to determine what was going wrong, it may be something you want to consider available to help diagnose problems. When the device boots it first gets an IP, the DHCP server tells the RIO what its hostname will be. The SSDP “response” tells it where the NFS server lives. The boot firmware then tries to mount via NFS the /tftpboot/<rio hostname> directory to get the rest of the firmware. Jeff Mock hosts the original investigation into the RIO boot sequence.
Assuming all things are configured correctly, it will just work. Of course you’ll have problems, but that’s where WireShark will be a life saver in pointing out what you did wrong. Another good place to look is the system logs on your Linux machine.
Now let’s make it slick and build an init.d script to start the SSDP server. This was the first time I had created one of these, so my solution may be naive – and I know that I took the long road to the solution I ended up with. The Debian policy manual covers init.d scripts in section 9.3, I initially found 9.3.5 that talked about the provided skeleton implementation. I then hacked this up to build my own init.d script for SSDP. The man page for the start-stop-daemon was very helpful in doing this.
Most of the implementation should be obvious as it is primarily directly from the skeleton. The only real work is in the start function:
# Function that starts the daemon/service.
start-stop-daemon –start –quiet –pidfile $PIDFILE \
–exec $DAEMON –background –make-pidfile \
– 192.168.1.12 \
|| echo -n ” already running”
I’ve added the –background flag as the C version of SSDP is not a daemon and would never return control to the calling program. The –make-pidfile instructs the start-stop-daemon to manage the pidfile for us instead of assuming the ssdp program will do so. The final — followed by the IP address of the NFS server is an argument to be passed to the ssdp executable. This script was installed as /etc/init.d/ssdp and now works as expected providing start, stop and restart.
The ssdp program was compiled from the C source available from the SlimRIO site. I installed it in /usr/local/bin and used chown to assign it to the slimserver user and group, then chmod +s to run the program setuid as a nod towards security (this causes it to run as the slimserver user).
Have the SSDP server automatically started at boot time is trivial. I originally found an article on how to do it in Ubuntu, but it was also in the Debian policy manual had I read it more carefully. (sometimes search engines make you stupid)
The SlimRIO firmware emulates a SliMP3 device which isn’t capable of some of the fancy (now standard) screen savers and visualizers, this isn’t a big deal for me. Also, in my setup it seemed that my MP3s were stored in a higher bitrate than it could easily handle without pauses. This is easily solved through a simple configuration in Slimserver under Player Settings->Audio – you can configure the bitrate limiting (default is no limit) which causes the music to be re-encoded on the fly, I found 128kbps to work fine.
As always, I get a kick out of “hacking” consumer electronics. Its is also nice to take something that was gathering dust and put it to good use.