gnome-power-manager and multiple batteries

In times of 2-21 to 2-25, gnome-power-manager maintained an big fat elaborate cache of power devices and combination devices which was populated by HAL. This allowed us to have “virtual” devices such as multiple composite laptop batteries. This abstraction sucked and made some horrible assumptions about devices. And it was slow.

These virtual batteries were used for policy, and generally multiple batteries sort-of-just-worked, with a few random things happening when the engine virtual layer fell down. I couldn’t test virtual devices, as my Toshiba only had one battery with no expansion available, so I relied on random patches from strangers.

Fast forward to last-week/2-26/DeviceKit. Now gnome-power-manager had a very small new ‘thin’ engine with all the devices supplied by DeviceKit-power. Batteries, on the whole were a whole lot more predictable, and the architecture was at last fairly sane. I had now got a nice shiny Thinkpad, still with only one battery, but with extra space for another. But wait, I know what you are thinking; Thin engine means no composite devices, which makes people with multiple battery laptops sad.

Fast forward to this weekend/2-27/DeviceKit. My ultrabay battery arrived in the post from the US (with customs charge, bahh) which I plugged in to the Thinkpad. Much hacking was done, and a few changes (related to empty batteries) went into DeviceKit-power and a few changes went into gnome-power-manager. Now we have a composite store with a thin engine, so the best of both worlds.

So, long story, short: if you have laptop with multiple batteries and your experience with gnome-power-manager sucks, update to git versions of DeviceKit-power and gnome-power-manager. I’ll be making releases later this week, and backporting to stable once it’s had some testing.

Does your project use PackageKit?

Yesterday, somebody asked me on IRC if there was a list of projects using PackageKit. I said no. I’m now adding a section on the website with just this content.

So, please send an email to me or the mailing list if your project is using PackageKit BY DEFAULT. This doesn’t mean “can be installed on”, but means “is usable when freshly installed”. I think it makes sense to add projects like nautilus that hook into the session interface too.

So far we’ve got replies from Fedora, Foresight, Moblin and Kubuntu. If you’re interested, please follow the instructions here or email me off-list. Thanks.

New web host

I’m looking for ideas for a web host to replace namezero. I’ve been with namezero for years and years for my personal website mostly due to laziness, but now their service has got beyond a joke and I’m looking for a replacement.

Can anyone recommend a (possibly UK based) hosting provider? I need about 1GB/month, about 50Mb webspace. I need just apache for static HTML pages, no MySQL, PHP, or any CMS fancy-whatsits. I need to transfer a single .com domain, and setup a few mail redirects — no mailboxes needed.

I don’t mind paying a little extra for uptime or for a company that isn’t going to go bust anytime soon. Ideas welcome. Thanks.

Richard.

GNOME Power Manager unstableness

Recently there has been a period of where gnome-power-manager wasn’t quite as stable and bug free as I would like. The reasons basically boil down to:

  • Rewriting the engine to support DeviceKit-power rather than HAL
  • Switching to using xbacklight rather than HAL to change the backlight (but falling back to HAL if xbacklight is not available)
  • Rewriting the idle interactions to not rely on gnome-screensaver, but instead using gnome-session and X idletime
  • Supporting HAL buttons and X buttons, and trying to filter out the duplicates
  • Working around the fact that switching the monitor off using DPMS resets the IDLETIME…. urgh.
  • Switching to using DeviceKit-power to do the suspend and hibernate, instead of using HAL

So, for the last few months I’ve been essentially trying to do the software equivalent of underpinning a house. I’ve spent the last couple of days adding more self check code, and fixing up the bugs that the new tests have found. Specifically, if your machine randomly switched off your display when you’re working, or when switching sessions didn’t restore your brightness correctly then git master probably might work for you.

Could people that have had problems, please try git master and give me success/failure as comments to the blog comment please. If the idletime and dimming stuff is 100% fixed now, then I’ll backport the fixes to stable and do a new release. Thanks.

p.s. If you change the value of GPM_USE_COMPOSITE in src/gpm-engine.c to 1 and recompile, then multiple batteries might work correctly too. Untested (still waiting for my ultra-bay battery to be delivered), so no promises.

Converting to GtkBuilder

This evening I’ve been trying to convert my projects (gnome-packagekit and gnome-power-manager) away from libgade to the shinier GtkBuilder. One less library, right? So far so good, except for the fancy super sexy custom widgets.

Stuff like the graph widget in gnome-power-statistics was created using the glade_set_custom_handler function, which was then creating the widget using gpm_graph_widget_new() in that callback. I’m not sure how to do this with GtkBuilder and the new markup format. Google isn’t being very helpful. Help appreciated. Thanks!

