Tag Archives: Gnome

www.gnome.org

Webcams that just work with Ubuntu Linux

The GNOME Foundation Board asked me to buy a webcam for the GNOME Events Box, so we could show Cheese on our stands. This could be cool together with the box’s new projector. I also wanted a webcam for my own use so Liam’s grandparents can see him in motion more often. So this was an opportunity to discover if any two available webcams really “just work” with Ubuntu, after doing some research and guessing. The results were great.

I bought a Logitech QuickCam Pro 9000 and a Creative Live! Cam Optia AF, both 2 Megapixel webcams. The video for both “just work”ed perfectly in Ekiga, Cheese, and Skype, on Ubuntu Linux Gutsy (7.10) and Hardy (8.04, currently in beta), though all these programs require you to choose the video input from a list, regardless of how well the webcam works. The Logitech one has a built-in microphone without an extra cable. The Creative one has a separate cheapish in-ear headphone+microphone headset for the regular 3.5mm “minijack” socket.

IMG_3337

I recommend the Logitech because it has a convenient built-in USB microphone that avoids non-USB microphone hell, though you’ll obviously then need speakers for the output. I added it to my Ubuntu Hardware. That page has almost paid for the costs of the USB Wi-Fi sticks that I bought to discover one that worked. Maybe it will pay for my webcam too. What other hardware should I use that page for, to discover just one model that really “just works”? As I’ve said before, I think the hardware lists on the Ubuntu wiki are mostly useless for real users because nobody is insisting that “just works” really means “just works”, and nobody is flagging the ones that really do just work.

It was nice to see that these products have dire warnings about not attaching them to your Windows PC before installing the special software, and to see that Amazon has lots of comments about how people couldn’t get them working with Windows.

Getting my microphone to work

A couple of years ago the microphone on my headset (regular, not USB) stopped working. I had used it with Skype briefly. I guessed it was a problem with the headset. A while ago I bought a new headset, and that microphone didn’t work either. Then I knew that it was a software problem with Ubuntu/Linux. I have two new headsets now so I am really really sure.

Today, I was trying to get either Skype or Ekiga working between two computers on my local network, and I still can’t fix it. The laptop is using a USB microphone built in to a webcam, and that works fine. But I can’t get the headset to work with my desktop PC. Here are some screenshot to express my frustration.

System-wide Sound Preferences

The Sound Preferences control panel forces me to choose from a huge list of meaningless device names, none of which work. Here are the basic settings (in Ubuntu Hardy, but this hasn’t worked in Gutsy or Feisty, at least). The test button doesn’t echo any sound to me with any of the choices. Some of the choices show a dialog with a gstreamer pipeline error, which then hangs the control panel.

Sound Preferences

And here are the volume preferences (strangely only available from the panel applet), to show that the microphone is not muted:

Volume Preferences

Also, the Sound Recorder application refuses to start, saying “Your audio capture settings are invalid. Please correct them in the Multimedia settings.”, whatever device I choose in the Sound Preferences. Strangely, Jokosher’s wave graph shows that some input is being received when I speak, but I don’t hear anything when I play it back. It’s nice that Jokosher has no microphone preferences of its own, by the way.

Update: Juerg Billeter pointed out that there’s also a preferences window in the Volume Control, via the Edit menu. It has some obscure check boxes that I can select. None of them seem to help. So now there are yet more things that I can break while looking for the one thing that I need to change to fix the problem, so that one thing probably won’t fix the problem anymore when I find it.

Volume Control Preferences

Application-Specific Sound Preferences

Ekiga asks me to choose one of these devices:

Ekiga Sound Preferences

Skype asks me to choose from this huge list:

Skype Sound Preferences

And what’s with those “default” device choices in both the sound input and output? Neither actually work, though both are offered (and sometimes, but not always, chosen by default) by applications such as Ekiga.

glibmm 2.16.0

With the release of GNOME 2.22 we finally made an API/ABI stable release of glibmm with the new giomm API. We went way past the GNOME API freeze date, which was scary and unwise, so there are sure to be some undiscovered problems. But we are quite sure that any remaining problems would be things that we could fix by deprecation+addition.

There are some giomm examples in the gtkmm-documentation module and the giomm API reference is not too bad. For instance, see Gio::File. Hopefully I will find the time to write a chapter on giomm for the gtkmm book.

Thanks again to Marko Anastasov who did all the initial wrapping work and to Jonathan Jongsma and José Alburquerque. Jonathan Jongsma is now officially a co-maintainer of glibmm. I’ve pesuaded him to do tarball releases after glibmm 2.16.0. Now I must persuade Marko to become a co-maintainer of something.

To the GTK+ HackFest in Berlin

