Skip to content

Do you hear that, Doug? I'm coming to London!

Yes, London. You know: fish, chips, cup 'o tea, bad food, worse weather, Mary fucking Poppins... LONDON. Or as I said it on Twitter last week already, I'll be subtracting 309 from my international dialing code.

My team is moving to London over the next months, and I'm moving with it. It's been five years already since I landed here in Ireland by now, longer than I ever expected when I arrived. Living in the UK instead of in Ireland will be a nice change. It's still off the European continent, but with directs flights to home for both of us we'll feel like we're much closer. And I expect there are more advantages that will offset living in what is also a heavily congested city.

I'll still be doing the same work, just in a different location for various practical reasons. The move will happen somewhere halfway the next quarter, so we're slowly starting preparations. Besides packing and cancelling utilities/services/etc, that also means experiencing Ireland as a tourist. After living here for five years, I've still not seen the Giant's Causeway, the Cliffs of Moher and some other stuff ... so should give that a shot now!

I might be posting here a little bit more over the next while. :-)

uhat, using your joystick's hat switch in Linux flight simulators

So I have this fun hobby for a while already, flying.. I have around 50 hours logged by now in the US + Ireland, which means I can more or less land safely now, on my own. In fact I had my first solo in October last year which was an absolutely amazing experience. But sometimes weather just doesn't work with me here in Ireland (either too windy or too cloudy) and instead I go "flying" with X-Plane on my machine at home.

Now X-Plane is a pretty neat simulator, and as long as you use it with a real yoke/stick and not keyboard/mouse, it seems like a useful way to practice. But there's one way in which a flight simulation projected on a single screen, no matter its size, just doesn't beat sitting in a cockpit: the inability to look around in any direction by, you know, just turning your head. Instead, joysticks often have this hat switch on the top to look around. Unfortunately in Linux, the joystick driver gets told that the hat switch is a mini-joystick that the user can move up/down, left/right. Instead of just representing it as four separate buttons (which is what they really are anyway, hardware-wise). X-Plane and apparently other flight simulators can't use this, they need buttons.

This week I wrote uhat to solve this problem. It'll listen to joystick events and if you move the hat switch axes, it will generate button events on a separate virtual joystick device. There's a similar tool called jhat, which generates keyboard events instead, but I never really liked the idea of my joystick pretending to be a keyboard and hoped there were a better way to do this. A week ago I found my answer in uinput. It's poorly documented, but fortunately very simple to figure out. It looks like uinput is just a fairly 1:1 translation of the input subsystem kernel interface into a character device.

It works like a charm for me, with the udev rule I don't even have to think about it, udev will just start it for me when I plug in my joystick. Hugely enjoying X-Plane 10 again. :-D