Application Installing (II)

I’ve been hacking more on the app-install framework. It’s now an independent project, with a tarball here.

What do the tools do?

$ app-install-create: creates the initial database, only used in the post section of the app-install package
$ app-install-add: adds data to the system database, used in repo packages
$ app-install-remove: removes data from the system database, used in repo packages
$ app-install-generate: generates the data for a desktop file, used when generating data from the distro helper

Now, the latter file is designed to be called from a distro specific helper, so for yum we do something like this:

$ app-install-generate-yum.py –repo=rawhide –dist=./dist

This downloads all the rawhide packages that ship a desktop file, uncompress them, and extract the data from the desktop files. There’s a cache, so repeated runs of this don’t have to re-download all the data. This tool takes about 10 minutes to run when the download has completed.

This tools creates ./dist/rawhide-icons.tar.gz and ./dist/rawhide.sqldata which are designed to be shipped in a distro package file.

In a package file, for instance, fedora-app-install, the post action would be something like:

$ app-install-add –repo=fedora –source=/var/lib/app-install/rawhide.sqldata

and in the preun:

$ app-install-remove –repo=fedora

I’m inviting other distros to submit distro generate tools, and I’ll ship them in the tarball.

Application installing

In the Linux desktop we have a very big problem: We focus very much on packages. Packages are interesting to programmers, but users care about applications.

I’ll explain the difference:

  • Packages can contain none, one or multiple applications. Packages are called “openoffice-common”
  • Applications only belong to one package. Applications are called “OpenOffice.org Writer”

Now, when a user wants to install an application, they have to research on Google what the package name is called (which is different on each distro) or hope that the application name is mentioned in the description of the package in the distro metadata. Not ideal at all.

Now, I said as a desktop we have one big problem, well, we actually have two: We don’t all speak English well. Some of us speak no English at all.

We want to be able to display package descriptions to the user in all languages, but we don’t want to download 80x the metadata to do so. Most packaging systems only understand en_US anyway, and there certainly isn’t the resources to translate every spec file or emerge instruction for each distro. To add to the problems, each package needs an icon, in various sizes so we can show the application icon rather than a generic box.

So we’re sunk, right?

No. In each package, there are desktop files that contain all the applications, with nice translations gently massaged and QA’d by upstream. It would be nice if we could search on that data. At the moment, this is impossible, unless we want to download every package in the archive, and extract the data from it. This is sort of how Ubuntu does gnome-app-install, and it seems to work fairly well. It is Ubuntu specific, but maybe we could work on that.

So, we cache all the desktop files, and push this out to the repo metadata?

No. If you did that you make a lot of people very unhappy, as even compressed the metadata and icons make up over 80Mb.

So we’re sunk, right?

No. What we can do is create sub-packages for each repo (e.g. rpmfusion-appdata) which ships a tarball of icons and a few hundred Kb of SQL. Every time the repo maintainer can be bothered (once a month?) the new data is generated, and a new package pushed out to the mirrors. If the repo maintainer can’t be bothered to do that, then none of the new packages will show up in the application browser. It’s optional.

This data clogs up my system right?

Well, it’s only a few tens of Mb if you want all the icons in most of the sizes, if you only choose the 48×48 option then it’s much less. When you install the new $repo-appdata subpackage, it removes all the stale applications and re-adds the latest data. This happens in the vendor spec files as postinst scripts.

How do I query the data?

It’s a simple sqlite database in /var/lib/app-install/desktop.db — the icons are located in /usr/share/app-install/icons/$size/*.png — there’s no GUI installer yet using this, but expect a few before two long.

Great! Another Ubuntu v.s. Red Hat standards war!

No. Roderick Greening, Sebastian Heinlein and myself together drafted the specification together, and made it generic enough for all the distros to use. It’s totally expected that each distro will code a different tool to extract the metadata, but that’s because they are different in some important ways.

So the maintainers have to install everything just to get the desktop files?!

No. You can download and install a package to a prefix without the deps — we don’t need the binary to run, we just need the data. in this way we don’t need to download -data subpackages, only the one with the desktop file in.

Can I add some more features to the spec?

Yes, in a little while. We want to get version 1 of the spec finished, with it being used in a few distros. When we’re comfortable this works correctly, we’ll start working on version 2, and add stuff like popularity metrics and metadata about suggesting gnome-power-manager rather than kpowersave if you’re running GNOME. There are lots of things we need to add for this to work really well.

So, Comments?