Stupid xorg.conf Tricks

Mimo Monitor

I’m getting addicted to small USB monitors.  They’re so practical for displaying “extra” information that I don’t want to clutter up my main screen.

These monitors just require one single cable to the computer, and they typically have a touch screen interface, too.  So you can pretty much use them for any small control/display project you have.

For the office, I wanted to display the currently playing music, because otherwise I frequenly have to query the music server what’s playing, and that disrupts my work flow.  So I hooked up the screen, and I started a separate X server to display the cover and the artist/album/track name.

Then I wondered: what would I want to control with this device?  The only thing I could think of was pausing.  And writing a program just to do that seemed like overkill. 

So I just pointed evrouter at it, with the following evrouterrc-file:

“eGalax Inc. USB TouchController” “/dev/input/event7” none key/330 “Shell/pause”

So when I tap the screen, then the music pauses.  Couldn’t be easier.

My problem was then that the main X screen also got the “tap”.  I’ve long wondered how to filter out certain input devices.  X, these days, is very helpful.  If you plug in an input device, it’ll use it.  I’ve previously tried to find out how to remove certain devices from certain servers, but never been able to find out how.

It turns out to be really easy. You just remove the stuff from /usr/share/X11/xorg.conf.d/10-evdev.conf, and then put the stuff you want into the xorg.conf file for the server.


Not the least bit hacky!

RAID Fun Redux

Addonics Mini Storage Tower

You will remember me getting a new eSATA box with the crappiest thermal design ever.  To recap, there’s a big fan situated a few millimeters from an almost totally non-holey wall, Batman.  When fans are that close to an obstruction, the air flow makes a lot of noise.  So I unplugged the fan to see whether it would work as a fanless box.

And it didn’t.  One disk died after a week or so, presumably from heat stroke.  So I plugged the fan in again, and lived with the sound of a vacuum cleaner emenating from the hall closet.

Cthulhu Attacking

Until today, when a new enclosure (from Addonics) arrived.  As you can see, there’s nothing obstructing the air flow here.  However, it’s not really a hot-plug enclosure, which is disappointing.  With all the various loose wires inside the box, it looks like Cthulhu exploded inside it.

But it’s pretty quiet.  I can’t hear it at all on a two meter distance, if the closet doors are shut.

So I give this a two thumbs up on a five star scale.

More Input Devices

Targus Wireless Presenter and Emacs Volume Control

Finding wireless input devices (for controlling the stereo) that are

1) not too ugly and
2) works reliably and
3) has a range over a few meters

isn’t trivial.  I’ve experimented with a few thingamabobs, and one device I’m pretty satisfied with is the Targus …  er…  I can’t find any model name here.  AMP02EU?  Anyway, it’s a “wireless presenter” (with a laser pointer, so I could entertain a cat if I had a cat, but I don’t *sob*), so, of course, it isn’t really geared towards music playing.  But since, these days, all input devices show up as input devices in Linux, you can use it for whatever you want, with a bit of configuration.

The first thing to do is to put the following in /etc/udev/rules.d/90-itron.rules. It has to be “late” in the udev chain so that other rules don’t overwrite the name we want.

KERNEL==”event*”, BUS==”usb”, SYSFS{idVendor}==”195d”, SYSFS{idProduct}==”7777″, MODE=”0666″, NAME=”input/itron%n”

I chose the name “itron” since that’s what lsusb claims that this device is:

rocket-sam:/etc# lsusb
Bus 002 Device 018: ID 195d:7777 Itron Technology iONE Scorpius wireless keyboard

Now that we know where the device will show up (i.e., /dev/input/itron*), we can route events to the commands we want to execute.  I googled around for a while before deciding to use evrouter, which gives us pretty simple access to all events.

