My Little RAID, Pt. 4

Posted 14 May 2011

I’ve been holding off writing more about the RAID until I was using it as my primary media center. Now that I’m using it for all my videos, I want to share the rest of the story.

When I last wrote, the system was operating as a RAID storage array, and served files to my network via NFS. I declined to support the Microsoft SMB sharing scheme, since I refuse to own any MS software.

The next step was to get X running and start playing some videos. For those who don’t know, X is short for “The X Window System”; sometimes incorrectly called “xwindows”. This is a network-transparent windowing system first created in 1984, and the current version 11 (aka “X-11”) in 1987. It is incredibly flexible, and strongly separates mechanisms from policies. Users can modify most behavioral aspects of the system, and can even modify or extend X programs without affecting any other users. This is industrial-strength code.

This strong separation between mechanism and policy means that while X itself puts pixels on the screen, and creates rectangular areas of screen space called windows, it does not provide any decoration or management of those windows. Instead, a separate program called a “window manager” does that. This is what users interact with and, like all good Free Software, there are dozens to choose from. These range from old standards like TWM (“Tom’s Window Manager”) to ultra-modern versions like GNOME’s “Mutter”, and the freaky Beryl. (Beryl is a “compositing” window manager; this permits really advanced graphics wizardry like “wiggle windows” – grab the title bar and shake the window like a towel.)

I have been using WindowMaker for years. This was designed to model the NeXT GUI (recently reincarnated as Mac OS/X), and fits me well. I can map all window manager operations to key combinations of my choice, which allows me to keep my fingers on the home row of the keyboard while using a GUI. In addition to productivity gain, I also avoid the RSI problems with mice.

So it was never a question that I’d want to run X and WindowMaker on this. The real question was how to start it up. Normal startup on Unix systems launches an “x display manager”, which requires you to log in. Almost none of the display managers allow you to automatically log in, because that’s a huge security problem. But it’s also a serious limitation for any embedded Unix system with a GUI. After a bit of studying I realized I should not try to force the display manager to work my way, I should just not run it.

When the machine starts, it runs a series of scripts to start various servers and processes. One of these scripts creates the “virtual tty” or virtual text consoles. And this I can set to log in a specific user automatically. Then, in that users login script, I put the commands to start X with WindowMaker. Done.

Once X was running, I needed a mouse. I’ve been using the Microsoft Arc wireless keyboard, so it seemed natural to get the Arc wireless mouse as well. Both of these are really well-made products, once again confirming that Microsoft makes great hardware.

I was able to install several media players, all of which seem to run fine. Since I had copied all my video files over, I settled down to watch some shows. Then, 10 minutes into the program, the screen goes blank and the audio cuts out. I’m thinking this is the screensaver, so I just kick the mouse with my foot. Nothing.

I’ll save you the long tale, but nothing short of rebooting would bring this machine back to life. The system was running just fine, I could remote in and do anything I wanted. But I could not restart the video system for the life of me.

Many more hours of troubleshooting later, and I found that the problem is limited to one program: MPlayer. Apparently MPlayer and the DPMS code interact poorly. DPMS is supposed to be turned off by MPlayer when it runs, but that’s not happening.

My solution was simple: don’t run MPlayer. I can do everything I want for video playing with Xine anyway. (The power of choice again.) I may return to figure out the MPlayer bug later (the power of source), but for now I wanted to move ahead with the project.

Now that I had large storage and good video playing, I wanted to relieve myself of the full-size keyboard and mouse. On my former system (running Debian GNU/Linux), I had a nice ATI “remote wonder” RF remote control. This was a joy to use: it had the usual DVD remote keys, in addition to the “fullscreen” key, and a sort-of mouse. Linux was able to use this via the LIRC remote control manager.

LIRC could read a wide range of remote interface devices, and translate those signals to a common “key symbol” coding. You would create a “lircrc” file in your home directory to map those codes to functions. And you can support many different programs with the same rc file, so using the remote with Xine would have different mappings than when using it with the Amakok music player. And you could switch between sets so as to control both programs simultaneously. Very flexible.

Alas, LIRC and remotes in general are not well-supported by FreeBSD. I could only find about 3 models of remote that were supported. And all I could find for my ATI remote was an online posting that someone had written “a simply Python program” to control it. But no hint of source code or downloads. So I could make my remote function, but it would take some work.

I’m allergic to work, so I searched for another solution. They make keyboards with touchpads, so let’s see how small they can get. When I googled for “mini wireless keyboard”, I found lots of choices. This one looked really good:

Mini Wireless Keyboard - Version1

I really liked the form factor here. And while lots of these devices were using bluetooth, this one was a true DSSS RF remote which I prefer for the range and simplicity. (I have no desire to add the Blue-Z device drivers to my system.) My existing Arc devices were DSSS, so I knew the OS had support. A few downchecks, though. The descriptions kept referring to this as “rechargable”. To me, this meant that when the internal battery wore out (say, in 18 months), I’d be stuck with buying a new one. So I kept looking.

It turned out that this company, Rii, made a second remote just like this one, but slightly changed:

Mini Wireless Keyboard - Version2

I saw three improvements right away. First they moved the touchpad from the end to the middle. You can see that using the keyboard will require you to use your thumbs, and that having the touchpad at the end makes the balance for the keyboard awkward. Second, they have a real, removable, battery. It’s a flat Li-on battery just like your cellphone uses. The third improvement is that they added a function to adjust the resolution of the touchpad, so you can match your finger movement to the on-screen movement properly.

This evolution implied that they had an actual design engineer who took version 1 and corrected issues reported by users. This made me feel that they were focused on good, rather than cheap.

Here’s a view of the guts:

Mini Wireless Keyboard - Version2

The best thing about this is that FreeBSD doesn’t know it’s a remote device. According to the pci dump, I have a USB Keyboard and USB Mouse attached. So this device is easily supported by any reasonable OS.

So far, every geek I’ve showed this to wanted a link to the Amazon page. So, if you like this device, here’s where I got it. The only reason I chose this vendor was the “fulfilled by Amazon” tag. I read too many stories about vendors not dealing fairly with people on the original model, and was unable to find the true manufacturer’s site, so this seemed safest to me.

It’s a bit spendy at $60, but now that I have it, it was the right way to go. In fact, having used both the ATI remote and this keyboard, I can say this is the better choice. If I were trying to run a MythTV or Freevo setup, with their simple menu system, I might opt for something different. But for full control of my media center, this is the only way to fly.

One more side note: at work, I have some computers running in odd places. One is underneath the false floor. A few times per year, I have to move everything off the tiles, open the floor, dig out the keyboard and mouse, then try to operate it while looking up at the screen mounted on the wall above it. When I had to do that this week, I kept thinking how perfect this little keyboard would have been for that. I’m still debating the $60.

So that’s it. 500GB of RAID, full network connectivity, and great looking full widescreen video. Full price turned out to be $296, including tax and shipping.