Early tomorrow I’ll take a train to Berlin for the GTK+ HackFest. I’ll arrive at 14:07 at the Hauptbahnhof [1] and wait for Behdad to arrive a few minutes later, if the trains are on time. Unfortunately, I’ll miss most people because I’m leaving the next evening. But I can only be away for one day and it seems I can be most useful as a German speaker helping to get things set up.

I wouldn’t be that useful later anyway. I don’t really do communal coding. For one thing, it doesn’t work when other people try to show me something quickly and see that I don’t use either emacs or vi on my laptop. I can’t imagine using them and I believe this may be due to some fundamentally different structure in my brain.

I am quite looking forward to the six hour train ride to Berlin. When I regularly did the Munich-Berlin commute it was great for solving bugs that had stacked up and needed some dedicated concentration.

Someone asked me today if I’m a native English speaker. Yes, I am. Ask a German.

[1] I can’t get used to calling it the Haupbahnhof. It’s the Lehrter Bahnhof even if it now looks like a giant ant farm.

Two Months and Smiling

Liam is just over two months old now. He’s a little more aware of the world, though not really interacting with it much yet. He started to smile properly a week ago, and every day he makes slightly different vowel sounds. After two months of sleeping, eating and crying, the first wide smile makes a big emotional impact.

He’s now nearly 5 Kg, almost double his birth weight, and my back knows it.

liam_weighing_cropped_small.jpg

Sigi and I take turns so we can get other things done. I have the midnight to 4am shift, when I give him the bottle, and 10am to 12pm. I generally get work done between 12:00 noon and 18:00, and sometimes in that midnight to 4am shift. He’s quite an easy baby, I think, but we are very lucky that there are two of us who can give him lots of time. It would be nice if he didn’t need to sleep in my arms quite so much.

I have decided to avoid taking on much new work before June, so we can keep this daily routine for a while more. I’ll also look for a small office in the neighbourhood – The Glockenbachviertel in Munich, in case anyone has a suggestion. But there is work to do so I’m still trying to hire new people.

Clutter Tutorial done for now

Now that Clutter 0.6 is out, I found the time to finish the planned sections for the Clutter tutorial that I mentioned in December, for Openismus. Here is the html version and a PDF, though of course the PDF doesn’t have the nice links into the API reference documentation and the links to the actual files of the examples.

The guys at OpenedHand haven’t had time to review this yet, so be aware that there could be significant errors. But I think it’s mostly accurate, useful, and unique, though the appendices and full example are obviously lacking. I’ll try to keep it up to date and correct as I get feedback.

Having done all this investigation into Clutter, I have formed some opinions:

  • Clutter is a nice way to move semi-3D things around on the screen to create “innovative” user interfaces. Its abstractions for actors and behaviours really give you something to work with compared to using OpenGL directly. But it’s still hard to create natural-feeling responsive applications and I don’t know exactly what’s lacking. It feels like there is a disconnect between the act of coding and the very dynamic UIs that the code creates. I sometimes feel I’d like to just put actors on a rail, twist that rail about, connect some actors together with struts or springs, start them moving, let the user push and pull them around within constraints, and trigger extra behaviour when they reach certain positions, or reach each other.
  • Clutter is now a very basic API. You will need to implement a lot of simple functionality to create applications that act as today’s users expect. The Tidy “reference-implementation” example toolkit thing is not a shared library – it’s meant as an inspiration for you to do all this yourself, and it is itself not very complete. I don’t think that is a wise strategy, though rampant bad reimplementation is the standard in today’s mobile/embedded development projects.
  • Neither you or Clutter should want to reimplement the huge amount of UI logic that is, for instance, in GTK+. Without reusing all that work, Clutter applications will generally have inconsistent or inadequate text editing, scrolling, focus, keyboard accessibility, right-to-left language support, etc. Applications will share little common API so it won’t be easy to throw new developers at your project. Somehow we need a way to use some GTK+ widgets in Clutter without them looking and feeling like they are visitors from an extra dimension.

These problems could probably be solved by lots of hard work by smart people. I don’t know what the near-future strategy for Clutter is, so I don’t know if the current state is intentional or if anything particular is planned. It’s certainly getting better all the time.

gnome-lirc-properties: Using PolicyKit to get sudo access

Can’t get PolicyKit’s ObtainAuthorization() to work.

gnome-lirc-properties, which I just mentioned needs to edit /etc/lirc/lircd.conf, which requires sudo/root access. Various APIs exist to get temporary sudo/root access but everyone now seems to agree that the new PolicyKit system is the way to go. I’d like to link to a website for it. All the system administration control panels in Ubuntu Hardy Heron seem to use PolicyKit already.