“Itron Powerful Receiver” “” any rel/1/1  “Shell/emacsclient –server-file=rocket-sam –eval ‘(jukebox-decrease-volume)'”
“Itron Powerful Receiver” “” any rel/1/-1  “Shell/emacsclient –server-file=rocket-sam –eval ‘(jukebox-increase-volume)'”
“Itron Powerful Receiver” “” any key/272  “Shell/emacsclient –server-file=rocket-sam –eval ‘(jukebox-pause)'”
“Itron Powerful Receiver” “” any key/104  “Shell/lights 0”
“Itron Powerful Receiver” “” any key/109  “Shell/lights 1”

The first string is the name of the device (yes, that’s what it calls itself.  How masterful).  “rel” is the mouse.  “key” is, er, a key.

So this decreases volume when the mouse goes down, increases when the mouse goes up, pauses the music when I press the big button down, and switches the lights in the room off/on on two of the other buttons.

Which still leaves me with more unused buttons, but I haven’t found a use for them yet.

Then start the event routing in a startup script like so:

$ rm -f /tmp/.evrouter\:0.0
$ /usr/local/src/evrouter-0.4/src/evrouter -f /dev/input/itron*

(The first “rm” is needed because evrouter doesn’t seem to clean up after itself always…)

The only minor problem I now have is that although evrouter picks up the events, they still get passed on to X.  So when I increase the volume, the mouse cursor goes upwards.  I haven’t bothered trying to investigate how to make X ignore certain input units, but if anyone has a pointer to a conf example, please leave a note in the comments.

Live TV!

Still can’t get my camera to focus on the TV

I haven’t really missed having live TV for a decade, but it would be practical if guests wanted to watch the news or something.  So it just occurred to me that doing live TV would be trivial with the current infrastructure.

I have an Emacs (on a machine in the closet) doing the PVR thing, so I just had that one listen to an emacs-server socket, and then just say emacsclient –eval ‘(pvr-choose-channel “CNN”)’ to change the channel.  In addition,  I have an inetd entry to spew out the programme itself:

8040 stream tcp nowait larsi /bin/cat cat /dev/video0

Close-ups work fine, though.

And then some new commands in the Emacs-based movie browser running on my movie browsing machine, and Bob is a close relative.

Everything is on github, as usual.

Tellstick Redux

I was whinging a lot about the terrible Tellstick range in my last post on the issue.  Deservedly so.  It’s terrible!  However, the Telldus people have released a new version of the device:

The revolutionary new invention is the antenna!  Who would ever have thought that an antenna would give greater range?  Kids these days.

Anyway, it really does work.  I had four separate antenna-less Tellsticks that gave me 90% coverage of my apartment earlier.  With the new Tellstick, a single one gives me 100% coverage.

That’s progress.

Emacs Home Automation

Nexa unit


We all grow so very weary of having to switch lights on and off. Every day. On again and then off again. Will the madness never end?

Technology comes to the rescue! There are companies that sell receivers (like the one pictured to the left, plugged into a wall outlet that I now see I should have dusted before snapping the picture. Too late now!) that you can control wirelessly.

So the question then is: How do you control them without (yuck!) using remote controls and stuff? You use Emacs.

Telldus sells small blue USB devices that are called Tellsticks. These expose a USB serial interface, and uses a pretty … primitive encoding method for sending commands to the units.

The Emacs Lisp code needed to send commands via Tellstick is on github, since that where all the cool kids hang out these days.

Tellstick and one of the lamps it controls

I’ve had this thing running for about half a year, and it’s really nice to be able to switch off all the lights in the entire apartment with just on the hallway computer. The main problem is that the range of the Tellstick senders is about five meters. If there moon is in the right phase and it isn’t too windy. And you feel lucky.

Fortunately I have at least one computer in each room, so I’ve just bought a truckload of Tellsticks and have each computer control each room, and then I have the remote remote control work by using emacs-server/emacsclient. But you can probably work that stuff out yourself.

Enjoy the gift of light! No longer sitting in the dark, typing away, just because you’re too lazy to get up and switch the lamps on!