gnome-lirc-properties: A GUI to configure Infra-Red Remote Controls

We at Openismus will be working on a little GUI control panel to configure remote controls, so you can more easily, for instance, control a media-center application such as Elisa. We are doing this for Fluendo.

It should end up looking something like this and it will basically just give you a working /etc/lirc/lircd.conf file for your remote control:

gnome-lirc-properties Screenshot

I’ll make a few posts about this, but first here’s some (opinionated) notes about how I think it works now on Ubuntu without this GUI:

Installing lirc

You select the remote control via a curses UI when you install lirc (or when you run sudo dpkg-reconfigure lirc). We would prefer it to install silently and let the user configure it when he wants to. I think the script for this is debian/lirc.config.in in the lirc debian package, though this doesn’t seem to be the whole story. It seems to use the prewritten configuration files in /usr/share/lirc/, listed in the /usr/share/lirc/lirc.hwdb file, which seem to be supplied only with Debian/Ubuntu.
This creates

  • /etc/lirc/lircd.conf, which maps the key names to the key codes supplied by your IR remote (usually assuming that you are using the IR receiver (if any) supplied with the IR remote control. It’s these key names that an application will receive via the liblirc_client library.
  • /etc/udev/rules.d/85-lirc.rules, which uses /etc/init.d/lirc, which starts “/usr/sbin/lircd –device=/dev/lirc0”.

Custom Configuration

When the lirc package does not know about your hardware, or if it has a bad configuration file, you can use the irrecord utility (installed with lirc) to generate a custom lircd.conf file, which you can move to /etc/lirc/lircd.conf. It checks for key codes and some other aspects of the remote control. Here is an example of an irrecord run. irrecord is a command-line utility which takes input on stdin. Doing this programatically is going to be difficult, probably requiring the creation of a libirrecord in the lirc sources.

Note that the default device for lirc is /dev/lirc, and it doesn’t check for other devices automatically, but applications don’t need to specify the device because they just communicate with lird via liblirc_client. However, the irrecord utility doesn’t use lircd so you’ll need to use the –device option with it too.

The application

The application then creates a .lircrc file (Elisa creates one in /tmp when it starts, and this seems the only sensible thing to do) which maps these key names to “command” names. This seems like a useless extra step because most applications will just invent “command” names which are identical (or near identical) to the “key” names. The entries in this .lircrc must use the same “prog” identifier string as the application has passed to the lirc_init() function – another annoying invitation to failure. This is presumably useful when using one .lircrc file to control multiple applications somehow, but I can’t see how that could ever be useful – a global .lircrc file could at the most be used to _start_ applications, not control them.

Update:: Of course, I do have the strong feeling that remote controls should be just another input device, like mice and keyboards, so the whole lirc daemon thing seems odd. But I’m not a kernel or X programmer. This might even be planned for the future, but I don’t know. We do need something to make lirc work easily now.

Crappy GPS Applications

I have recently acquired a Nokia N810 Internet Tablet and a N95 8GB mobile phone. Both have GPS capability but both have quite awful maps applications. It feels like a checkbox feature – a way to list GPS as a feature on the box, but not a way to do something useful, and not something that’s been thoroughly tested or thought-through. They suffer in comparison to the Garmin device that I already had.

Both take a while to make a connection to the satellites, which is normal with this generation of GPS chips, though I’d expect the N95 to at least get an approximate position from the mobile phone network (Update: I now know that this AGPS feature is in the N95 but it requires a network connection, which requires paying for a GPS/UMTS data connection, which I try to avoid, because I know the telecommunications company will screw me). More significantly, when they actually get a lock on the satellite, they do nothing. Well, the N95 turns some circles green. They don’t show where you are, or even ask if you’d like to see where you are. And neither seem to have any way to do so even by choosing from a menu.

N810 says I am in Antwerp

The N810 has a “Show Current Location” menu item, but it just shows me its default location – a street in Antwerp, NetherlandsBelgium. I’m sure I’m in Munich, Germany. I notice now that I can change its map to “Germany-Alps”, which has Germany, Switzerland and Austria, and I guess that would work if I tried it again. But it should not just silently fail. My Garmin Nüvi 350 shows the map of your current location as soon as it has locked on to a satellite, and has all of western Europe at once without any fiddling.

N95 says I am in Antarctica

The N95 8GB has a “Find GPS Location[0]” (or similar. It was in German when I tried it, and the menu item isn’t there when there’s no satellite connection indoors, so I can’t see now). But it just showed a white screen instead of the map. I tried zooming out and then understood that it had placed me on the south pole at the bottom of the world. This doesn’t seem like a useful feature. I later found that it does put a cross over your real location, but doesn’t take you there. If you search for your location by address then you’ll be able to scroll to see the cross. Again, not very helpful.

Can’t find my way around the GPS UI

Both the N810 and the N95 show that a menu system is not a great UI for this kind of application, regardless of concerns about application consistency. There are very few things I need to do with a map and they need to be immediately available. The menus in Maemo (on the N810) are a particularly small target on an otherwise generous screen and I hate using them in any Maemo application. My Garmin Nüvi 350 has wonderfully simple button-driven menus, presumably the result of long experience making these kinds of applications. People love it.

N95 surprisingly uncoordinated

The N95 generally seems to be a mish-mash of applications thrown together with very little overview. There are even two similar, but subtly different, main menus, with their own dedicated buttons. The video player has no back/forward feature. You are repeatedly asked whether you want to connect to your wi-fi network instead of it happening automatically. The N95 can do some incredible things, it just does them in strangely arbitrary ways and hides its capabilities well. For instance, the camera’s direct upload to Flickr is wonderfully simple once you’ve set it up. The N810 isn’t perfect but you could make a far nicer device than the N95 just by adding mobile phone capabilities to the N810.

Openismus needs another GTK+/GNOME developer

We need another full-time developer at Openismus to start in a month or so. You’ll ideally be a resident of Germany and you’ll have common sense and visible experience with GTK+ and some of the GNOME technologies such as D-Bus. I’m mostly interested in a C coder at the moment, but experience with Python and/or C++ is a plus. You’ll work from home and know that you can. Capable people are hard to find so you probably know if you are suitable. Working for Openismus is quite straightforward, with fairly clearly defined tasks, some choice about what you work on, and a boss who can be persuaded that he’s wrong sometimes.

I am very pleased with our current developers but we can’t wait the 20 years for a clone to mature – it’s just not practical.

Please email me with a CV (any format you like) and a paragraph describing yourself, your experience, and your current development interests.

Update on 1st March 2008: We are still looking, and we maybe need more than one new developer. But you need to be convincing.

giomm: gio in C++

Over the last couple of weeks I’ve been gradually pulling glibmm’s gio wrapper into shape. It provides a gtkmm-like API for the new gio I/O API in glib 2.15/16. It’s available in the glibmm 2.15.x tarballs, and will be API stable in glibmm 2.16 (Tarballs, svn).

There are a handful of giomm examples in the gtkmm-documentation module and we are adding more. Thanks to Marko Anastasov who did all the initial wrapping work and Jonathan Jongsma and José Alburquerque who have helped to perfect it.

It was quite awkward repetitive work because we had to add so many method overloads and reorder so many parameters, and write most of the documentation by hand (not finished yet). I feel most of the work is now done, so I’m less worried about impending API stability, but I still want more people to review the API and try to use it.

Some thoughts for people creating language bindings

Many gio functions take several arguments, half of which (such as the GCancellable, and sometimes the callback) can be NULL or have obvious defaults (such as G_IO_PRIORITY_DEFAULT, or G_FILE_QUERY_INFO_NONE, or “*” for attributes). It’s too late to reorder the parameters in the C API, but I strongly suggest that you try to copy the parameter sequences in the giomm methods. Replacing GError with an exception removes another parameter. For instance, compare Gio::File::query_info(), which can be called with no parameters, with g_file_query_info().

Some thoughts in general

I quite like the consistent approach to asynchronous operations. Basically, there are often two forms of a function – a synchronous one (blocks, returning when it has a result) and an asynchronous one (returns immediately, and tells you later when it has a result). For instance, g_file_query_info() and g_file_query_info_async(). With the async one, you then call the *_finish() (for instance, g_file_query_info_finish()) to get the result. See GFile (or Gio::File) for a full explanation.

For a while I wondered if some intermediate object would be conceptually more beautiful, so you wouldn’t have to read the documentation to know about the *_finish() method to call, but it seems worse. For instance:

async_request = file.query_info_async();
async_request.signal_finished().connect(&on_query_finished);
async_request.start(); //We would have to do this only after connecting the signal.
...
if(something happened)
  async_request.cancel();
...
void on_query_finished(...)
{
  ...
  result = async_request.get_result();
}

Bug-fixed Glom 1.6 in Ubuntu 7.10 “Gutsy”

I’m regularly annoyed that no stable version of Ubuntu has a bug-fixed version of Glom. For instance, Ubuntu Gutsy has Glom 1.6.0 and the ubuntu-updates policy does not allow it to have Glom 1.6.6. Unfortunately Glom 1.6.0 and some dependencies have bugs making it mostly unusable, such as a failure when changing field types, and not shutting PostgreSQL down properly.

The irony is that Glom is totally open source / free software and is using the recommended deployment method (shipping with the distro itself), but this doesn’t allow us to get bug fixes to users. I understand that non security bug-fixes for non-essential software is not a priority for Ubuntu but it’s frustrating for users. I suspect that they bend the rules for essential stuff like OpenOffice. I find myself wishing for a security problem to fix in Glom just so I can get the non-security bug fixes released along with the security fix.

However, Ubuntu recently created the PPA (Personal Package Archive) system, so Daniel has made some updated packages available in the Openismus PPA. Forcing people to add a repository will lose us many non-technical users but it’s the best we can do right now. I’ve updated the Glom download page.

Liam Kiefer

On the 29th December 2007 at 16:55, Liam Kiefer Cumming was born, 50cm long and weighing 2610 grams. I’ve spent most of the day in the hospital since then, including a ridiculously happy new-year’s in the Kinderstation changing and feeding him together as a family when the clock hit midnight.

Liam Kiefer on day 2

Early on the morning of the 29th we weren’t sure whether it was contractions that Sigi was feeling but they quickly became regular and frequent so we walked the few streets through the cold (-20C apparently) to the hospital and were told we’d made the right decision. Things moved quickly after that and the birth went well, without major problems. Liam has some very minor temporary complications so he’s stayed in hospital a few extra days, but should be home quite soon. He’s quietly inquisitive when he’s awake but mostly just sleeps, waving his arms for comic effect. He loves to drink but tends to eject it from either or both ends soon afterwards.

The people at the Maistrasse clinic here in Munich are skilled and patient, just firm enough and just gentle enough and there are many kind people to help with everything.

Liam’s middle name is taken from Hans Kiefer, Sigi’s great-grandfather who strolled with her around his Großsanktpeter village in the Romanian Banat, greeting everyone in their own German, Romanian, Hungarian, Serbian, or Roma languages, and who claimed to have used the same skills to fool various invading armies into believing he was one of them. When we visited Romania in 2006 we were invited into his old house, now the home of an aged Roma man and his family who remembered him fondly as Kiefer Bachi (or Baji, or something, apparently Serbian. Do correct me.) meaning Old man Kiefer. (Update: It’s “Kiefer Bácsi” and it’s Hungarian)

I’m particularly glad that Liam has three great-grandparents of his own on Sigi’s side, because family is scarce on my side, though he will have nice holidays with his aunt in Wales and his grandfather in Scotland.

Changes

People generally don’t mention pregnancy during the first trimester, not knowing whether there will be second trimester, and this became a habit for us. But things are going well so I should mention this properly. My girlfriend, Sigi, is pregnant, in her ninth month, so some time in early January I’ll be a father. The due date is 12th January, but it’s statistically likely to happen a few days earlier.

I am incredibly ready for all the changes this will bring. It feels very right and I plan to be good at this. Just the thought makes me so happy.

I’m not going to disappear but don’t expect me to be normally responsive during January and February.

GNOME versus projectors

My post about my new not-working-automatically Monitor reminded me of something that I forgot to follow up, though it’s probably unrelated.

At FOSDEM in February 2007, I muttered to X man Keith Packard that my laptop (with Intel graphics) didn’t work with the projector. I complain to everyone about this at all conferences, because it never works for me, regardless of laptop or projector model. Either the size is wrong or the sync rate is wrong or there’s nothing to give me any clue. It often works up to the login and then stops working after I’ve logged in. So I always borrow someone else’s laptop at the last moment. This is just one reason why my presentations are always shit.

But Keith dropped a clue. He said that immediately after login GNOME reset something that breaks things. I chased him about it in email afterwards and he said
“Oh, I found it — if your configuration settings include a monitor size, gnome would randr you to that size. I can’t remember where that was as I deleted it from my config though.”

Can anyone do something with this nugget of information?

Widescreen

The end of the tax year encouraged me to get a new 24″ 1920×1600 widescreen monitor (HP W2408H) for the sake of my back and eyes.

Ubuntu Gutsy (7.10) didn’t work with it automatically, even after a restart. The monitor complained that the input was “out of range”. It seemed to be using too high a sync rate. Doing “dpkg-reconfigure xserver-xorg” fixed it, though I naturally had to use a second PC to do that via ssh.

I was using a 17″ before, so the hugeness and brightness is disorientating. It can rotate too, so I can have a tall thin screen instead, should I ever want that. I’ve seen desks at Google (through the windows) that have two of these side by side – that would be truly useful. Weirdly, drawing of windows is noticeably slow when the screen is rotated. I wonder what that’s about. (Via System/Screen Resolution in Ubuntu. I guess that’s XRandR.)

My graphics card only has VGA output (integrated Intel 915G), so I’m probably not seeing the clearest picture. I should get a separate card with a HDMI or DVI output, but I don’t look forward to the driver problems. It looks like life will be good with AMD/ATI Radeon cards in the near future, but not until the next version of Ubuntu, I guess.

Clutter Tutorial

Over the last couple of weeks, I’ve been writing a Clutter tutorial for Openismus. Clutter is a “2.5D” canvas API maintained by OpenedHand.

Here you can see a preview of the tutorial, though some sections just have TODOs for now. I think it’s already the only place to find a useful description of Clutter Timelines, Effects and Behaviours and how they relate to each other, and it’s the only place that I’ve seen mention of how to manage the refcounting of the various objects. Thanks to the OpenedHand guys for answering my questions so patiently.

I’m waiting for the new high-level Clutter library to be created before completing the remaining sections, because the containers have already been moved out of the main clutter library, and that new library should have some interesting (but maybe not perfect at first) actors for doing scrolling and lists of text.

It’s DocBook, with some scripts to pull in the example code, in the clutter-tutorial module in OpenedHand’s svn repository:

As I’ve done in the past for gtkmm documentation, the examples are almost mind-numbingly simple so people have the best chance of seeing the use of the relevant API. However, there is one slightly more realistic full example. I hope that the containers in the new library will help me to make it prettier.

I guess you should report bugs in the tutorial in Clutter’s bugzilla, in the Documentation component.