But I can’t get the thing to work, maybe because I’m using Python, and I haven’t found any help so far. I have defined the PolicyKit mechanism, but I can’t get even a simple test of the ObtainAuthorization() method to do anything interesting. This python code does not return anything other than None from ObtainAuthorization() and none of the callbacks are called:

#!/usr/bin/python

import pygtk
pygtk.require('2.0')
import gtk

import dbus
import os

class TestWindow:
    def on_button_clicked(self, widget, data=None):

	#Call the D-Bus method to request PolicyKit authorization:

        session_bus = dbus.SessionBus()
        policykit = session_bus.get_object('org.freedesktop.PolicyKit.AuthenticationAgent', '/', "org.gnome.PolicyKit.AuthorizationManager.SingleInstance")
        if(policykit == None):
           print("Error: Could not get PolicyKit D-Bus Interface\n")

        gdkwindow = self.window.window
        xid = gdkwindow.xid

        print "Calling ObtainAuthorization..."

        #This complains that no ObtainAuthorization(ssi) exists:
        #granted = policykit.ObtainAuthorization("test_action_id", xid, os.getpid())

        #TODO: Neither of the async callbacks are called, and how could the return value be useful if it is async?
        # Note: Other code (such as gnome-panel) seems to use ShowDialog instead of ObtainAuthorization, though
        # ShowDialog is apparently deprecated (I don't know when), but that also has no effect.
        granted = policykit.ObtainAuthorization("test_action_id", xid, os.getpid(), reply_handler=self.__handleAuthReply, error_handler=self.__handleAuthError)

        print "...Finished."

        print "granted=", granted

    def __handleAuthReply(self, granted):
        print "handleAuthReply: granted\n"

    def __handleAuthError(self, exception):
        print "handleAuthError: not granted: %s\n" % exception

    def on_delete_event(self, widget, event, data=None):
        # Close the window:
        return False

    def on_destroy(self, widget, data=None):
        gtk.main_quit()

    def show(self):
       self.window.show()

    def __init__(self):

        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("delete_event", self.on_delete_event)
        self.window.connect("destroy", self.on_destroy)

        self.button = gtk.Button("Obtain Authorization")
        self.button.connect("clicked", self.on_button_clicked, None)
        self.window.add(self.button)
        self.button.show()

window = TestWindow()
window.show()
gtk.main()

gnome-lirc-properties has a real mechanism and tries to use ObtainAuthorization() for real, if someone wants to look at it properly. Here is the gnome-lirc-properties svn, and a tarball (it doesn’t do much yet).

How to use PolicyKit from an application

In return for asking the lazy web, I’ll try to describe how I think it should work, based mostly on David Zeuthen’s description. There are many opportunities to get something wrong:

  • You install a D-Bus service (a PolicyKit “mechanism”) that does the thing that needs sudo access. PolicyKit will control access to this mechanism. For instance, the Clock applet’s mechanism has a SetTimeZone method. gnome-lirc-properties uses the Python D-Bus bindings to implement its mechanism. I know that our WriteConfigFile() method is far too generic, but we will improve it when we get this working.
  • Update:: And this mechanism’s implementation should ask PolicyKit if it has authorization, and return an error if it doesn’t. Thanks mclasen. I’ll try to find out how to do this. Update: You can do this via the PolicyKit (on the session bus) object’s IsProcessAuthorized() method, now used in the gnome-lirc-properties PolicyKit mechanism.
  • As with other D-Bus services, you install a .service file, so that D-Bus activation can start it on demand. PolicyKit mechanisms use the System bus rather than the Session bus, so you install it in $(datadir)/dbus-1/system-services (/usr/share/dbus-1/system-services on Ubuntu). Here is the .service file for gnome-lirc-properties.
  • As with other D-Bus services, you install a .conf file, saying who can use the service. This is installed in $(sysconfdir)/dbus-1/system.d (/etc/dbus-1/system.d/ on Ubuntu). This is the .conf file for gnome-lirc-properties
  • A .policy file tells PolicyKit who should be allowed to use the mechanism. You install this in $(datadir)/PolicyKit/policy (/usr/share/PolicyKit on Ubuntu). Here is the .policy file for gnome-lirc-properties. I believe this allows system administrators to configure access to these features via these .policy files, and I believe that is the whole point of this D-Bus “mechanism” abstraction.
  • Applications that want to use this mechanism call the ObtainAuthorization() method on the “org.freedesktop.PolicyKit.AuthenticationAgent” D-Bus service, passing the action ID that is mentioned in the .policy file. If necessary, PolicyKit asks for a password (or whatever) for authentication, and presumably then gives the application the appropriate rights. The dialog uses (translatable) text from the .policy file, so it’s very specific to your application. Many applications still seem to be using the ShowDialog() method instead, but that has been deprecated.

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.